Changeset 5718 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients
- Timestamp:
- 03/16/11 17:02:15 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveItem.cs
r5676 r5718 30 30 public partial class HiveItem : IItem { 31 31 32 public HiveItem() { 33 } 34 32 public HiveItem() { } 35 33 36 34 protected HiveItem(HiveItem original, Cloner cloner) { 35 cloner.RegisterClonedObject(original, this); 37 36 this.Id = original.Id; 38 37 } 39 38 40 public IDeepCloneable Clone(Cloner cloner) {39 public virtual IDeepCloneable Clone(Cloner cloner) { 41 40 return new HiveItem(this, cloner); 42 41 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/Job.cs
r5614 r5718 30 30 public Job() { } 31 31 32 public void SetState(JobState state) {33 this.State = state;34 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now });35 }36 37 public void SetState(JobState state, Guid userId) {38 this.State = state;39 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now, UserId = userId });40 }41 42 public void SetState(JobState state, Guid slaveId, string exception) {43 this.State = state;44 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now, SlaveId = slaveId, Exception = exception });45 }46 47 32 protected Job(Job original, Cloner cloner) { 48 33 this.Priority = original.Priority; … … 60 45 } 61 46 62 public IDeepCloneable Clone(Cloner cloner) {47 public override IDeepCloneable Clone(Cloner cloner) { 63 48 return new Job(this, cloner); 64 49 } 65 50 66 public object Clone() {67 return Clone(new Cloner());68 }69 70 51 public override string ToString() { 71 return string.Format("State: {0}, SlaveId: {1}, DateCreated: {2}, DateCalculated: {3}, CoresNeeded: {4}, MemoryNeeded: {5}", State, CurrentStateLog.SlaveId, DateCreated , CoresNeeded, MemoryNeeded);52 return string.Format("State: {0}, SlaveId: {1}, DateCreated: {2}, DateCalculated: {3}, CoresNeeded: {4}, MemoryNeeded: {5}", State, CurrentStateLog.SlaveId, DateCreated.HasValue ? DateCreated.ToString() : "-", CoresNeeded, MemoryNeeded); 72 53 } 73 54 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/LightweightJob.cs
r5614 r5718 28 28 29 29 public partial class LightweightJob : IDeepCloneable, IContent { 30 public StateLog CurrentStateLog { get { return StateLog.LastOrDefault(); } } 31 public DateTime? DateCreated { get { return StateLog.Count > 0 ? new DateTime?(StateLog.First().DateTime) : null; } } 32 public DateTime? DateFinished { get { return (StateLog.Count > 0 && CurrentStateLog.State == JobState.Finished) ? new DateTime?(CurrentStateLog.DateTime) : null; } } 30 33 31 34 public LightweightJob() { … … 48 51 this.Id = original.Id; 49 52 } 50 public IDeepCloneable Clone(Cloner cloner) {53 public override IDeepCloneable Clone(Cloner cloner) { 51 54 return new LightweightJob(this, cloner); 52 }53 54 public object Clone() {55 return Clone(new Cloner());56 }57 58 public StateLog CurrentStateLog { get { return StateLog.Last(); } }59 public DateTime DateCreated { get { return StateLog.First().DateTime; } }60 public DateTime? DateFinished { get { return CurrentStateLog.State == JobState.Finished ? new DateTime?(CurrentStateLog.DateTime) : null; } }61 62 public void SetState(JobState state) {63 this.State = state;64 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now });65 }66 67 public void SetState(JobState state, Guid userId) {68 this.State = state;69 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now, UserId = userId });70 }71 72 public void SetState(JobState state, Guid slaveId, string exception) {73 this.State = state;74 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now, SlaveId = slaveId, Exception = exception });75 55 } 76 56 }
Note: See TracChangeset
for help on using the changeset viewer.