Changeset 8971 for branches/RuntimeOptimizer/HeuristicLab.Services.Hive/3.3
- Timestamp:
- 11/29/12 09:57:15 (12 years ago)
- Location:
- branches/RuntimeOptimizer
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RuntimeOptimizer
- Property svn:mergeinfo changed
/branches/SlaveShutdown (added) merged: 8944-8945,8949,8951,8953-8954 /trunk/sources (added) merged: 8946-8948,8950,8952,8957,8960,8962-8970
- Property svn:mergeinfo changed
-
branches/RuntimeOptimizer/HeuristicLab.Services.Hive/3.3/Convert.cs
r7916 r8971 118 118 public static DT.Downtime ToDto(DB.Downtime source) { 119 119 if (source == null) return null; 120 return new DT.Downtime { Id = source.DowntimeId, AllDayEvent = source.AllDayEvent, EndDate = source.EndDate, Recurring = source.Recurring, RecurringId = source.RecurringId, ResourceId = source.ResourceId, StartDate = source.StartDate };120 return new DT.Downtime { Id = source.DowntimeId, AllDayEvent = source.AllDayEvent, EndDate = source.EndDate, Recurring = source.Recurring, RecurringId = source.RecurringId, ResourceId = source.ResourceId, StartDate = source.StartDate, DowntimeType = source.DowntimeType }; 121 121 } 122 122 public static DB.Downtime ToEntity(DT.Downtime source) { … … 127 127 public static void ToEntity(DT.Downtime source, DB.Downtime target) { 128 128 if ((source != null) && (target != null)) { 129 target.DowntimeId = source.Id; target.AllDayEvent = source.AllDayEvent; target.EndDate = source.EndDate; target.Recurring = source.Recurring; target.RecurringId = source.RecurringId; target.ResourceId = source.ResourceId; target.StartDate = source.StartDate; 129 target.DowntimeId = source.Id; target.AllDayEvent = source.AllDayEvent; target.EndDate = source.EndDate; target.Recurring = source.Recurring; target.RecurringId = source.RecurringId; target.ResourceId = source.ResourceId; target.StartDate = source.StartDate; target.DowntimeType = source.DowntimeType; 130 130 } 131 131 } -
branches/RuntimeOptimizer/HeuristicLab.Services.Hive/3.3/DataTransfer/Downtime.cs
r7259 r8971 22 22 using System; 23 23 using System.Runtime.Serialization; 24 using HeuristicLab.Services.Hive.DataAccess; 24 25 25 26 namespace HeuristicLab.Services.Hive.DataTransfer { … … 38 39 [DataMember] 39 40 public Guid ResourceId { get; set; } 41 [DataMember] 42 public DowntimeType DowntimeType { get; set; } 40 43 } 41 44 } -
branches/RuntimeOptimizer/HeuristicLab.Services.Hive/3.3/Manager/HeartbeatManager.cs
r7723 r8971 47 47 if (heartbeat.HbInterval != slave.HbInterval) { 48 48 actions.Add(new MessageContainer(MessageContainer.MessageType.NewHBInterval)); 49 } 50 if (ShutdownSlaveComputer(slave.Id)) { 51 actions.Add(new MessageContainer(MessageContainer.MessageType.ShutdownComputer)); 49 52 } 50 53 … … 147 150 private bool SlaveIsAllowedToCalculate(Guid slaveId) { 148 151 // the slave may only calculate if there is no downtime right now. this needs to be checked for every parent resource also 149 return dao.GetParentResources(slaveId).All(r => dao.GetDowntimes(x => x.ResourceId == r.Id && (DateTime.Now >= x.StartDate) && (DateTime.Now <= x.EndDate)).Count() == 0); 152 return dao.GetParentResources(slaveId).All(r => dao.GetDowntimes(x => x.ResourceId == r.Id && x.DowntimeType == DA.DowntimeType.Offline && (DateTime.Now >= x.StartDate) && (DateTime.Now <= x.EndDate)).Count() == 0); 153 } 154 155 private bool ShutdownSlaveComputer(Guid slaveId) { 156 return dao.GetParentResources(slaveId).Any(r => dao.GetDowntimes(x => x.ResourceId == r.Id && x.DowntimeType == DA.DowntimeType.Shutdown && (DateTime.Now >= x.StartDate) && (DateTime.Now <= x.EndDate)).Count() != 0); 150 157 } 151 158 } -
branches/RuntimeOptimizer/HeuristicLab.Services.Hive/3.3/MessageContainer.cs
r7259 r8971 48 48 ShutdownSlave, // slave should shutdown immediately without submitting results 49 49 SayHello, // Slave should say hello, because job is unknown to the server 50 NewHBInterval, 50 NewHBInterval, // change the polling to a new interval 51 ShutdownComputer, // shutdown the computer the slave runs on 51 52 }; 52 53
Note: See TracChangeset
for help on using the changeset viewer.