- Timestamp:
- 10/09/11 01:47:51 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Convert.cs
r6768 r6893 217 217 OperatingSystem = source.OperatingSystem, 218 218 LastHeartbeat = source.LastHeartbeat, 219 CpuUtilization = source.CpuUtilization 219 CpuUtilization = source.CpuUtilization, 220 HbInterval = source.HbInterval 220 221 }; 221 222 } … … 241 242 target.LastHeartbeat = source.LastHeartbeat; 242 243 target.CpuUtilization = source.CpuUtilization; 244 target.HbInterval = source.HbInterval; 243 245 } 244 246 } … … 248 250 public static DT.SlaveGroup ToDto(DB.SlaveGroup source) { 249 251 if (source == null) return null; 250 return new DT.SlaveGroup { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId };252 return new DT.SlaveGroup { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId, HbInterval = source.HbInterval }; 251 253 } 252 254 public static DB.SlaveGroup ToEntity(DT.SlaveGroup source) { … … 257 259 public static void ToEntity(DT.SlaveGroup source, DB.SlaveGroup target) { 258 260 if ((source != null) && (target != null)) { 259 target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; 261 target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; target.HbInterval = source.HbInterval; 260 262 } 261 263 } … … 265 267 public static DT.Resource ToDto(DB.Resource source) { 266 268 if (source == null) return null; 267 return new DT.Resource { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId };269 return new DT.Resource { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId, HbInterval = source.HbInterval }; 268 270 } 269 271 public static DB.Resource ToEntity(DT.Resource source) { … … 274 276 public static void ToEntity(DT.Resource source, DB.Resource target) { 275 277 if ((source != null) && (target != null)) { 276 target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; 278 target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; target.HbInterval = source.HbInterval; 277 279 } 278 280 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/DataTransfer/Heartbeat.cs
r6743 r6893 40 40 [DataMember] 41 41 public float CpuUtilization { get; set; } 42 [DataMember] 43 public int HbInterval { get; set; } 42 44 43 45 public override string ToString() { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/DataTransfer/Resource.cs
r6717 r6893 30 30 public Guid? ParentResourceId { get; set; } 31 31 32 [DataMember] 33 public int HbInterval { get; set; } 34 32 35 public Resource() { } 33 36 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/HiveService.cs
r6764 r6893 446 446 447 447 #region Slave Methods 448 public int GetNewHeartbeatInterval(Guid slaveId) { 449 authen.AuthenticateForAnyRole(HiveRoles.Slave); 450 Slave s = dao.GetSlave(slaveId); 451 if (s != null) { 452 return s.HbInterval; 453 } else { 454 return -1; 455 } 456 } 457 448 458 public Guid AddSlave(Slave slave) { 449 459 authen.AuthenticateForAnyRole(HiveRoles.Administrator); … … 486 496 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 487 497 trans.UseTransaction(() => { 488 dao.UpdateSlaveGroup(slaveGroup); 489 }); 498 UpdateSlaveHBs(slaveGroup); 499 }); 500 } 501 502 private void UpdateSlaveHBs(Resource r) { 503 foreach (Resource resource in dao.GetChildResources(r.Id)) { 504 if (resource is SlaveGroup) { 505 resource.HbInterval = r.HbInterval; 506 dao.UpdateSlaveGroup(resource as SlaveGroup); 507 UpdateSlaveHBs(resource); 508 } else if (resource is Slave) { 509 resource.HbInterval = r.HbInterval; 510 dao.UpdateSlave(resource as Slave); 511 } 512 } 490 513 } 491 514 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Manager/HeartbeatManager.cs
r6764 r6893 45 45 actions.Add(new MessageContainer(MessageContainer.MessageType.SayHello)); 46 46 } else { 47 Slave s = dao.GetSlave(heartbeat.SlaveId); 48 if (s != null) { 49 if (heartbeat.HbInterval != s.HbInterval) { 50 actions.Add(new MessageContainer(MessageContainer.MessageType.NewHBInterval)); 51 } 52 } 53 47 54 // update slave data 48 55 slave.FreeCores = heartbeat.FreeCores; -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/MessageContainer.cs
r6743 r6893 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 51 }; 51 52 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/ServiceContracts/IHiveService.cs
r6743 r6893 203 203 [OperationContract] 204 204 void TriggerEventManager(bool force); 205 206 [OperationContract] 207 int GetNewHeartbeatInterval(Guid slaveId); 205 208 #endregion 206 209
Note: See TracChangeset
for help on using the changeset viewer.