Changeset 5511 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer
- Timestamp:
- 02/17/11 14:47:56 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/HiveExperiment.cs
r5458 r5511 29 29 public class HiveExperiment : NamedHiveItem { 30 30 [DataMember] 31 public Guid UserId { get; set; }31 public Guid OwnerUserId { get; set; } 32 32 [DataMember] 33 33 public Guid RootJobId { get; set; } … … 36 36 [DataMember] 37 37 public string ResourceNames { get; set; } 38 [DataMember] 39 public DateTime? LastAccessed { get; set; } 38 40 39 41 public HiveExperiment() { } 40 42 protected HiveExperiment(HiveExperiment original, Cloner cloner) : base(original, cloner) { 41 43 this.RootJobId = original.RootJobId; 42 this. UserId = original.UserId;44 this.OwnerUserId = original.OwnerUserId; 43 45 this.DateCreated = original.DateCreated; 44 46 this.ResourceNames = original.ResourceNames; 47 this.LastAccessed = original.LastAccessed; 45 48 } 46 49 public override IDeepCloneable Clone(Cloner cloner) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/Job.cs
r5405 r5511 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq;25 24 using System.Runtime.Serialization; 26 25 using HeuristicLab.Common; … … 30 29 [Serializable] 31 30 public class Job : LightweightJob { 32 [DataMember]33 public Guid UserId { get; set; }34 31 [DataMember] 35 32 public int Priority { get; set; } … … 42 39 [DataMember] 43 40 public DateTime? LastHeartbeat { get; set; } 44 41 45 42 public Job() { 46 43 this.PluginsNeededIds = new List<Guid>(); 47 44 } 48 45 protected Job(Job original, Cloner cloner) : base(original, cloner) { 49 this.UserId = original.UserId;50 46 this.Priority = original.Priority; 51 47 this.CoresNeeded = original.CoresNeeded; … … 59 55 60 56 public override string ToString() { 61 return string.Format("State: {0}, SlaveId: {1}, DateCreated: {2}, DateCalculated: {3}, CoresNeeded: {4}, MemoryNeeded: {5}", JobState, SlaveId, DateCreated, DateCalculated, CoresNeeded, MemoryNeeded);57 return string.Format("State: {0}, SlaveId: {1}, DateCreated: {2}, DateCalculated: {3}, CoresNeeded: {4}, MemoryNeeded: {5}", State, CurrentStateLog.SlaveId, DateCreated, CoresNeeded, MemoryNeeded); 62 58 } 63 59 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/JobState.cs
r4649 r5511 33 33 Waiting, 34 34 35 /// <summary> 35 /// <summary> 36 /// The job is set to Finished when all child jobs are Finished. 37 /// </summary> 38 FinishOnChildJobsFinished, 39 40 /// <summary> 36 41 /// The job is paused and waits on the server to be sent back to a Slave when all of its child jobs are Finished. 37 42 /// </summary> 38 WaitingForChildJobs, 43 ResumeOnChildJobsFinished, 44 45 /// <summary> 46 /// Job is beeing transferred 47 /// </summary> 48 Transferring, 39 49 40 50 /// <summary> … … 72 82 public static bool IsWaiting(this JobState jobState) { 73 83 return jobState == JobState.Waiting || 74 jobState == JobState. WaitingForChildJobs;84 jobState == JobState.FinishOnChildJobsFinished; 75 85 } 76 86 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/LightweightJob.cs
r5106 r5511 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 23 25 using System.Runtime.Serialization; 24 26 using HeuristicLab.Common; … … 29 31 public class LightweightJob : HiveItem { 30 32 [DataMember] 31 public Guid? SlaveId { get; set; }32 [DataMember]33 public JobState JobState { get; set; }34 [DataMember]35 33 public TimeSpan? ExecutionTime { get; set; } 36 34 [DataMember] 37 public String Exception{ get; set; }35 public Guid? ParentJobId { get; set; } 38 36 [DataMember] 39 public DateTime DateCreated{ get; set; }37 public List<StateLog> StateLog { get; set; } 40 38 [DataMember] 41 public DateTime? DateCalculated{ get; set; }42 [DataMember] 43 public DateTime? DateFinished { get; set;}44 [DataMember]45 public Guid? ParentJobId { get; set;}39 public JobState State { get; set; } 40 41 public StateLog CurrentStateLog { get { return StateLog.Last(); } } 42 public DateTime DateCreated { get { return StateLog.First().DateTime; } } 43 public DateTime? DateFinished { get { return CurrentStateLog.State == JobState.Finished ? new DateTime?(CurrentStateLog.DateTime) : null; } } 46 44 47 45 public LightweightJob() { 48 JobState = DataTransfer.JobState.Offline;46 StateLog = new List<DataTransfer.StateLog>(); 49 47 } 48 50 49 public LightweightJob(Job job) { 51 this.SlaveId = job.SlaveId;52 this.JobState = job.JobState;53 50 this.ExecutionTime = job.ExecutionTime; 54 this.Exception = job.Exception;55 this.DateCreated = job.DateCreated;56 this.DateCalculated = job.DateCalculated;57 this.DateFinished = job.DateFinished;58 51 this.ParentJobId = job.ParentJobId; 52 this.StateLog = new List<StateLog>(); 59 53 } 60 protected LightweightJob(LightweightJob original, Cloner cloner) : base(original, cloner) { 61 this.SlaveId = original.SlaveId; 62 this.JobState = original.JobState; 54 protected LightweightJob(LightweightJob original, Cloner cloner) 55 : base(original, cloner) { 63 56 this.ExecutionTime = original.ExecutionTime; 64 this.Exception = original.Exception;65 this.DateCreated = original.DateCreated;66 this.DateCalculated = original.DateCalculated;67 this.DateFinished = original.DateFinished;68 57 this.ParentJobId = original.ParentJobId; 58 this.StateLog = new List<StateLog>(original.StateLog); 69 59 } 70 60 public override IDeepCloneable Clone(Cloner cloner) { 71 61 return new LightweightJob(this, cloner); 72 62 } 63 64 public void SetState(JobState state) { 65 this.State = state; 66 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now }); 67 } 68 69 public void SetState(JobState state, Guid userId) { 70 this.State = state; 71 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now, UserId = userId }); 72 } 73 74 public void SetState(JobState state, Guid slaveId, string exception) { 75 this.State = state; 76 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now, SlaveId = slaveId, Exception = exception }); 77 } 73 78 } 74 79 }
Note: See TracChangeset
for help on using the changeset viewer.