Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15641 for branches


Ignore:
Timestamp:
01/23/18 13:51:46 (7 years ago)
Author:
jzenisek
Message:

#2839 finished implementation of job deletion routine

Location:
branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/HiveStatisticsGenerator.cs

    r14185 r15641  
    7272          });
    7373        }
     74
     75        pm.UseTransaction(() => {
     76          FlagJobsForDeletion(pm);
     77          pm.SubmitChanges();
     78        });
    7479      }
    7580    }
     
    162167        dimJob.TotalTasks = totalTasks;
    163168        dimJob.CompletedTasks = completedTasks;
     169      }
     170    }
     171
     172    private void FlagJobsForDeletion(PersistenceManager pm) {
     173      var jobDao = pm.JobDao;
     174      var jobs = jobDao.GetJobsReadyForDeletion();
     175      foreach(var job in jobs) {
     176        job.State = JobState.DeletionPending;
    164177      }
    165178    }
     
    267280
    268281      var factTaskIds = factTaskDao.GetAll().Select(x => x.TaskId);
    269       var notFinishedFactTasks = factTaskDao.GetNotFinishedTasks().Select(x => new {
    270         x.TaskId,
    271         x.LastClientId
    272       });
    273 
    274       var newTasks =
     282      var notFinishedFactTasks = factTaskDao.GetNotFinishedTasks();
     283      //var notFinishedFactTasks = factTaskDao.GetNotFinishedTasks().Select(x => new {
     284      //  x.TaskId,
     285      //  x.LastClientId
     286      //});
     287
     288      // query several properties for all new and not finished tasks
     289      // in order to use them later eitheir
     290      // (1) to update the fact task entry of not finished tasks
     291      // (2) to insert a new fact task entry for new tasks
     292      var newAndNotFinishedTasks =
    275293        (from task in taskDao.GetAllChildTasks()
    276294         let stateLogs = task.StateLogs.OrderByDescending(x => x.DateTime)
     
    296314         }).ToList();
    297315
    298       //insert facts for new tasks
     316      // (1) update data of already existing facts
     317      // i.e. for all in newAndNotFinishedTasks where NotFinishedTask = true
     318      foreach (var notFinishedFactTask in notFinishedFactTasks) {
     319        var nfftUpdate = newAndNotFinishedTasks.Where(x => x.TaskId == notFinishedFactTask.TaskId).SingleOrDefault();
     320        if(nfftUpdate != null) {
     321          var taskData = CalculateFactTaskData(nfftUpdate.StateLogs);
     322
     323          notFinishedFactTask.StartTime = taskData.StartTime;
     324          notFinishedFactTask.EndTime = taskData.EndTime;
     325          notFinishedFactTask.LastClientId = nfftUpdate.LastClientId;
     326          notFinishedFactTask.Priority = nfftUpdate.Priority;
     327          notFinishedFactTask.CoresRequired = nfftUpdate.CoresRequired;
     328          notFinishedFactTask.MemoryRequired = nfftUpdate.MemoryRequired;
     329          notFinishedFactTask.NumCalculationRuns = taskData.CalculationRuns;
     330          notFinishedFactTask.NumRetries = taskData.Retries;
     331          notFinishedFactTask.WaitingTime = taskData.WaitingTime;
     332          notFinishedFactTask.CalculatingTime = taskData.CalculatingTime;
     333          notFinishedFactTask.TransferTime = taskData.TransferTime;
     334          notFinishedFactTask.TaskState = nfftUpdate.State;
     335          notFinishedFactTask.Exception = taskData.Exception;
     336          notFinishedFactTask.InitialWaitingTime = taskData.InitialWaitingTime;
     337        }
     338      }
     339
     340      // (2) insert facts for new tasks
     341      // i.e. for all in newAndNotFinishedTasks where NotFinishedTask = false
    299342      factTaskDao.Save(
    300         from x in newTasks
     343        from x in newAndNotFinishedTasks
    301344        where !x.NotFinishedTask
    302345        let taskData = CalculateFactTaskData(x.StateLogs)
     
    320363        });
    321364
    322       //update data of already existing facts
    323       foreach (var notFinishedTask in factTaskDao.GetNotFinishedTasks()) {
    324         var ntc = newTasks.Where(x => x.TaskId == notFinishedTask.TaskId);
    325         if (ntc.Any()) {
    326           var x = ntc.Single();
    327           var taskData = CalculateFactTaskData(x.StateLogs);
    328 
    329           notFinishedTask.StartTime = taskData.StartTime;
    330           notFinishedTask.EndTime = taskData.EndTime;
    331           notFinishedTask.LastClientId = x.LastClientId;
    332           notFinishedTask.Priority = x.Priority;
    333           notFinishedTask.CoresRequired = x.CoresRequired;
    334           notFinishedTask.MemoryRequired = x.MemoryRequired;
    335           notFinishedTask.NumCalculationRuns = taskData.CalculationRuns;
    336           notFinishedTask.NumRetries = taskData.Retries;
    337           notFinishedTask.WaitingTime = taskData.WaitingTime;
    338           notFinishedTask.CalculatingTime = taskData.CalculatingTime;
    339           notFinishedTask.TransferTime = taskData.TransferTime;
    340           notFinishedTask.TaskState = x.State;
    341           notFinishedTask.Exception = taskData.Exception;
    342           notFinishedTask.InitialWaitingTime = taskData.InitialWaitingTime;
    343         }
    344       }
     365
     366      ////update data of already existing facts
     367      //foreach (var notFinishedTask in factTaskDao.GetNotFinishedTasks()) {
     368      //  var ntc = newTasks.Where(x => x.TaskId == notFinishedTask.TaskId);
     369      //  if (ntc.Any()) {
     370      //    var x = ntc.Single();
     371      //    var taskData = CalculateFactTaskData(x.StateLogs);
     372
     373      //    notFinishedTask.StartTime = taskData.StartTime;
     374      //    notFinishedTask.EndTime = taskData.EndTime;
     375      //    notFinishedTask.LastClientId = x.LastClientId;
     376      //    notFinishedTask.Priority = x.Priority;
     377      //    notFinishedTask.CoresRequired = x.CoresRequired;
     378      //    notFinishedTask.MemoryRequired = x.MemoryRequired;
     379      //    notFinishedTask.NumCalculationRuns = taskData.CalculationRuns;
     380      //    notFinishedTask.NumRetries = taskData.Retries;
     381      //    notFinishedTask.WaitingTime = taskData.WaitingTime;
     382      //    notFinishedTask.CalculatingTime = taskData.CalculatingTime;
     383      //    notFinishedTask.TransferTime = taskData.TransferTime;
     384      //    notFinishedTask.TaskState = x.State;
     385      //    notFinishedTask.Exception = taskData.Exception;
     386      //    notFinishedTask.InitialWaitingTime = taskData.InitialWaitingTime;
     387      //  }
     388      //}
    345389    }
    346390
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/Manager/HeartbeatManager.cs

    r15630 r15641  
    190190          // assigned resources ids of task do not match with slaveId (and parent resourceGroupIds); this might happen when slave is moved to different group
    191191          actions.Add(new MessageContainer(MessageContainer.MessageType.PauseTask, curTask.TaskId));
    192           LogFactory.GetLogger(this.GetType().Namespace).Log("The slave " + heartbeat.SlaveId + " is not granted to calculate task: " + curTask.TaskId);
     192          LogFactory.GetLogger(this.GetType().Namespace).Log("The slave " + heartbeat.SlaveId + " is not granted to calculate task: " + curTask.TaskId + " of job: " + curTask.JobId);
    193193        } else {
    194194          // update task execution time
Note: See TracChangeset for help on using the changeset viewer.