Changeset 15121


Ignore:
Timestamp:
07/05/17 14:03:03 (3 months ago)
Author:
jkarder
Message:

#2784: fixed pausing of waiting hive tasks

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive.Views/3.3/HiveTasks/OptimizerHiveTaskView.cs

    r14901 r15121  
    119119      base.SetEnabledStateOfControls();
    120120
    121       this.startButton.Enabled = Content != null && Content.IsControllable && !Content.Task.Command.HasValue && (Content.Task.State == TaskState.Paused || Content.Task.State == TaskState.Failed || Content.Task.State == TaskState.Aborted);
     121      this.startButton.Enabled = Content != null && Content.IsControllable && !Content.Task.Command.HasValue && (Content.Task.State == TaskState.Paused);
    122122      this.pauseButton.Enabled = Content != null && Content.IsControllable && !Content.Task.Command.HasValue && Content.Task.State == TaskState.Calculating;
    123123      this.stopButton.Enabled = Content != null && Content.IsControllable && !Content.Task.Command.HasValue && (Content.Task.State == TaskState.Calculating || Content.Task.State == TaskState.Waiting || Content.Task.State == TaskState.Paused);
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveTasks/OptimizerHiveTask.cs

    r14185 r15121  
    316316    public override void AddChildHiveTask(HiveTask hiveTask) {
    317317      base.AddChildHiveTask(hiveTask);
    318       var optimizerHiveJob = (OptimizerHiveTask)hiveTask;
     318      var optimizerHiveTask = (OptimizerHiveTask)hiveTask;
    319319      syncTasksWithOptimizers = false;
    320       if (this.ItemTask != null && optimizerHiveJob.ItemTask != null) {
    321         // if task is in state Paused, it has to preserve its ResultCollection, which is cleared when a optimizer is added to an experiment
    322         OptimizerTask optimizerJobClone = null;
    323         if (optimizerHiveJob.Task.State == TaskState.Paused) {
    324           optimizerJobClone = (OptimizerTask)optimizerHiveJob.ItemTask.Clone();
    325         }
     320      if (this.ItemTask != null && optimizerHiveTask.ItemTask != null) {
     321        OptimizerTask optimizerTaskClone = (OptimizerTask)optimizerHiveTask.ItemTask.Clone();
    326322
    327323        if (this.ItemTask.Item is Optimization.Experiment) {
    328           if (!this.ItemTask.OptimizerAsExperiment.Optimizers.Contains(optimizerHiveJob.ItemTask.Item)) {
    329             UpdateOptimizerInExperiment(this.ItemTask.OptimizerAsExperiment, optimizerHiveJob.ItemTask);
     324          if (!this.ItemTask.OptimizerAsExperiment.Optimizers.Contains(optimizerHiveTask.ItemTask.Item)) {
     325            UpdateOptimizerInExperiment(this.ItemTask.OptimizerAsExperiment, optimizerHiveTask.ItemTask);
    330326          }
    331327        } else if (this.ItemTask.Item is Optimization.BatchRun) {
    332           UpdateOptimizerInBatchRun(this.ItemTask.OptimizerAsBatchRun, optimizerHiveJob.ItemTask);
    333         }
    334 
    335         if (optimizerHiveJob.Task.State == TaskState.Paused) {
    336           optimizerHiveJob.ItemTask = optimizerJobClone;
    337         }
     328          UpdateOptimizerInBatchRun(this.ItemTask.OptimizerAsBatchRun, optimizerHiveTask.ItemTask);
     329        }
     330
     331        optimizerHiveTask.syncTasksWithOptimizers = false;
     332        optimizerHiveTask.ItemTask = optimizerTaskClone;
     333        optimizerHiveTask.syncTasksWithOptimizers = true;
    338334      }
    339335      syncTasksWithOptimizers = true;
  • trunk/sources/HeuristicLab.Services.Hive/3.3/HiveService.cs

    r14901 r15121  
    263263          if (task.State == DA.TaskState.Calculating || task.State == DA.TaskState.Transferring) {
    264264            task.Command = DA.Command.Pause;
    265           } else if (task.State != DA.TaskState.Aborted
     265          } else if (task.State != DA.TaskState.Paused
     266                     && task.State != DA.TaskState.Aborted
    266267                     && task.State != DA.TaskState.Finished
    267268                     && task.State != DA.TaskState.Failed) {
     
    966967      var taskStateEntity = taskState.ToEntity();
    967968
    968       if (taskStateEntity == DA.TaskState.Paused && task.Command == null) {
     969      if (task.State == DA.TaskState.Calculating && taskStateEntity == DA.TaskState.Paused && task.Command == null) {
    969970        // slave paused and uploaded the task (no user-command) -> set waiting.
    970971        taskStateEntity = DA.TaskState.Waiting;
Note: See TracChangeset for help on using the changeset viewer.