Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/MessageContainer.cs @ 5405

Last change on this file since 5405 was 5404, checked in by cneumuel, 14 years ago

#1233

  • changed the workflow of aquireing a new job from server.
    • if a job is available for calculation, the slave receives the jobId already with the heartbeats. The job is then exclusively assigned to this slave.
  • extended the metainfo for a slave by OperatingSystem and CpuArchitecture
  • enhanced the way plugin-dependencies are discovered by using the types used by XmlGenerator. Now only mimimum amount of plugins are transferred.
  • selection of waiting jobs now consideres assigned slave-group
  • more unit tests for service
  • added unit tests for experiment manager
File size: 3.0 KB
RevLine 
[4593]1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using HeuristicLab.Common;
24using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
25
[4615]26namespace HeuristicLab.Services.Hive.Common {
[4593]27  /// <summary>
28  /// The MessageContainer is a container class for Messages. Its two parts are:
29  /// the actual message itself and the JobId, refered by the message
30  /// </summary>
31  [StorableClass]
32  [Serializable]
[4905]33  public class MessageContainer : IDeepCloneable {
[4593]34
35    public enum MessageType {
[5078]36      // *** commands from hive server ***
[5404]37      CalculateJob, // slave should calculate a job. the job is already assigned to the slave
[5078]38      StopJob,   // slave should stop the job and submit results
39      AbortJob,  // slave should shut the job down immediately without submitting results
40      PauseJob,  // pause the job and submit the results
[5314]41      SoftPause,      // slave should stop all jobs, submit results and pause
42      HardPause,      // abort jobs and pause
43      Restart,        //restart operation after Soft/HardPause
[5078]44      ShutdownSlave,  // slave should shutdown immediately without submitting results
45      SayHello,  // Slave should say hello, because he is unknown to the server
[4615]46
[5078]47      // *** commands from execution engine ***
48      AddChildJob,     // adds a new child job for the provided jobId
49      GetChildJobs,    // return all child jobs of the provided jobId
50      DeleteChildJobs, // delete all child jobs of the provided jobId
[4593]51    };
52
53    [Storable]
54    public MessageType Message { get; set; }
55    [Storable]
56    public Guid JobId { get; set; }
57
[4796]58    protected MessageContainer() { }
[4593]59    public MessageContainer(MessageType message) {
60      Message = message;
61      JobId = Guid.Empty;
62    }
63    public MessageContainer(MessageType message, Guid jobId) {
64      Message = message;
65      JobId = jobId;
66    }
[4905]67    protected MessageContainer(MessageContainer original, Cloner cloner) {
68      cloner.RegisterClonedObject(original, this);
[4796]69      this.Message = original.Message;
70      this.JobId = original.JobId;
[4593]71    }
[4905]72    public virtual IDeepCloneable Clone(Cloner cloner) {
[4796]73      return new MessageContainer(this, cloner);
[4593]74    }
[4905]75    public object Clone() {
76      return Clone(new Cloner());
77    }
[4593]78  }
79}
Note: See TracBrowser for help on using the repository browser.