Changeset 16235 for branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
- Timestamp:
- 10/18/18 14:07:32 (6 years ago)
- Location:
- branches/2931_OR-Tools_LP_MIP
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2931_OR-Tools_LP_MIP
- Property svn:mergeinfo changed
/branches/2916_IndexedDataTableSerialization (added) merged: 15918 /trunk merged: 16168-16169,16177,16179,16184-16187,16202-16209,16211,16213,16216,16218-16219,16221,16223-16224,16232
- Property svn:mergeinfo changed
-
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.JobManager
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Clients.Hive.JobManager merged: 16187,16202,16205,16209,16219
- Property svn:mergeinfo changed
-
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r16139 r16235 139 139 } 140 140 141 // project look up 141 142 if (Content.Job != null && Content.Job.ProjectId == Guid.Empty) { 143 projectNameTextBox.Text = string.Empty; 142 144 if (HiveClient.Instance != null && HiveClient.Instance.Projects != null && HiveClient.Instance.Projects.Count == 1) { 143 145 var p = HiveClient.Instance.Projects.FirstOrDefault(); … … 145 147 hiveResourceSelectorDialog = new HiveResourceSelectorDialog(Content.Job.Id, Content.Job.ProjectId); 146 148 Content.Job.ProjectId = p.Id; 147 Content.Job.ResourceIds = HiveClient.Instance.GetAvailableResourcesForProject(p.Id).Select(x => x.Id).ToList(); 149 var resources = HiveClient.Instance.GetAvailableResourcesForProject(p.Id).ToList(); 150 Content.Job.ResourceIds = resources.Select(x => x.Id).ToList(); 148 151 hiveResourceSelectorDialog.SelectedProjectId = Content.Job.ProjectId; 149 152 hiveResourceSelectorDialog.SelectedResourceIds = Content.Job.ResourceIds; 153 154 var cores = resources.Union(resources.SelectMany(x => HiveClient.Instance.GetAvailableResourceDescendants(x.Id))) 155 .OfType<Slave>() 156 .Distinct() 157 .Sum(x => x.Cores); 158 159 projectNameTextBox.Text = HiveClient.Instance.GetProjectAncestry(Content.Job.ProjectId); 160 projectNameTextBox.Text += " (" + (cores.HasValue ? cores.Value.ToString() : "0") + " cores)"; 150 161 } 151 162 } 152 } 153 154 155 nameTextBox.Text = Content.Job.Name; 156 descriptionTextBox.Text = Content.Job.Description; 157 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 158 refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically; 159 160 // project look up 161 if(Content.Job.ProjectId != null && Content.Job.ProjectId != Guid.Empty) { 162 if(selectedProject == null || selectedProject.Id != Content.Job.ProjectId) { 163 } else if (Content.Job != null && Content.Job.ProjectId != Guid.Empty) { 164 if (selectedProject == null || selectedProject.Id != Content.Job.ProjectId) { 163 165 selectedProject = GetProject(Content.Job.ProjectId); 164 if (selectedProject != null) { 165 projectNameTextBox.Text = selectedProject.Name; 166 } else { 167 projectNameTextBox.Text = string.Empty; 168 } 166 hiveResourceSelectorDialog = null; 169 167 } 168 169 if(hiveResourceSelectorDialog == null) 170 hiveResourceSelectorDialog = new HiveResourceSelectorDialog(Content.Job.Id, Content.Job.ProjectId); 171 172 if (selectedProject != null) { 173 projectNameTextBox.Text = HiveClient.Instance.GetProjectAncestry(selectedProject.Id); 174 } else { 175 projectNameTextBox.Text = string.Empty; 176 } 177 178 List<Resource> resources = null; 179 if (Content.Job.ResourceIds == null) 180 resources = HiveClient.Instance.GetAssignedResourcesForJob(Content.Job.Id).ToList(); 181 else 182 resources = HiveClient.Instance.Resources.Where(x => Content.Job.ResourceIds.Contains(x.Id)).ToList(); 183 184 Content.Job.ResourceIds = resources.Select(x => x.Id).ToList(); 185 hiveResourceSelectorDialog.SelectedResourceIds = Content.Job.ResourceIds; 186 187 var cores = resources.Union(resources.SelectMany(x => HiveClient.Instance.GetAvailableResourceDescendants(x.Id))) 188 .OfType<Slave>() 189 .Distinct() 190 .Sum(x => x.Cores); 191 192 projectNameTextBox.Text += " (" + (cores.HasValue ? cores.Value.ToString() : "0") + " cores)"; 193 170 194 } else { 171 195 selectedProject = null; … … 173 197 Content.Job.ResourceIds = null; 174 198 } 199 200 201 nameTextBox.Text = Content.Job.Name; 202 descriptionTextBox.Text = Content.Job.Description; 203 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 204 refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically; 175 205 176 206 logView.Content = Content.Log; … … 182 212 SuppressEvents = false; 183 213 } 184 hiveExperimentPermissionListView.Content = null; // has to be filled by refresh button214 hiveExperimentPermissionListView.Content = null; // has to be filled by refresh 185 215 Content_JobStatisticsChanged(this, EventArgs.Empty); 186 216 Content_HiveExperimentChanged(this, EventArgs.Empty); … … 400 430 if (hiveResourceSelectorDialog.ShowDialog(this) == DialogResult.OK) { 401 431 selectedProject = hiveResourceSelectorDialog.SelectedProject; 402 if(selectedProject != null) { 403 projectNameTextBox.Text = selectedProject.Name; 432 if(selectedProject != null) { 404 433 Content.Job.ProjectId = selectedProject.Id; 405 434 Content.Job.ResourceIds = hiveResourceSelectorDialog.SelectedResources.Select(x => x.Id).ToList(); 435 436 var cores = hiveResourceSelectorDialog.SelectedResources 437 .Union(hiveResourceSelectorDialog.SelectedResources 438 .SelectMany(x => HiveClient.Instance.GetAvailableResourceDescendants(x.Id))) 439 .OfType<Slave>() 440 .Distinct() 441 .Sum(x => x.Cores); 442 443 projectNameTextBox.Text = HiveClient.Instance.GetProjectAncestry(selectedProject.Id) + ""; 444 projectNameTextBox.Text += " (" + (cores.HasValue ? cores.Value.ToString() : "0") + " cores)"; 445 406 446 } else { 407 447 selectedProject = null; … … 501 541 } 502 542 503 private void updateButton_Click2(object sender, EventArgs e) {504 if (Content.ExecutionState == ExecutionState.Stopped) {505 MessageBox.Show("Job cannot be updated once it stopped.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);506 return;507 }508 509 HiveClient.UpdateJob(510 (Exception ex) => ErrorHandling.ShowErrorDialog(this, "Update failed.", ex),511 Content,512 new CancellationToken());513 UpdateSelectorDialog();514 }515 516 543 private void updateButton_Click(object sender, EventArgs e) { 517 544 if (Content.ExecutionState == ExecutionState.Stopped) { … … 556 583 } else { 557 584 startButton.Enabled = Content.IsControllable && Content.HiveTasks != null && Content.HiveTasks.Count > 0 558 && Content.Job.ProjectId != null && Content.Job.ProjectId !=Guid.Empty && Content.Job.ResourceIds != null && Content.Job.ResourceIds.Any()585 && Content.Job.ProjectId != Guid.Empty && Content.Job.ResourceIds != null && Content.Job.ResourceIds.Any() 559 586 && (Content.ExecutionState == ExecutionState.Prepared || Content.ExecutionState == ExecutionState.Paused) && !Content.IsProgressing; 560 587 pauseButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started && !Content.IsProgressing;
Note: See TracChangeset
for help on using the changeset viewer.