Changeset 16209 for trunk/HeuristicLab.Clients.Hive.Administrator/3.3/Views
- Timestamp:
- 10/03/18 15:06:21 (6 years ago)
- Location:
- trunk/HeuristicLab.Clients.Hive.Administrator/3.3/Views
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectJobsView.cs
r16208 r16209 44 44 private const string JOB_STATE = "State"; 45 45 private const string JOB_EXECUTIONSTATE = "Execution State"; 46 private const string JOB_EXECUTIONTIME = "Execution Time"; 46 47 private const string JOB_DESCRIPTION = "Description"; 47 48 private const string JOB_TASKCOUNT = "Tasks"; 49 private const string JOB_WAITINGTASKCOUNT = "Waiting"; 48 50 private const string JOB_CALCULATINGTASKCOUNT = "Calculating"; 49 51 private const string JOB_FINISHEDTASKCOUNT = "Finished"; … … 112 114 var jobs = GetSelectedJobs().ToList(); 113 115 if (jobs.Any()) { 114 115 // TODO: include isControllable?! 116 116 117 startButton.Enabled = jobs.All(x => 117 !x.IsProgressing && x.HiveTasks != null && x.HiveTasks.Count > 0118 && x.Job.ProjectId != null && x.Job.ProjectId != Guid.Empty&& x.Job.ResourceIds != null && x.Job.ResourceIds.Any()118 !x.IsProgressing && HiveAdminClient.Instance.Tasks.ContainsKey(x.Id) && HiveAdminClient.Instance.Tasks[x.Id].Count > 0 119 && x.Job.ProjectId != Guid.Empty //&& x.Job.ResourceIds != null && x.Job.ResourceIds.Any() 119 120 && (x.ExecutionState == ExecutionState.Prepared || x.ExecutionState == ExecutionState.Paused)); 120 121 pauseButton.Enabled = jobs.All(x => !x.IsProgressing && x.ExecutionState == ExecutionState.Started); … … 138 139 139 140 private void refreshButton_Click(object sender, EventArgs e) { 140 var task = System.Threading.Tasks.Task.Factory.StartNew(RefreshJobsAsync);141 141 progress.Start("Refreshing jobs..."); 142 142 SetEnabledStateOfControls(); 143 var task = System.Threading.Tasks.Task.Factory.StartNew(RefreshJobsAsync); 143 144 144 145 task.ContinueWith((t) => { 145 matrixView.DataGridView.ClearSelection(); 146 progress.Finish(); 147 SetEnabledStateOfControls(); 146 148 }); 147 149 } … … 157 159 MessageBoxIcon.Question); 158 160 159 if (result == DialogResult.Yes) { 161 if (result == DialogResult.Yes) { 162 progress.Start("Removing job(s)..."); 163 SetEnabledStateOfControls(); 160 164 var task = System.Threading.Tasks.Task.Factory.StartNew(RemoveJobsAsync, jobs); 161 progress.Start(); 162 SetEnabledStateOfControls(); 163 164 task.ContinueWith((t) => { 165 matrixView.DataGridView.ClearSelection(); 166 RefreshJobs(); 167 progress.Finish(); 165 166 task.ContinueWith((t) => { 167 RefreshJobs(); 168 progress.Finish(); 169 SetEnabledStateOfControls(); 168 170 }, TaskContinuationOptions.NotOnFaulted); 169 171 170 172 task.ContinueWith((t) => { 171 matrixView.DataGridView.ClearSelection();172 RefreshJobs();173 progress.Finish();174 MessageBox.Show("An error occured removing the job(s). " + t.Exception.Message, "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error);173 RefreshJobs(); 174 progress.Finish(); 175 SetEnabledStateOfControls(); 176 MessageBox.Show("An error occured removing the job(s).", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 175 177 }, TaskContinuationOptions.OnlyOnFaulted); 176 178 } … … 189 191 190 192 if (result == DialogResult.Yes) { 193 progress.Start("Resuming job(s)..."); 194 SetEnabledStateOfControls(); 191 195 var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeJobsAsync, jobs); 192 progress.Start(); 193 SetEnabledStateOfControls(); 194 195 task.ContinueWith((t) => { 196 matrixView.DataGridView.ClearSelection(); 197 RefreshJobs(); 198 progress.Finish(); 199 }); 200 201 task.ContinueWith((t) => { 202 matrixView.DataGridView.ClearSelection(); 203 RefreshJobs(); 204 progress.Finish(); 196 197 task.ContinueWith((t) => { 198 RefreshJobs(); 199 progress.Finish(); 200 SetEnabledStateOfControls(); 201 }, TaskContinuationOptions.NotOnFaulted); 202 203 task.ContinueWith((t) => { 204 RefreshJobs(); 205 progress.Finish(); 206 SetEnabledStateOfControls(); 205 207 MessageBox.Show("An error occured resuming the job(s).", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 206 208 }, TaskContinuationOptions.OnlyOnFaulted); … … 220 222 221 223 if (result == DialogResult.Yes) { 224 progress.Start("Pausing job(s)..."); 225 SetEnabledStateOfControls(); 222 226 var task = System.Threading.Tasks.Task.Factory.StartNew(PauseJobsAsync, jobs); 223 progress.Start(); 224 SetEnabledStateOfControls(); 225 226 task.ContinueWith((t) => { 227 matrixView.DataGridView.ClearSelection(); 228 RefreshJobs(); 229 progress.Finish(); 230 }); 231 232 task.ContinueWith((t) => { 233 matrixView.DataGridView.ClearSelection(); 234 RefreshJobs(); 235 progress.Finish(); 227 228 task.ContinueWith((t) => { 229 RefreshJobs(); 230 progress.Finish(); 231 SetEnabledStateOfControls(); 232 }, TaskContinuationOptions.NotOnFaulted); 233 234 task.ContinueWith((t) => { 235 RefreshJobs(); 236 progress.Finish(); 237 SetEnabledStateOfControls(); 236 238 MessageBox.Show("An error occured pausing the job(s).", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 237 239 }, TaskContinuationOptions.OnlyOnFaulted); … … 251 253 252 254 if (result == DialogResult.Yes) { 255 progress.Start("Stopping job(s)..."); 256 SetEnabledStateOfControls(); 253 257 var task = System.Threading.Tasks.Task.Factory.StartNew(StopJobsAsync, jobs); 254 progress.Start(); 255 SetEnabledStateOfControls(); 256 257 task.ContinueWith((t) => { 258 matrixView.DataGridView.ClearSelection(); 259 RefreshJobs(); 260 progress.Finish(); 261 }); 262 263 task.ContinueWith((t) => { 264 matrixView.DataGridView.ClearSelection(); 265 RefreshJobs(); 266 progress.Finish(); 258 259 task.ContinueWith((t) => { 260 RefreshJobs(); 261 progress.Finish(); 262 SetEnabledStateOfControls(); 263 }, TaskContinuationOptions.NotOnFaulted); 264 265 task.ContinueWith((t) => { 266 RefreshJobs(); 267 progress.Finish(); 268 SetEnabledStateOfControls(); 267 269 MessageBox.Show("An error occured stopping the job(s).", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 268 270 }, TaskContinuationOptions.OnlyOnFaulted); … … 287 289 foreach (DataGridViewRow r in matrixView.DataGridView.SelectedRows) { 288 290 if (((string)r.Cells[0].Value) == JobState.Online.ToString()) { 289 jobs.Add(HiveAdminClient.Instance.Jobs[Content.Id].FirstOrDefault(x => x.Id == Guid.Parse((string) r.Cells[ 9].Value)));291 jobs.Add(HiveAdminClient.Instance.Jobs[Content.Id].FirstOrDefault(x => x.Id == Guid.Parse((string) r.Cells[11].Value))); 290 292 } 291 293 } … … 306 308 var jobs = HiveAdminClient.Instance.Jobs[Content.Id]; 307 309 var resources = HiveAdminClient.Instance.Resources; 308 string[,] values = new string[jobs.Count, 1 1];310 string[,] values = new string[jobs.Count, 13]; 309 311 310 312 for(int i = 0; i < jobs.Count; i++) { … … 312 314 values[i, 0] = job.Job.State.ToString(); 313 315 values[i, 1] = job.ExecutionState.ToString(); 314 values[i, 2] = job.Job.DateCreated.ToString(); 315 values[i, 3] = job.Job.OwnerUsername; 316 values[i, 4] = job.Job.Name; 317 values[i, 5] = job.Job.JobCount.ToString(); 318 values[i, 6] = job.Job.CalculatingCount.ToString(); 319 values[i, 7] = job.Job.FinishedCount.ToString(); 320 values[i, 8] = job.Job.Description; 321 values[i, 9] = job.Job.Id.ToString(); 322 values[i, 10] = job.Job.OwnerUserId.ToString(); 316 values[i, 2] = job.ExecutionTime.ToString(); 317 values[i, 3] = job.Job.DateCreated.ToString(); 318 values[i, 4] = job.Job.OwnerUsername; 319 values[i, 5] = job.Job.Name; 320 values[i, 6] = job.Job.JobCount.ToString(); 321 values[i, 7] = (job.Job.JobCount - job.Job.CalculatingCount - job.Job.FinishedCount).ToString(); 322 values[i, 8] = job.Job.CalculatingCount.ToString(); 323 values[i, 9] = job.Job.FinishedCount.ToString(); 324 values[i, 10] = job.Job.Description; 325 values[i, 11] = job.Job.Id.ToString(); 326 values[i, 12] = job.Job.OwnerUserId.ToString(); 323 327 } 324 328 325 329 var matrix = new StringMatrix(values); 326 matrix.ColumnNames = new string[] { JOB_STATE, JOB_EXECUTIONSTATE, JOB_ DATECREATED, JOB_OWNER, JOB_NAME, JOB_TASKCOUNT, JOB_CALCULATINGTASKCOUNT, JOB_FINISHEDTASKCOUNT, JOB_DESCRIPTION, JOB_ID, JOB_OWNERID };330 matrix.ColumnNames = new string[] { JOB_STATE, JOB_EXECUTIONSTATE, JOB_EXECUTIONTIME, JOB_DATECREATED, JOB_OWNER, JOB_NAME, JOB_TASKCOUNT, JOB_WAITINGTASKCOUNT, JOB_CALCULATINGTASKCOUNT, JOB_FINISHEDTASKCOUNT, JOB_DESCRIPTION, JOB_ID, JOB_OWNERID }; 327 331 matrix.SortableView = true; 328 332 return matrix; … … 356 360 357 361 private void RefreshJobsAsync() { 358 RefreshJobs(); 362 HiveAdminClient.Instance.RefreshJobs(); 363 UpdateJobs(); 359 364 } 360 365 … … 387 392 progress.Start(); 388 393 foreach (var job in jobList) { 389 progress.Status = " Deleting job \"" + job.Job.Name + "\"...";394 progress.Status = "Removing job \"" + job.Job.Name + "\"..."; 390 395 HiveAdminClient.RemoveJob(job); 391 396 } -
trunk/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs
r16185 r16209 318 318 319 319 private void treeSlaveGroup_BeforeCheck(object sender, TreeViewCancelEventArgs e) { 320 if ( e.Node == ungroupedGroupNode) {320 if (!IsAdmin() || e.Node == ungroupedGroupNode) { 321 321 e.Cancel = true; 322 322 } else {
Note: See TracChangeset
for help on using the changeset viewer.