Changeset 14901
- Timestamp:
- 05/02/17 09:41:39 (8 years ago)
- Location:
- trunk/sources
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.Designer.cs
r14185 r14901 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; -
trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r14185 r14901 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 } -
trunk/sources/HeuristicLab.Clients.Hive.Views/3.3/HiveTasks/OptimizerHiveTaskView.cs
r14185 r14901 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 || Content.Task.State == TaskState.Failed || Content.Task.State == TaskState.Aborted); 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); -
trunk/sources/HeuristicLab.Clients.Hive.Views/3.3/HiveTasks/OptimizerHiveTaskView.designer.cs
r14185 r14901 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; -
trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveClient.cs
r14185 r14901 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 } -
trunk/sources/HeuristicLab.Clients.Hive/3.3/RefreshableJob.cs
r14185 r14901 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 -
trunk/sources/HeuristicLab.Services.Hive/3.3/HiveService.cs
r14185 r14901 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.Aborted 266 && task.State != DA.TaskState.Finished 267 && task.State != DA.TaskState.Failed) { 268 UpdateTaskState(pm, task, DT.TaskState.Paused, null, null, string.Empty); 269 } 267 270 pm.SubmitChanges(); 268 271 }); … … 962 965 var stateLogDao = pm.StateLogDao; 963 966 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) { 967 968 if (taskStateEntity == DA.TaskState.Paused && task.Command == null) { 969 969 // slave paused and uploaded the task (no user-command) -> set waiting. 970 970 taskStateEntity = DA.TaskState.Waiting; 971 971 } 972 972 973 stateLogDao.Save(new DA.StateLog { 973 974 State = taskStateEntity, … … 978 979 Exception = exception 979 980 }); 981 980 982 task.State = taskStateEntity; 983 984 if (task.Command == DA.Command.Pause && task.State == DA.TaskState.Paused 985 || task.Command == DA.Command.Abort && task.State == DA.TaskState.Aborted 986 || task.Command == DA.Command.Stop && task.State == DA.TaskState.Aborted) { 987 task.Command = null; 988 } 981 989 } 982 990
Note: See TracChangeset
for help on using the changeset viewer.