Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/BusinessObjects/JobDto.cs @ 5179

Last change on this file since 5179 was 5179, checked in by cneumuel, 13 years ago

#1260

  • migrated to .NET 4.0
  • moved state-information about heartbeat timestamps into DB to reduce IIS-recycling issues
  • optimized memory usage of ExperimentManager when lots of large jobs are downloaded
File size: 4.1 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 System.Collections.Generic;
24using System.Linq;
25using System.Runtime.Serialization;
26using HeuristicLab.Common;
27using HeuristicLab.DataAccess;
28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
29
30namespace HeuristicLab.Hive.Contracts.BusinessObjects {
31
32  [StorableClass]
33  [DataContract]
34  [Serializable]
35  public class JobDto : PersistableObject {
36    [Storable]
37    [DataMember]
38    public JobState State { get; set; }
39    [Storable]
40    [DataMember]
41    public Guid UserId { get; set; }
42    [Storable]
43    [DataMember]
44    public SlaveDto Slave { get; set; }
45    [Storable]
46    [DataMember]
47    public Guid? ParentJobId { get; set; }
48    [Storable]
49    [DataMember]
50    public TimeSpan ExecutionTime { get; set; }
51    [Storable]
52    [DataMember]
53    public String Exception { get; set; }
54    [Storable]
55    [DataMember]
56    public DateTime? DateCreated { get; set; }
57    [Storable]
58    [DataMember]
59    public DateTime? DateCalculated { get; set; }
60    [Storable]
61    [DataMember]
62    public DateTime? DateFinished { get; set; }
63    [Storable]
64    [DataMember]
65    public int Priority { get; set; }
66    [Storable]
67    [DataMember]
68    public int CoresNeeded { get; set; }
69    [Storable]
70    [DataMember]
71    public int MemoryNeeded { get; set; }
72    [Storable]
73    [DataMember]
74    public List<HivePluginInfoDto> PluginsNeeded { get; set; }
75    [Storable]
76    [DataMember]
77    public List<Guid> AssignedResourceIds { get; set; }
78    [Storable]
79    [DataMember]
80    public ProjectDto Project { get; set; }
81    [Storable]
82    [DataMember]
83    public DateTime? LastHeartbeat { get; set; }
84
85    public override string ToString() {
86      return base.ToString() + "State: " + State + ", [Ressource : " + Slave + " ] , DateCreated: " + DateCreated + ", DateCalculated: " + DateCalculated +
87        "Priority: " + Priority + ", CoresNeeded: " + CoresNeeded + "AssignedResources: " + AssignedResourceIds;
88    }
89
90    public JobDto() {
91      PluginsNeeded = new List<HivePluginInfoDto>();
92      AssignedResourceIds = new List<Guid>();
93    }
94    [StorableConstructor]
95    protected JobDto(bool deserializing) : base(deserializing) { }
96    protected JobDto(JobDto original, Cloner cloner)
97      : base(original, cloner) {
98      this.Id = original.Id;
99      this.AssignedResourceIds = new List<Guid>(original.AssignedResourceIds);
100      this.Slave = cloner.Clone(original.Slave);
101      this.CoresNeeded = original.CoresNeeded;
102      this.DateCalculated = original.DateCalculated;
103      this.DateCreated = original.DateCreated;
104      this.DateFinished = original.DateFinished;
105      this.Exception = original.Exception;
106      this.Id = original.Id;
107      this.MemoryNeeded = original.MemoryNeeded;
108      this.ParentJobId = original.ParentJobId;
109      this.ExecutionTime = original.ExecutionTime;
110      this.PluginsNeeded = (original.PluginsNeeded.Select(x => cloner.Clone(x))).ToList();
111      this.Priority = original.Priority;
112      this.Project = cloner.Clone(original.Project);
113      this.State = original.State;
114      this.UserId = original.UserId;
115      this.LastHeartbeat = original.LastHeartbeat;
116    }
117    public override IDeepCloneable Clone(Cloner cloner) {
118      return new JobDto(this, cloner);
119    }
120  }
121}
Note: See TracBrowser for help on using the repository browser.