Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 5299 was 5137, checked in by ascheibe, 14 years ago

#1233

  • more tests for the hive slave
  • implemented a better way to write tests for the slave
  • get rid of MessageTypes for core and executor
  • various improvements in core and executor (better communication, bugfixes,...)
File size: 2.9 KB
Line 
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
26namespace HeuristicLab.Services.Hive.Common {
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]
33  public class MessageContainer : IDeepCloneable {
34
35    public enum MessageType {
36      // *** commands from hive server ***
37      AquireJob, // slave should aquire a new job (formerly FetchJob)
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
41      StopSlave,      // slave should stop all jobs, submit results and shut itself down
42      ShutdownSlave,  // slave should shutdown immediately without submitting results
43      SayHello,  // Slave should say hello, because he is unknown to the server
44
45      // *** commands from execution engine ***
46      AddChildJob,     // adds a new child job for the provided jobId
47      GetChildJobs,    // return all child jobs of the provided jobId
48      DeleteChildJobs, // delete all child jobs of the provided jobId
49    };
50
51    [Storable]
52    public MessageType Message { get; set; }
53    [Storable]
54    public Guid JobId { get; set; }
55
56    protected MessageContainer() { }
57    public MessageContainer(MessageType message) {
58      Message = message;
59      JobId = Guid.Empty;
60    }
61    public MessageContainer(MessageType message, Guid jobId) {
62      Message = message;
63      JobId = jobId;
64    }
65    protected MessageContainer(MessageContainer original, Cloner cloner) {
66      cloner.RegisterClonedObject(original, this);
67      this.Message = original.Message;
68      this.JobId = original.JobId;
69    }
70    public virtual IDeepCloneable Clone(Cloner cloner) {
71      return new MessageContainer(this, cloner);
72    }
73    public object Clone() {
74      return Clone(new Cloner());
75    }
76  }
77}
Note: See TracBrowser for help on using the repository browser.