Changeset 7177


Ignore:
Timestamp:
12/12/11 16:25:17 (10 years ago)
Author:
ascheibe
Message:

#1672 fixed setting of priorities in the Job Manager

Location:
trunk/sources
Files:
4 edited

Legend:

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

    r6976 r7177  
    9393          this.jobIdTextBox.Text = Content.Task.Id.ToString();
    9494          this.dateCreatedTextBox.Text = Content.Task.DateCreated.HasValue ? Content.Task.DateCreated.ToString() : string.Empty;
    95           this.priorityComboBox.Text = Content.Task.Priority.ToString();
     95          if (Content.Task.Priority >= 0 && Content.Task.Priority < priorityComboBox.Items.Count) {
     96            this.priorityComboBox.SelectedIndex = Content.Task.Priority;
     97          } else {
     98            this.priorityComboBox.SelectedIndex = 0;
     99          }
    96100          this.coresNeededComboBox.Text = Content.Task.CoresNeeded.ToString();
    97101          this.memoryNeededComboBox.Text = Content.Task.MemoryNeeded.ToString();
     
    99103          this.jobIdTextBox.Text = string.Empty;
    100104          this.dateCreatedTextBox.Text = string.Empty;
    101           this.priorityComboBox.Text = "3";
     105          this.priorityComboBox.SelectedIndex = 0;
    102106          this.coresNeededComboBox.Text = "1";
    103107          this.memoryNeededComboBox.Text = "256";
     
    201205      this.modifyItemButton.Enabled = (Content != null && Content.ItemTask.Item != null && (Content.Task.State == TaskState.Paused || Content.Task.State == TaskState.Offline || Content.Task.State == TaskState.Finished || Content.Task.State == TaskState.Failed || Content.Task.State == TaskState.Aborted));
    202206    }
     207
     208    private void priorityComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     209      if (Content.Task.Priority != priorityComboBox.SelectedIndex) {
     210        Content.Task.Priority = priorityComboBox.SelectedIndex;
     211      }
     212    }
    203213  }
    204214}
  • trunk/sources/HeuristicLab.Clients.Hive.Views/3.3/HiveTasks/HiveTaskView.designer.cs

    r7104 r7177  
    170170      this.priorityComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    171171                  | System.Windows.Forms.AnchorStyles.Right)));
     172      this.priorityComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    172173      this.priorityComboBox.FormattingEnabled = true;
    173174      this.priorityComboBox.Items.AddRange(new object[] {
    174             "1",
    175             "2",
    176             "3",
    177             "4",
    178             "5"});
     175            "Normal",
     176            "Urgent",
     177            "Critical"});
    179178      this.priorityComboBox.Location = new System.Drawing.Point(87, 39);
    180179      this.priorityComboBox.Name = "priorityComboBox";
    181180      this.priorityComboBox.Size = new System.Drawing.Size(182, 21);
    182181      this.priorityComboBox.TabIndex = 43;
     182      this.priorityComboBox.SelectedIndexChanged += new System.EventHandler(this.priorityComboBox_SelectedIndexChanged);
    183183      //
    184184      // jobIdLabel
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveJobs/HiveTask.cs

    r7132 r7177  
    121121              hiveJob.IsControllable = value;
    122122            }
    123           }
    124           finally {
     123          } finally {
    125124            childHiveTasksLock.ExitReadLock();
    126125          }
     
    136135        try {
    137136          return childHiveTasks.AsReadOnly();
    138         }
    139         finally { childHiveTasksLock.ExitReadLock(); }
     137        } finally { childHiveTasksLock.ExitReadLock(); }
    140138      }
    141139    }
     
    192190      try {
    193191        this.childHiveTasks = cloner.Clone(original.childHiveTasks);
    194       }
    195       finally { original.childHiveTasksLock.ExitReadLock(); }
     192      } finally { original.childHiveTasksLock.ExitReadLock(); }
    196193      this.syncTasksWithOptimizers = original.syncTasksWithOptimizers;
    197194      this.isFinishedTaskDownloaded = original.isFinishedTaskDownloaded;
     
    242239      try {
    243240        this.childHiveTasks.Add(hiveTask);
    244       }
    245       finally { childHiveTasksLock.ExitWriteLock(); }
     241      } finally { childHiveTasksLock.ExitWriteLock(); }
    246242    }
    247243
     
    340336        IsFinishedTaskDownloaded = false;
    341337      }
     338      if (e.PropertyName == "Priority" && Task != null) {
     339        foreach (var task in childHiveTasks) {
     340          task.Task.Priority = Task.Priority;
     341        }
     342      }
    342343    }
    343344    #endregion
     
    355356        }
    356357        return jobs;
    357       }
    358       finally { childHiveTasksLock.ExitReadLock(); }
     358      } finally { childHiveTasksLock.ExitReadLock(); }
    359359    }
    360360
     
    370370        }
    371371        return null;
    372       }
    373       finally { childHiveTasksLock.ExitWriteLock(); }
     372      } finally { childHiveTasksLock.ExitWriteLock(); }
    374373    }
    375374
     
    388387              return result;
    389388          }
    390         }
    391         finally { childHiveTasksLock.ExitReadLock(); }
     389        } finally { childHiveTasksLock.ExitReadLock(); }
    392390      }
    393391      return null;
     
    404402          child.RemoveByTaskId(jobId);
    405403        }
    406       }
    407       finally { childHiveTasksLock.ExitWriteLock(); }
     404      } finally { childHiveTasksLock.ExitWriteLock(); }
    408405    }
    409406
     
    458455            HiveServiceLocator.Instance.CallHiveService(s => s.PauseTask(child.task.Id));
    459456          }
    460         }
    461         finally { childHiveTasksLock.ExitReadLock(); }
     457        } finally { childHiveTasksLock.ExitReadLock(); }
    462458      } else {
    463459        HiveServiceLocator.Instance.CallHiveService(s => s.PauseTask(this.task.Id));
     
    472468            HiveServiceLocator.Instance.CallHiveService(s => s.StopTask(child.task.Id));
    473469          }
    474         }
    475         finally { childHiveTasksLock.ExitReadLock(); }
     470        } finally { childHiveTasksLock.ExitReadLock(); }
    476471      } else {
    477472        HiveServiceLocator.Instance.CallHiveService(s => s.StopTask(this.task.Id));
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveJobs/OptimizerHiveTask.cs

    r7142 r7177  
    6565            Optimization.Experiment experiment = (Optimization.Experiment)ItemTask.Item;
    6666            foreach (IOptimizer childOpt in experiment.Optimizers) {
    67               this.childHiveTasks.Add(new OptimizerHiveTask(childOpt));
     67              var optimizerHiveTask = new OptimizerHiveTask(childOpt);
     68              optimizerHiveTask.Task.Priority = Task.Priority; //inherit priority from parent
     69              this.childHiveTasks.Add(optimizerHiveTask);
    6870            }
    6971          } else if (ItemTask.Item is Optimization.BatchRun) {
     
    7173            if (batchRun.Optimizer != null) {
    7274              while (this.childHiveTasks.Count < batchRun.Repetitions) {
    73                 this.childHiveTasks.Add(new OptimizerHiveTask(batchRun.Optimizer));
     75                var optimizerHiveTask = new OptimizerHiveTask(batchRun.Optimizer);
     76                optimizerHiveTask.Task.Priority = Task.Priority;
     77                this.childHiveTasks.Add(optimizerHiveTask);
    7478              }
    7579              while (this.childHiveTasks.Count > batchRun.Repetitions) {
Note: See TracChangeset for help on using the changeset viewer.