- Timestamp:
- 05/16/12 16:28:49 (13 years ago)
- Location:
- branches/HeuristicLab.TimeSeries
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.TimeSeries
- Property svn:mergeinfo changed
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Services.Hive/3.3/Manager/HeartbeatManager.cs
r7268 r7842 44 44 if (slave == null) { 45 45 actions.Add(new MessageContainer(MessageContainer.MessageType.SayHello)); 46 } else { 46 } else { 47 47 if (heartbeat.HbInterval != slave.HbInterval) { 48 48 actions.Add(new MessageContainer(MessageContainer.MessageType.NewHBInterval)); 49 49 } 50 50 51 51 // update slave data 52 52 slave.FreeCores = heartbeat.FreeCores; … … 102 102 // process the jobProgresses 103 103 foreach (var jobProgress in heartbeat.JobProgress) { 104 Task cur Job= dao.GetTask(jobProgress.Key);105 if (cur Job== null) {104 Task curTask = dao.GetTask(jobProgress.Key); 105 if (curTask == null) { 106 106 // task does not exist in db 107 107 actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, jobProgress.Key)); 108 DA.LogFactory.GetLogger(this.GetType().Namespace).Log(" Jobdoes not exist in DB: " + jobProgress.Key);108 DA.LogFactory.GetLogger(this.GetType().Namespace).Log("Task on slave " + heartbeat.SlaveId + " does not exist in DB: " + jobProgress.Key); 109 109 } else { 110 if (cur Job.CurrentStateLog.SlaveId == Guid.Empty || curJob.CurrentStateLog.SlaveId != heartbeat.SlaveId) {110 if (curTask.CurrentStateLog.SlaveId == Guid.Empty || curTask.CurrentStateLog.SlaveId != heartbeat.SlaveId) { 111 111 // assigned slave does not match heartbeat 112 actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, cur Job.Id));113 DA.LogFactory.GetLogger(this.GetType().Namespace).Log("The slave " + heartbeat.SlaveId + " is not supposed to calculate Job: " + curJob);114 } else if (!TaskIsAllowedToBeCalculatedBySlave(heartbeat.SlaveId, cur Job)) {112 actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, curTask.Id)); 113 DA.LogFactory.GetLogger(this.GetType().Namespace).Log("The slave " + heartbeat.SlaveId + " is not supposed to calculate task: " + curTask); 114 } else if (!TaskIsAllowedToBeCalculatedBySlave(heartbeat.SlaveId, curTask)) { 115 115 // assigned resources ids of task do not match with slaveId (and parent resourceGroupIds); this might happen when slave is moved to different group 116 actions.Add(new MessageContainer(MessageContainer.MessageType.PauseTask, cur Job.Id));116 actions.Add(new MessageContainer(MessageContainer.MessageType.PauseTask, curTask.Id)); 117 117 } else { 118 118 // save task execution time 119 cur Job.ExecutionTime = jobProgress.Value;120 cur Job.LastHeartbeat = DateTime.Now;119 curTask.ExecutionTime = jobProgress.Value; 120 curTask.LastHeartbeat = DateTime.Now; 121 121 122 switch (cur Job.Command) {122 switch (curTask.Command) { 123 123 case Command.Stop: 124 actions.Add(new MessageContainer(MessageContainer.MessageType.StopTask, cur Job.Id));124 actions.Add(new MessageContainer(MessageContainer.MessageType.StopTask, curTask.Id)); 125 125 break; 126 126 case Command.Pause: 127 actions.Add(new MessageContainer(MessageContainer.MessageType.PauseTask, cur Job.Id));127 actions.Add(new MessageContainer(MessageContainer.MessageType.PauseTask, curTask.Id)); 128 128 break; 129 129 case Command.Abort: 130 actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, cur Job.Id));130 actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, curTask.Id)); 131 131 break; 132 132 } 133 dao.UpdateTask(cur Job);133 dao.UpdateTask(curTask); 134 134 } 135 135 }
Note: See TracChangeset
for help on using the changeset viewer.