Changeset 7723


Ignore:
Timestamp:
04/12/12 11:23:37 (7 years ago)
Author:
ascheibe
Message:

#1722 minor improvement of the messages the hive server logs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Services.Hive/3.3/Manager/HeartbeatManager.cs

    r7259 r7723  
    4444      if (slave == null) {
    4545        actions.Add(new MessageContainer(MessageContainer.MessageType.SayHello));
    46       } else {       
     46      } else {
    4747        if (heartbeat.HbInterval != slave.HbInterval) {
    4848          actions.Add(new MessageContainer(MessageContainer.MessageType.NewHBInterval));
    4949        }
    50        
     50
    5151        // update slave data
    5252        slave.FreeCores = heartbeat.FreeCores;
     
    102102        // process the jobProgresses
    103103        foreach (var jobProgress in heartbeat.JobProgress) {
    104           Task curJob = dao.GetTask(jobProgress.Key);
    105           if (curJob == null) {
     104          Task curTask = dao.GetTask(jobProgress.Key);
     105          if (curTask == null) {
    106106            // task does not exist in db
    107107            actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, jobProgress.Key));
    108             DA.LogFactory.GetLogger(this.GetType().Namespace).Log("Job does 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);
    109109          } else {
    110             if (curJob.CurrentStateLog.SlaveId == Guid.Empty || curJob.CurrentStateLog.SlaveId != heartbeat.SlaveId) {
     110            if (curTask.CurrentStateLog.SlaveId == Guid.Empty || curTask.CurrentStateLog.SlaveId != heartbeat.SlaveId) {
    111111              // assigned slave does not match heartbeat
    112               actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, curJob.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, curJob)) {
     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)) {
    115115              // 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, curJob.Id));
     116              actions.Add(new MessageContainer(MessageContainer.MessageType.PauseTask, curTask.Id));
    117117            } else {
    118118              // save task execution time
    119               curJob.ExecutionTime = jobProgress.Value;
    120               curJob.LastHeartbeat = DateTime.Now;
     119              curTask.ExecutionTime = jobProgress.Value;
     120              curTask.LastHeartbeat = DateTime.Now;
    121121
    122               switch (curJob.Command) {
     122              switch (curTask.Command) {
    123123                case Command.Stop:
    124                   actions.Add(new MessageContainer(MessageContainer.MessageType.StopTask, curJob.Id));
     124                  actions.Add(new MessageContainer(MessageContainer.MessageType.StopTask, curTask.Id));
    125125                  break;
    126126                case Command.Pause:
    127                   actions.Add(new MessageContainer(MessageContainer.MessageType.PauseTask, curJob.Id));
     127                  actions.Add(new MessageContainer(MessageContainer.MessageType.PauseTask, curTask.Id));
    128128                  break;
    129129                case Command.Abort:
    130                   actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, curJob.Id));
     130                  actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, curTask.Id));
    131131                  break;
    132132              }
    133               dao.UpdateTask(curJob);
     133              dao.UpdateTask(curTask);
    134134            }
    135135          }
Note: See TracChangeset for help on using the changeset viewer.