Changeset 15642
- Timestamp:
- 01/23/18 14:00:03 (7 years ago)
- Location:
- branches/HiveProjectManagement
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectPermissionsView.cs
r15580 r15642 94 94 private async void inheritButton_Click(object sender, EventArgs e) { 95 95 await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions( 96 action: () => SetGrantedProjectPermissions(Content.Id, newAssignedPermissions.Select(x => x.Id), false, true, true));96 action: () => SetGrantedProjectPermissions(Content.Id, newAssignedPermissions.Select(x => x.Id), false, true, false)); 97 97 UpdatePermissionList(); 98 98 } -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectResourcesView.cs
r15627 r15642 100 100 await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions( 101 101 action: () => { 102 SetAssignedProjectResources(Content.Id, newAssignedResources.Select(x => x.Id), false, true );102 SetAssignedProjectResources(Content.Id, newAssignedResources.Select(x => x.Id), false, true, false); 103 103 }); 104 104 UpdateResourceTree(); … … 108 108 await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions( 109 109 action: () => { 110 SetAssignedProjectResources(Content.Id, newAssignedResources.Select(x => x.Id), false, false );110 SetAssignedProjectResources(Content.Id, newAssignedResources.Select(x => x.Id), false, false, false); 111 111 }); 112 112 UpdateResourceTree(); … … 156 156 } 157 157 158 private void SetAssignedProjectResources(Guid projectId, IEnumerable<Guid> resourceIds, bool reassign, bool cascading ) {158 private void SetAssignedProjectResources(Guid projectId, IEnumerable<Guid> resourceIds, bool reassign, bool cascading, bool reassignCascading) { 159 159 if (projectId == null || resourceIds == null) return; 160 160 HiveServiceLocator.Instance.CallHiveService(s => { 161 s.SaveProjectResourceAssignments(projectId, resourceIds.ToList(), reassign, cascading, true);161 s.SaveProjectResourceAssignments(projectId, resourceIds.ToList(), reassign, cascading, reassignCascading); 162 162 }); 163 163 } -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs
r15627 r15642 72 72 private string currentSearchString; 73 73 74 private void resetHiveResourceSelector() { 75 lastSelectedProject = null; 76 selectedProject = null; 77 projectId = null; 78 } 79 74 80 private Guid jobId; 75 81 public Guid JobId { … … 78 84 if (jobId == value) return; 79 85 jobId = value; 86 resetHiveResourceSelector(); 80 87 } 81 88 } … … 99 106 } 100 107 101 public bool ChangedProject { 102 get { 103 return (selectedProject == null || selectedProject.Id == projectId) ? false : true; 108 private IEnumerable<Guid> selectedResourceIds; 109 public IEnumerable<Guid> SelectedResourceIds { 110 get { return selectedResourceIds; } 111 set { 112 if (selectedResourceIds == value) return; 113 selectedResourceIds = value; 104 114 } 105 115 } … … 128 138 selectedProject = value; 129 139 UpdateResourceTree(); 140 ExtractStatistics(); 130 141 OnSelectedProjectChanged(); 131 142 } 132 143 } 144 133 145 public IEnumerable<Resource> AssignedResources { 134 146 get { return newAssignedResources; } … … 142 154 } 143 155 156 144 157 public new IItemList<Project> Content { 145 158 get { return (IItemList<Project>)base.Content; } … … 164 177 UpdateResourceGenealogy(); 165 178 166 if (SelectedProjectId.HasValue ) {179 if (SelectedProjectId.HasValue && SelectedProjectId.Value != Guid.Empty) { 167 180 SelectedProject = GetSelectedProjectById(SelectedProjectId.Value); 168 181 } else { 169 182 SelectedProject = null; 170 183 } 184 //ExtractStatistics(); 171 185 UpdateProjectTree(); 172 186 173 187 } else { 188 lastSelectedProject = null; 189 selectedProject = null; 190 selectedProjectId = null; 174 191 projectsTreeView.Nodes.Clear(); 175 192 resourcesTreeView.Nodes.Clear(); … … 183 200 projectsTreeView.Nodes.Clear(); 184 201 resourcesTreeView.Nodes.Clear(); 185 //SelectedProject = null;186 202 } 187 203 … … 213 229 } 214 230 215 SelectedProject = node;216 } 217 218 ExtractStatistics();231 232 } 233 SelectedProject = node; 234 //ExtractStatistics(); 219 235 } 220 236 … … 243 259 244 260 UpdateNewResourceTree(); 261 ExtractStatistics(); 245 262 //ExtractStatistics((Resource)resourcesTreeView.SelectedNode?.Tag); 246 263 OnAssignedResourcesChanged(); … … 483 500 } 484 501 } 485 ExtractStatistics();502 //ExtractStatistics(); 486 503 //OnAssignedResourcesChanged(); 487 504 } 488 505 489 506 private void UpdateAssignedResources() { 490 491 if (JobId == Guid.Empty && ChangedProjectSelection) { // new, unchanged jobs get all avaialable resources 507 assignedResources.Clear(); 508 newAssignedResources.Clear(); 509 510 if (JobId == Guid.Empty || JobId == null) { // new, unchanged jobs get all avaialable resources 492 511 // update new assigned resources 493 assignedResources.Clear(); 494 newAssignedResources.Clear(); 495 foreach (var resource in availableResources 496 .Where(x => !x.ParentResourceId.HasValue 497 || !availableResources.Select(y => y.Id).Contains(x.ParentResourceId.Value))) { 498 newAssignedResources.Add(resource); 499 } 500 501 } else if(JobId != Guid.Empty) { // existent, unchanged jobs get all assigned resources 512 if(selectedResourceIds == null) { 513 foreach (var resource in availableResources 514 .Where(x => !x.ParentResourceId.HasValue 515 || !availableResources.Select(y => y.Id).Contains(x.ParentResourceId.Value))) { 516 newAssignedResources.Add(resource); 517 } 518 } else { 519 foreach(var resource in availableResources.Where(x => selectedResourceIds.Contains(x.Id))) { 520 newAssignedResources.Add(resource); 521 } 522 } 523 } else { // existent, unchanged jobs get all assigned resources 502 524 // update assigned resources 503 525 var assignedJobResources = GetAssignedResourcesForJob(JobId); 504 526 foreach (var resource in assignedJobResources) { 505 527 assignedResources.Add(resource); 506 } 507 508 if(ChangedProjectSelection) { 509 newAssignedResources.Clear(); 510 foreach (var resource in assignedJobResources) { 528 if (selectedResourceIds == null) { 511 529 newAssignedResources.Add(resource); 512 530 } 513 531 } 514 } else { 515 var newAssignedResourceIds = newAssignedResources.Select(x => x.Id).ToList();516 newAssignedResources.Clear();517 foreach(var r in availableResources.Where(x => newAssignedResourceIds.Contains(x.Id))) {518 newAssignedResources.Add(r);519 } 520 } 521 522 ExtractStatistics();532 533 if(selectedResourceIds != null) { 534 foreach (var resource in availableResources.Where(x => selectedResourceIds.Contains(x.Id))) { 535 newAssignedResources.Add(resource); 536 } 537 } 538 } 539 540 //ExtractStatistics(); 523 541 OnAssignedResourcesChanged(); 524 542 } … … 535 553 includedResources.Clear(); 536 554 newIncludedResources.Clear(); 555 537 556 if (JobId != Guid.Empty) { 538 557 foreach (var item in assignedResources) { 539 558 foreach (var descendant in resourceDescendants[item.Id]) { 540 559 includedResources.Add(descendant); 541 newIncludedResources.Add(descendant); 542 } 543 } 544 } else { 545 foreach (var item in newAssignedResources) { 546 foreach (var descendant in resourceDescendants[item.Id]) { 547 newIncludedResources.Add(descendant); 548 } 560 } 561 } 562 } 563 564 foreach (var item in newAssignedResources) { 565 foreach (var descendant in resourceDescendants[item.Id]) { 566 newIncludedResources.Add(descendant); 549 567 } 550 568 } … … 722 740 } 723 741 724 private void ExtractStatistics(Resource resource = null) { 725 ISet<Slave> selectedSlaves = null; 742 private void ExtractStatistics(Resource resource = null) { 743 HashSet<Slave> newAssignedSlaves = new HashSet<Slave>(newAssignedResources.OfType<Slave>()); 744 foreach (var slaveGroup in newAssignedResources.OfType<SlaveGroup>()) { 745 foreach(var slave in resourceDescendants[slaveGroup.Id].OfType<Slave>()) { 746 newAssignedSlaves.Add(slave); 747 } 748 } 749 750 HashSet<Slave> selectedSlaves = null; 726 751 727 752 if (resource != null) { 728 729 730 753 var slaveGroup = resource as SlaveGroup; 731 754 if (slaveGroup != null) { 732 755 selectedSlaves = new HashSet<Slave>(resourceDescendants[slaveGroup.Id].OfType<Slave>()); 733 selectedSlaves.IntersectWith(newAssignedResources.OfType<Slave>());756 //selectedSlaves.IntersectWith(newAssignedSlaves); 734 757 } else { 735 758 selectedSlaves = new HashSet<Slave>(new[] { resource as Slave }); 736 759 } 737 760 } else { 738 selectedSlaves = new HashSet<Slave>(newAssignedResources.OfType<Slave>());739 } 740 741 int sumCores = selectedSlaves. OfType<Slave>().Sum(x => x.Cores.GetValueOrDefault());742 int sumFreeCores = selectedSlaves. OfType<Slave>().Sum(x => x.FreeCores.GetValueOrDefault());743 double sumMemory = selectedSlaves. OfType<Slave>().Sum(x => x.Memory.GetValueOrDefault()) / 1024.0;744 double sumFreeMemory = selectedSlaves. OfType<Slave>().Sum(x => x.FreeMemory.GetValueOrDefault()) / 1024.0;761 selectedSlaves = newAssignedSlaves; 762 } 763 764 int sumCores = selectedSlaves.Sum(x => x.Cores.GetValueOrDefault()); 765 int sumFreeCores = selectedSlaves.Sum(x => x.FreeCores.GetValueOrDefault()); 766 double sumMemory = selectedSlaves.Sum(x => x.Memory.GetValueOrDefault()) / 1024.0; 767 double sumFreeMemory = selectedSlaves.Sum(x => x.FreeMemory.GetValueOrDefault()) / 1024.0; 745 768 746 769 coresSummaryLabel.Text = $"{sumCores} Total ({sumFreeCores} Free / {sumCores - sumFreeCores} Used)"; … … 760 783 } 761 784 762 private void ExtractStatistics_Old(Resource resource = null) {763 ISet<Slave> selectedSlaves = null;764 765 if (resource != null) {766 var slaveGroup = resource as SlaveGroup;767 if (slaveGroup != null) {768 var children = new HashSet<Resource>(availableResources.Where(x => x.ParentResourceId == slaveGroup.Id));769 int nrOfChildren = children.Count;770 do {771 var newChildren = availableResources.Where(x => children.Any(y => y.Id == x.ParentResourceId));772 foreach (var newChild in newChildren)773 children.Add(newChild);774 } while (children.Count > nrOfChildren);775 selectedSlaves = new HashSet<Slave>(children.OfType<Slave>());776 selectedSlaves.IntersectWith(assignedResources.OfType<Slave>());777 } else {778 selectedSlaves = new HashSet<Slave>(new[] { resource as Slave });779 }780 } else {781 selectedSlaves = new HashSet<Slave>(assignedResources.OfType<Slave>());782 }783 784 int sumCores = selectedSlaves.OfType<Slave>().Sum(x => x.Cores.GetValueOrDefault());785 int sumFreeCores = selectedSlaves.OfType<Slave>().Sum(x => x.FreeCores.GetValueOrDefault());786 double sumMemory = selectedSlaves.OfType<Slave>().Sum(x => x.Memory.GetValueOrDefault()) / 1024.0;787 double sumFreeMemory = selectedSlaves.OfType<Slave>().Sum(x => x.FreeMemory.GetValueOrDefault()) / 1024.0;788 789 coresSummaryLabel.Text = $"{sumCores} Total ({sumFreeCores} Free / {sumCores - sumFreeCores} Used)";790 memorySummaryLabel.Text = $"{sumMemory:0.00} GB Total ({sumFreeMemory:0.00} GB Free / {(sumMemory - sumFreeMemory):0.00} GB Used)";791 }792 793 private Resource BuildResourceTree_Old(IEnumerable<Resource> resources) {794 resourcesTreeView.Nodes.Clear();795 if (!resources.Any()) return null;796 797 var mainResources = new HashSet<Resource>(resources.Where(x => x.ParentResourceId == null));798 var subResources = new HashSet<Resource>(resources.Except(mainResources));799 800 var stack = new Stack<Resource>(mainResources.OrderByDescending(x => x.Name));801 var top = stack.Peek();802 803 TreeNode currentNode = null;804 Resource currentResource = null;805 806 while (stack.Any()) {807 var newResource = stack.Pop();808 var newNode = new TreeNode(newResource.Name) {809 Checked = true,810 ImageIndex = newResource is Slave ? slaveImageIndex : slaveGroupImageIndex,811 Tag = newResource812 };813 814 while (currentNode != null && newResource.ParentResourceId != currentResource.Id) {815 currentNode = currentNode.Parent;816 currentResource = currentNode == null ? null : (Resource)currentNode.Tag;817 }818 819 if (currentNode == null) {820 resourcesTreeView.Nodes.Add(newNode);821 } else {822 currentNode.Nodes.Add(newNode);823 }824 825 newNode.SelectedImageIndex = newNode.ImageIndex;826 827 var childResources = subResources.Where(x => x.ParentResourceId == newResource.Id);828 if (childResources.Any()) {829 foreach (var resource in childResources.OrderByDescending(x => x.Name)) {830 subResources.Remove(resource);831 stack.Push(resource);832 }833 currentNode = newNode;834 currentResource = newResource;835 }836 }837 838 resourcesTreeView.ExpandAll();839 840 return top;841 }842 843 785 #endregion 844 786 -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.cs
r15627 r15642 55 55 } 56 56 57 // currently selected projectId (initially persisted projectId)57 // currently selected projectId (initially the persisted projectId) 58 58 private Guid? selectedProjectId; 59 59 public Guid? SelectedProjectId { … … 61 61 set { selectedProjectId = value; } 62 62 } 63 64 // currently selected resourceIds (if null, perform lookup in HiveResourceSelector) 65 private IEnumerable<Guid> selectedResourceIds; 66 public IEnumerable<Guid> SelectedResourceIds { 67 get { return selectedResourceIds; } 68 set { selectedResourceIds = value; } 69 } 70 63 71 64 72 … … 135 143 private void hiveResourceSelector_ProjectsTreeViewDoubleClicked(object sender, EventArgs e) { 136 144 if (hiveResourceSelector.SelectedProject == null) return; 145 if (!hiveResourceSelector.AssignedResources.Any()) return; 137 146 138 147 DialogResult = DialogResult.OK; … … 147 156 hiveResourceSelector.ProjectId = projectId; 148 157 hiveResourceSelector.SelectedProjectId = selectedProjectId; 158 hiveResourceSelector.SelectedResourceIds = selectedResourceIds; 149 159 var projectList = new ItemList<Project>(HiveServiceLocator.Instance.CallHiveService(s => s.GetProjects())); 150 160 hiveResourceSelector.Content = projectList; -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.Designer.cs
r15412 r15642 68 68 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 69 69 this.refreshButton = new System.Windows.Forms.Button(); 70 this.updateButton = new System.Windows.Forms.Button(); 70 71 this.UnloadButton = new System.Windows.Forms.Button(); 71 72 this.refreshAutomaticallyCheckBox = new System.Windows.Forms.CheckBox(); … … 337 338 this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click); 338 339 // 340 // updateButton 341 // 342 this.updateButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Save; 343 this.updateButton.Location = new System.Drawing.Point(30, 0); 344 this.updateButton.Name = "updateButton"; 345 this.updateButton.Size = new System.Drawing.Size(24, 24); 346 this.updateButton.TabIndex = 23; 347 this.toolTip.SetToolTip(this.updateButton, "Update Job (Name, Project, Resources)"); 348 this.updateButton.UseVisualStyleBackColor = true; 349 this.updateButton.Click += new System.EventHandler(this.updateButton_Click); 350 // 339 351 // UnloadButton 340 352 // 341 353 this.UnloadButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Disconnect; 342 this.UnloadButton.Location = new System.Drawing.Point( 30, 0);354 this.UnloadButton.Location = new System.Drawing.Point(57, 0); 343 355 this.UnloadButton.Name = "UnloadButton"; 344 356 this.UnloadButton.Size = new System.Drawing.Size(24, 24); … … 351 363 // 352 364 this.refreshAutomaticallyCheckBox.AutoSize = true; 353 this.refreshAutomaticallyCheckBox.Location = new System.Drawing.Point( 70, 3);365 this.refreshAutomaticallyCheckBox.Location = new System.Drawing.Point(100, 3); 354 366 this.refreshAutomaticallyCheckBox.Name = "refreshAutomaticallyCheckBox"; 355 367 this.refreshAutomaticallyCheckBox.Size = new System.Drawing.Size(127, 17); … … 457 469 // 458 470 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 459 this.Controls.Add(this.UnloadButton);460 471 this.Controls.Add(this.searchButton); 461 472 this.Controls.Add(this.infoGroupBox); 462 473 this.Controls.Add(this.refreshAutomaticallyCheckBox); 463 474 this.Controls.Add(this.refreshButton); 475 this.Controls.Add(this.updateButton); 476 this.Controls.Add(this.UnloadButton); 464 477 this.Controls.Add(this.nameTextBox); 465 478 this.Controls.Add(this.nameLabel); … … 503 516 private System.Windows.Forms.ToolTip toolTip; 504 517 private System.Windows.Forms.Button refreshButton; 518 private System.Windows.Forms.Button updateButton; 519 private System.Windows.Forms.Button UnloadButton; 505 520 private System.Windows.Forms.CheckBox refreshAutomaticallyCheckBox; 506 521 private System.Windows.Forms.GroupBox infoGroupBox; … … 520 535 private System.Windows.Forms.Button searchButton; 521 536 private MainForm.WindowsForms.DragOverTabControl tabControl; 522 private System.Windows.Forms.Button UnloadButton;523 524 537 } 525 538 } -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r15627 r15642 46 46 private object runCollectionViewLocker = new object(); 47 47 private Project selectedProject; 48 private Dictionary<Guid, Guid> originalJobProjectAssignment = new Dictionary<Guid, Guid>(); 48 49 49 50 public new RefreshableJob Content { 50 51 get { return (RefreshableJob)base.Content; } 51 set { base.Content = value; } 52 set { 53 base.Content = value; 54 } 52 55 } 53 56 … … 129 132 stateLogViewHost.Content = null; 130 133 } else { 134 if(Content.Job != null 135 && Content.Job.Id != Guid.Empty 136 && !originalJobProjectAssignment.ContainsKey(Content.Job.Id)) { 137 originalJobProjectAssignment.Add(Content.Job.Id, Content.Job.ProjectId); 138 } 139 131 140 nameTextBox.Text = Content.Job.Name; 132 141 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); … … 135 144 // project look up 136 145 if(Content.Job.ProjectId != null && Content.Job.ProjectId != Guid.Empty) { 137 selectedProject = GetProject(Content.Job.ProjectId); 138 if(selectedProject != null) { 139 projectNameTextBox.Text = selectedProject.Name; 140 } else { 141 projectNameTextBox.Text = string.Empty; 146 if(selectedProject == null || selectedProject.Id != Content.Job.ProjectId) { 147 selectedProject = GetProject(Content.Job.ProjectId); 148 if (selectedProject != null) { 149 projectNameTextBox.Text = selectedProject.Name; 150 } else { 151 projectNameTextBox.Text = string.Empty; 152 } 142 153 } 143 154 } else { 144 155 selectedProject = null; 145 156 projectNameTextBox.Text = string.Empty; 157 Content.Job.ResourceIds = null; 146 158 } 147 159 … … 195 207 tabControl.Enabled = !Content.IsProgressing; 196 208 197 this.nameTextBox.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded ||Content.IsProgressing;198 this.searchButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Prepared && !alreadyUploaded && !Content.IsProgressing;209 this.nameTextBox.ReadOnly = Content.IsProgressing; 210 this.searchButton.Enabled = !Content.IsProgressing && Content.ExecutionState != ExecutionState.Stopped; 199 211 this.jobsTreeView.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded || Content.IsProgressing; 200 212 201 213 this.refreshAutomaticallyCheckBox.Enabled = Content.IsControllable && alreadyUploaded && jobsLoaded && (Content.ExecutionState == ExecutionState.Started || Content.ExecutionState == ExecutionState.Paused) && !Content.IsProgressing; 202 214 this.refreshButton.Enabled = Content.IsDownloadable && alreadyUploaded && !Content.IsProgressing; 215 this.updateButton.Enabled = Content.ExecutionState != ExecutionState.Prepared && Content.ExecutionState != ExecutionState.Stopped && !Content.IsProgressing; 203 216 204 217 this.UnloadButton.Enabled = Content.HiveTasks != null && Content.HiveTasks.Count > 0 && alreadyUploaded && !Content.IsProgressing; … … 347 360 if (hiveResourceSelectorDialog == null) { 348 361 hiveResourceSelectorDialog = new HiveResourceSelectorDialog(Content.Job.Id, Content.Job.ProjectId); 349 } else if(selectedProject != null) { 362 } else if(hiveResourceSelectorDialog.JobId != Content.Job.Id) { 363 hiveResourceSelectorDialog.JobId = Content.Job.Id; 350 364 hiveResourceSelectorDialog.SelectedProjectId = Content.Job.ProjectId; 365 hiveResourceSelectorDialog.SelectedResourceIds = Content.Job.ResourceIds; 366 367 if (originalJobProjectAssignment.ContainsKey(Content.Job.Id)) { 368 hiveResourceSelectorDialog.ProjectId = originalJobProjectAssignment[Content.Job.Id]; 369 } else { 370 hiveResourceSelectorDialog.ProjectId = Guid.Empty; 371 } 372 } else if(hiveResourceSelectorDialog.JobId == Guid.Empty && Content.Job.Id == Guid.Empty) { 373 hiveResourceSelectorDialog.JobId = Content.Job.Id; 374 hiveResourceSelectorDialog.ProjectId = Guid.Empty; 375 hiveResourceSelectorDialog.SelectedProjectId = Content.Job.ProjectId; 376 hiveResourceSelectorDialog.SelectedResourceIds = Content.Job.ResourceIds; 351 377 } else { 352 hiveResourceSelectorDialog.SelectedProjectId = null; 378 hiveResourceSelectorDialog.SelectedProjectId = Content.Job.ProjectId; 379 hiveResourceSelectorDialog.SelectedResourceIds = Content.Job.ResourceIds; 353 380 } 354 381 … … 360 387 Content.Job.ResourceIds = hiveResourceSelectorDialog.SelectedResources.Select(x => x.Id).ToList(); 361 388 } else { 389 selectedProject = null; 362 390 projectNameTextBox.Text = string.Empty; 363 391 Content.Job.ProjectId = Guid.Empty; … … 447 475 } 448 476 477 private void updateButton_Click(object sender, EventArgs e) { 478 HiveClient.UpdateJob( 479 (Exception ex) => ErrorHandling.ShowErrorDialog(this, "Update failed.", ex), 480 Content, 481 new CancellationToken()); 482 } 483 484 //private void updateButton_Click(object sender, EventArgs e) { 485 // var task = System.Threading.Tasks.Task.Factory.StartNew(UpdateJobAsync, Content); 486 // task.ContinueWith((t) => { 487 // Content.Progress.Finish(); 488 // MessageBox.Show("An error occured updating the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 489 // Content.Log.LogException(t.Exception); 490 // }, TaskContinuationOptions.OnlyOnFaulted); 491 //} 492 493 //private void UpdateJobAsync(object job) { 494 // Content.Progress.Start("Updating job..."); 495 // HiveClient.UpdateJob((RefreshableJob)job); 496 // Content.Progress.Finish(); 497 //} 498 499 private void UnloadButton_Click(object sender, EventArgs e) { 500 Content.Unload(); 501 runCollectionViewHost.Content = null; 502 stateLogViewHost.Content = null; 503 hiveExperimentPermissionListView.Content = null; 504 jobsTreeView.Content = null; 505 506 SetEnabledStateOfControls(); 507 } 508 449 509 private void refreshPermissionsButton_Click(object sender, EventArgs e) { 450 510 if (this.Content.Job.Id == Guid.Empty) { … … 544 604 } 545 605 546 private void UnloadButton_Click(object sender, EventArgs e) {547 Content.Unload();548 runCollectionViewHost.Content = null;549 stateLogViewHost.Content = null;550 hiveExperimentPermissionListView.Content = null;551 jobsTreeView.Content = null;552 553 SetEnabledStateOfControls();554 }555 606 } 556 607 } -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive/3.3/HiveClient.cs
r15630 r15642 249 249 } 250 250 251 public static void UpdateJob(Action<Exception> exceptionCallback, RefreshableJob refreshableJob, CancellationToken cancellationToken) { 252 HiveServiceLocator.Instance.CallHiveService(service => { 253 HiveClient.StoreAsync( 254 new Action<Exception>((Exception ex) => { 255 //refreshableJob.ExecutionState = ExecutionState.Prepared; 256 exceptionCallback(ex); 257 }), refreshableJob.Job, cancellationToken); 258 }); 259 } 260 251 261 #region Upload Job 252 262 private Semaphore taskUploadSemaphore = new Semaphore(Settings.Default.MaxParallelUploads, Settings.Default.MaxParallelUploads);
Note: See TracChangeset
for help on using the changeset viewer.