Changeset 15262
- Timestamp:
- 07/16/17 13:08:06 (7 years ago)
- Location:
- stable
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 14901,15121
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.Designer.cs
r14186 r15262 60 60 this.startButton = new System.Windows.Forms.Button(); 61 61 this.stopButton = new System.Windows.Forms.Button(); 62 this.resetButton = new System.Windows.Forms.Button();63 62 this.executionTimeLabel = new System.Windows.Forms.Label(); 64 63 this.executionTimeTextBox = new System.Windows.Forms.TextBox(); … … 271 270 this.stopButton.Click += new System.EventHandler(this.stopButton_Click); 272 271 // 273 // resetButton274 //275 this.resetButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));276 this.resetButton.Enabled = false;277 this.resetButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Restart;278 this.resetButton.Location = new System.Drawing.Point(90, 536);279 this.resetButton.Name = "resetButton";280 this.resetButton.Size = new System.Drawing.Size(24, 24);281 this.resetButton.TabIndex = 8;282 this.toolTip.SetToolTip(this.resetButton, "Reset Experiment");283 this.resetButton.UseVisualStyleBackColor = true;284 this.resetButton.Click += new System.EventHandler(this.resetButton_Click);285 //286 272 // executionTimeLabel 287 273 // … … 486 472 this.Controls.Add(this.resourceIdsLabel); 487 473 this.Controls.Add(this.stopButton); 488 this.Controls.Add(this.resetButton);489 474 this.Name = "RefreshableHiveJobView"; 490 475 this.Size = new System.Drawing.Size(717, 560); … … 505 490 private System.Windows.Forms.Button startButton; 506 491 private System.Windows.Forms.Button stopButton; 507 private System.Windows.Forms.Button resetButton;508 492 private System.Windows.Forms.Label executionTimeLabel; 509 493 private System.Windows.Forms.TextBox executionTimeTextBox; -
stable/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r14186 r15262 167 167 pauseButton.Enabled = !Locked; 168 168 stopButton.Enabled = !Locked; 169 resetButton.Enabled = !Locked;170 169 } 171 170 … … 188 187 this.jobsTreeView.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded || Content.IsProgressing; 189 188 190 this.refreshAutomaticallyCheckBox.Enabled = Content.IsControllable && alreadyUploaded && jobsLoaded && Content.ExecutionState == ExecutionState.Started&& !Content.IsProgressing;189 this.refreshAutomaticallyCheckBox.Enabled = Content.IsControllable && alreadyUploaded && jobsLoaded && (Content.ExecutionState == ExecutionState.Started || Content.ExecutionState == ExecutionState.Paused) && !Content.IsProgressing; 191 190 this.refreshButton.Enabled = Content.IsDownloadable && alreadyUploaded && !Content.IsProgressing; 192 191 … … 380 379 }, TaskContinuationOptions.OnlyOnFaulted); 381 380 } 382 private void resetButton_Click(object sender, EventArgs e) { }383 381 384 382 private void PauseJobAsync(object job) { … … 438 436 private void SetEnabledStateOfExecutableButtons() { 439 437 if (Content == null) { 440 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled =false;438 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = false; 441 439 } else { 442 440 startButton.Enabled = Content.IsControllable && Content.HiveTasks != null && Content.HiveTasks.Count > 0 && (Content.ExecutionState == ExecutionState.Prepared || Content.ExecutionState == ExecutionState.Paused) && !Content.IsProgressing; 443 441 pauseButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started && !Content.IsProgressing; 444 stopButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started && !Content.IsProgressing; 445 resetButton.Enabled = false; 442 stopButton.Enabled = Content.IsControllable && (Content.ExecutionState == ExecutionState.Started || Content.ExecutionState == ExecutionState.Paused) && !Content.IsProgressing; 446 443 } 447 444 } -
stable/HeuristicLab.Clients.Hive.Views/3.3/HiveTasks/OptimizerHiveTaskView.cs
r14186 r15262 73 73 74 74 #region Child Control Events 75 private void restartButton_Click(object sender, EventArgs e) {75 private void startButton_Click(object sender, EventArgs e) { 76 76 var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeTaskAsync); 77 77 task.ContinueWith((t) => { … … 119 119 base.SetEnabledStateOfControls(); 120 120 121 this. restartButton.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); 122 122 this.pauseButton.Enabled = Content != null && Content.IsControllable && !Content.Task.Command.HasValue && Content.Task.State == TaskState.Calculating; 123 123 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); -
stable/HeuristicLab.Clients.Hive.Views/3.3/HiveTasks/OptimizerHiveTaskView.designer.cs
r14186 r15262 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 this. restartButton = new System.Windows.Forms.Button();47 this.startButton = new System.Windows.Forms.Button(); 48 48 this.pauseButton = new System.Windows.Forms.Button(); 49 49 this.stopButton = new System.Windows.Forms.Button(); … … 60 60 // detailsTabPage 61 61 // 62 this.detailsTabPage.Controls.Add(this. restartButton);62 this.detailsTabPage.Controls.Add(this.startButton); 63 63 this.detailsTabPage.Controls.Add(this.pauseButton); 64 64 this.detailsTabPage.Controls.Add(this.stopButton); … … 66 66 this.detailsTabPage.Controls.SetChildIndex(this.stopButton, 0); 67 67 this.detailsTabPage.Controls.SetChildIndex(this.pauseButton, 0); 68 this.detailsTabPage.Controls.SetChildIndex(this. restartButton, 0);68 this.detailsTabPage.Controls.SetChildIndex(this.startButton, 0); 69 69 // 70 70 // tabControl … … 79 79 this.modifyItemButton.Text = "Show/Modify Optimizer"; 80 80 // 81 // restartButton81 // startButton 82 82 // 83 this. restartButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));84 this. restartButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Restart;85 this. restartButton.Location = new System.Drawing.Point(3, 348);86 this. restartButton.Name = "restartButton";87 this. restartButton.Size = new System.Drawing.Size(24, 24);88 this. restartButton.TabIndex = 34;89 this. restartButton.UseVisualStyleBackColor = true;90 this. restartButton.Click += new System.EventHandler(this.restartButton_Click);83 this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 84 this.startButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Play; 85 this.startButton.Location = new System.Drawing.Point(3, 348); 86 this.startButton.Name = "startButton"; 87 this.startButton.Size = new System.Drawing.Size(24, 24); 88 this.startButton.TabIndex = 34; 89 this.startButton.UseVisualStyleBackColor = true; 90 this.startButton.Click += new System.EventHandler(this.startButton_Click); 91 91 // 92 92 // pauseButton … … 139 139 // OptimizerHiveTaskView 140 140 // 141 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);142 141 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 143 142 this.Name = "OptimizerHiveTaskView"; … … 156 155 #endregion 157 156 158 private System.Windows.Forms.Button restartButton;157 private System.Windows.Forms.Button startButton; 159 158 private System.Windows.Forms.Button pauseButton; 160 159 private System.Windows.Forms.Button stopButton; -
stable/HeuristicLab.Clients.Hive/3.3/HiveClient.cs
r14186 r15262 441 441 if (refreshableJob.IsFinished()) { 442 442 refreshableJob.ExecutionState = Core.ExecutionState.Stopped; 443 } else { 443 } else if (refreshableJob.IsPaused()) { 444 refreshableJob.ExecutionState = Core.ExecutionState.Paused; 445 } else { 444 446 refreshableJob.ExecutionState = Core.ExecutionState.Started; 445 447 } -
stable/HeuristicLab.Clients.Hive/3.3/HiveTasks/OptimizerHiveTask.cs
r14186 r15262 316 316 public override void AddChildHiveTask(HiveTask hiveTask) { 317 317 base.AddChildHiveTask(hiveTask); 318 var optimizerHive Job= (OptimizerHiveTask)hiveTask;318 var optimizerHiveTask = (OptimizerHiveTask)hiveTask; 319 319 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(); 326 322 327 323 if (this.ItemTask.Item is Optimization.Experiment) { 328 if (!this.ItemTask.OptimizerAsExperiment.Optimizers.Contains(optimizerHive Job.ItemTask.Item)) {329 UpdateOptimizerInExperiment(this.ItemTask.OptimizerAsExperiment, optimizerHive Job.ItemTask);324 if (!this.ItemTask.OptimizerAsExperiment.Optimizers.Contains(optimizerHiveTask.ItemTask.Item)) { 325 UpdateOptimizerInExperiment(this.ItemTask.OptimizerAsExperiment, optimizerHiveTask.ItemTask); 330 326 } 331 327 } else if (this.ItemTask.Item is Optimization.BatchRun) { 332 UpdateOptimizerInBatchRun(this.ItemTask.OptimizerAsBatchRun, optimizerHive Job.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; 338 334 } 339 335 syncTasksWithOptimizers = true; -
stable/HeuristicLab.Clients.Hive/3.3/RefreshableJob.cs
r14186 r15262 304 304 } 305 305 GC.Collect(); // force GC, because .NET is too lazy here (deserialization takes a lot of memory) 306 if ( AllJobsFinished()) {307 this.ExecutionState = Core.ExecutionState.Stopped;306 if (IsFinished()) { 307 ExecutionState = ExecutionState.Stopped; 308 308 StopResultPolling(); 309 } else if (IsPaused()) { 310 ExecutionState = ExecutionState.Paused; 311 StopResultPolling(); 312 } else { 313 ExecutionState = ExecutionState.Started; 309 314 } 310 315 UpdateTotalExecutionTime(); … … 330 335 job.FinishedCount = jobs.Count(j => j.Task.State == TaskState.Finished); 331 336 OnJobStatisticsChanged(); 332 }333 334 public bool AllJobsFinished() {335 return this.GetAllHiveTasks().All(j => (j.Task.State == TaskState.Finished336 || j.Task.State == TaskState.Aborted337 || j.Task.State == TaskState.Failed)338 && !j.IsDownloading);339 337 } 340 338 … … 513 511 this.RefreshAutomatically = false; 514 512 StopResultPolling(); 513 } else if (IsPaused()) { 514 this.executionState = Core.ExecutionState.Paused; 515 this.RefreshAutomatically = false; 516 StopResultPolling(); 515 517 } else { 516 518 this.RefreshAutomatically = true; … … 527 529 this.OnStateLogListChanged(); 528 530 529 if (this.ExecutionState != ExecutionState.Stopped ) {531 if (this.ExecutionState != ExecutionState.Stopped && this.ExecutionState != ExecutionState.Paused) { 530 532 this.RefreshAutomatically = true; 531 533 } … … 584 586 585 587 public bool IsFinished() { 586 return HiveTasks != null 587 && HiveTasks.All(x => x.Task.DateFinished.HasValue && x.Task.DateCreated.HasValue); 588 var tasks = GetAllHiveTasks(); 589 return tasks.All(x => x.Task.State == TaskState.Finished 590 || x.Task.State == TaskState.Aborted 591 || x.Task.State == TaskState.Failed); 592 } 593 594 public bool IsPaused() { 595 var tasks = GetAllHiveTasks().Where(x => !x.Task.IsParentTask); 596 return tasks.All(x => x.Task.State != TaskState.Waiting 597 && x.Task.State != TaskState.Transferring 598 && x.Task.State != TaskState.Calculating) 599 && tasks.Any(x => x.Task.State == TaskState.Paused); 588 600 } 589 601 -
stable/HeuristicLab.Services.Hive
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Services.Hive merged: 14901,15121
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Services.Hive/3.3/HiveService.cs
r14186 r15262 263 263 if (task.State == DA.TaskState.Calculating || task.State == DA.TaskState.Transferring) { 264 264 task.Command = DA.Command.Pause; 265 } 266 UpdateTaskState(pm, task, DT.TaskState.Paused, null, null, string.Empty); 265 } else if (task.State != DA.TaskState.Paused 266 && task.State != DA.TaskState.Aborted 267 && task.State != DA.TaskState.Finished 268 && task.State != DA.TaskState.Failed) { 269 UpdateTaskState(pm, task, DT.TaskState.Paused, null, null, string.Empty); 270 } 267 271 pm.SubmitChanges(); 268 272 }); … … 962 966 var stateLogDao = pm.StateLogDao; 963 967 var taskStateEntity = taskState.ToEntity(); 964 if (task.Command == DA.Command.Pause && task.State == DA.TaskState.Paused 965 || task.Command == DA.Command.Abort && task.State == DA.TaskState.Aborted 966 || task.Command == DA.Command.Stop && task.State == DA.TaskState.Aborted) { 967 task.Command = null; 968 } else if (taskStateEntity == DA.TaskState.Paused && task.Command == null) { 968 969 if (task.State == DA.TaskState.Calculating && taskStateEntity == DA.TaskState.Paused && task.Command == null) { 969 970 // slave paused and uploaded the task (no user-command) -> set waiting. 970 971 taskStateEntity = DA.TaskState.Waiting; 971 972 } 973 972 974 stateLogDao.Save(new DA.StateLog { 973 975 State = taskStateEntity, … … 978 980 Exception = exception 979 981 }); 982 980 983 task.State = taskStateEntity; 984 985 if (task.Command == DA.Command.Pause && task.State == DA.TaskState.Paused 986 || task.Command == DA.Command.Abort && task.State == DA.TaskState.Aborted 987 || task.Command == DA.Command.Stop && task.State == DA.TaskState.Aborted) { 988 task.Command = null; 989 } 981 990 } 982 991
Note: See TracChangeset
for help on using the changeset viewer.