- Timestamp:
- 12/20/11 13:54:57 (13 years ago)
- Location:
- branches/HeuristicLab.Hive.Azure
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive.Azure
- Property svn:ignore
-
old new 4 4 *.suo 5 5 *.vsp 6 Doxygen 6 7 Google.ProtocolBuffers-0.9.1.dll 7 8 HeuristicLab 3.3.5.1.ReSharper.user 8 9 HeuristicLab 3.3.6.0.ReSharper.user 9 10 HeuristicLab.4.5.resharper.user 11 HeuristicLab.ExtLibs.6.0.ReSharper.user 10 12 HeuristicLab.resharper.user 11 13 ProtoGen.exe … … 16 18 bin 17 19 protoc.exe 18 HeuristicLab.ExtLibs.6.0.ReSharper.user19 Doxygen
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/JobManagerMenuItem.cs
r6976 r7215 25 25 26 26 namespace HeuristicLab.Optimizer.MenuItems { 27 public class ExperimentManagerMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {27 public class JobManagerMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider { 28 28 public override string Name { 29 29 get { return "&Job Manager"; } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobManagerView.Designer.cs
r6976 r7215 79 79 this.Controls.Add(this.refreshButton); 80 80 this.Controls.Add(this.hiveExperimentListView); 81 this.Name = " HiveExperimentManagerView";81 this.Name = "JobManagerView"; 82 82 this.Size = new System.Drawing.Size(735, 524); 83 83 this.ResumeLayout(false); -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionListView.cs
r6976 r7215 22 22 using System; 23 23 using System.Windows.Forms; 24 using HeuristicLab.Collections; 24 25 using HeuristicLab.Core.Views; 25 26 using HeuristicLab.MainForm; … … 44 45 return new JobPermission() { JobId = this.hiveExperimentId }; 45 46 } 47 48 protected override void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<JobPermission> e) { 49 base.Content_ItemsRemoved(sender, e); 50 foreach (var item in e.Items) { 51 if (item.GrantedUserId != Guid.Empty) { 52 HiveClient.Delete(item); 53 } 54 } 55 } 46 56 } 47 57 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.cs
r6976 r7215 48 48 49 49 protected override RefreshableJob CreateItem() { 50 return new RefreshableJob() { IsAllowedPrivileged = HiveClient.Instance.IsAllowedPrivileged }; 50 var refreshableJob = new RefreshableJob() { IsAllowedPrivileged = HiveClient.Instance.IsAllowedPrivileged }; 51 refreshableJob.Job.Name = "New Hive Job"; 52 return refreshableJob; 51 53 } 52 54 53 55 protected override void removeButton_Click(object sender, EventArgs e) { 54 DialogResult result = MessageBox.Show("This action will permanently delete this job (also on the hive server). Continue?", " Delete Job", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);56 DialogResult result = MessageBox.Show("This action will permanently delete this job (also on the hive server). Continue?", "HeuristicLab Hive Job Manager", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); 55 57 if (result == DialogResult.OK) { 56 58 base.removeButton_Click(sender, e); … … 59 61 60 62 protected override void Content_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<RefreshableJob> e) { 61 base.Content_ItemsAdded(sender, e); 62 foreach (ColumnHeader c in this.itemsListView.Columns) { 63 c.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); 63 if (InvokeRequired) { 64 Invoke(new CollectionItemsChangedEventHandler<RefreshableJob>(Content_ItemsAdded), sender, e); 65 } else { 66 base.Content_ItemsAdded(sender, e); 67 foreach (ColumnHeader c in this.itemsListView.Columns) { 68 c.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); 69 } 70 foreach (var item in e.Items) { 71 item.ItemImageChanged += new EventHandler(item_ItemImageChanged); 72 } 73 } 74 } 75 76 void item_ItemImageChanged(object sender, EventArgs e) { 77 if (this.itemsListView.InvokeRequired) { 78 Invoke(new EventHandler(item_ItemImageChanged), sender, e); 79 } else { 80 RefreshableJob job = sender as RefreshableJob; 81 if (job != null) { 82 foreach (ListViewItem item in this.itemsListView.Items) { 83 if (item.Tag != null) { 84 RefreshableJob cur = item.Tag as RefreshableJob; 85 if (cur != null && cur == job) { 86 this.UpdateListViewItemImage(item); 87 } 88 } 89 } 90 } 64 91 } 65 92 } 66 93 67 94 protected override void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<RefreshableJob> e) { 68 base.Content_ItemsRemoved(sender, e); 69 if (Content != null && Content.Count == 0) { 70 foreach (ColumnHeader c in this.itemsListView.Columns) { 71 c.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); 95 if (InvokeRequired) { 96 Invoke(new CollectionItemsChangedEventHandler<RefreshableJob>(Content_ItemsRemoved), sender, e); 97 } else { 98 base.Content_ItemsRemoved(sender, e); 99 foreach (var item in e.Items) { 100 item.ItemImageChanged -= new EventHandler(item_ItemImageChanged); 101 } 102 if (Content != null && Content.Count == 0) { 103 foreach (ColumnHeader c in this.itemsListView.Columns) { 104 c.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); 105 } 72 106 } 73 107 } … … 92 126 } 93 127 128 //drag'n'drop is not supported 129 protected override void itemsListView_ItemDrag(object sender, ItemDragEventArgs e) { } 130 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { } 131 protected override void itemsListView_DragOver(object sender, DragEventArgs e) { } 132 protected override void itemsListView_DragDrop(object sender, DragEventArgs e) { } 133 94 134 private ListViewGroup GetListViewGroup(string groupName) { 95 135 foreach (ListViewGroup group in itemsListView.Groups) { -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.Designer.cs
r6976 r7215 28 28 this.tabControl = new System.Windows.Forms.TabControl(); 29 29 this.tasksTabPage = new System.Windows.Forms.TabPage(); 30 this.jobsTreeView = new HeuristicLab.Clients.Hive.Views. ExperimentManager.HiveTaskItemTreeView();30 this.jobsTreeView = new HeuristicLab.Clients.Hive.Views.HiveTaskItemTreeView(); 31 31 this.permissionTabPage = new System.Windows.Forms.TabPage(); 32 32 this.refreshPermissionsButton = new System.Windows.Forms.Button(); 33 33 this.hiveExperimentPermissionListView = new HeuristicLab.Clients.Hive.JobManager.Views.HiveJobPermissionListView(); 34 34 this.runsTabPage = new System.Windows.Forms.TabPage(); 35 this.runCollectionViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 35 36 this.stateTabPage = new System.Windows.Forms.TabPage(); 36 37 this.stateLogViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); … … 58 59 this.calculatingLabel = new System.Windows.Forms.Label(); 59 60 this.jobsLabel = new System.Windows.Forms.Label(); 60 this.runCollectionViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();61 61 this.tabControl.SuspendLayout(); 62 62 this.tasksTabPage.SuspendLayout(); … … 107 107 this.jobsTreeView.ReadOnly = false; 108 108 this.jobsTreeView.Size = new System.Drawing.Size(704, 420); 109 this.jobsTreeView.TabIndex = 0;109 this.jobsTreeView.TabIndex = 4; 110 110 this.jobsTreeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.jobsTreeView_DragDrop); 111 111 this.jobsTreeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.jobsTreeView_DragEnter); … … 159 159 this.runsTabPage.Text = "Runs"; 160 160 this.runsTabPage.UseVisualStyleBackColor = true; 161 // 162 // runCollectionViewHost 163 // 164 this.runCollectionViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 165 | System.Windows.Forms.AnchorStyles.Left) 166 | System.Windows.Forms.AnchorStyles.Right))); 167 this.runCollectionViewHost.Caption = "View"; 168 this.runCollectionViewHost.Content = null; 169 this.runCollectionViewHost.Enabled = false; 170 this.runCollectionViewHost.Location = new System.Drawing.Point(3, 3); 171 this.runCollectionViewHost.Name = "runCollectionViewHost"; 172 this.runCollectionViewHost.ReadOnly = false; 173 this.runCollectionViewHost.Size = new System.Drawing.Size(703, 420); 174 this.runCollectionViewHost.TabIndex = 2; 175 this.runCollectionViewHost.ViewsLabelVisible = true; 176 this.runCollectionViewHost.ViewType = null; 161 177 // 162 178 // stateTabPage … … 294 310 this.resourceNamesTextBox.Name = "resourceNamesTextBox"; 295 311 this.resourceNamesTextBox.Size = new System.Drawing.Size(415, 20); 296 this.resourceNamesTextBox.TabIndex = 14;312 this.resourceNamesTextBox.TabIndex = 2; 297 313 this.resourceNamesTextBox.Validated += new System.EventHandler(this.resourceNamesTextBox_Validated); 298 314 // … … 313 329 this.nameTextBox.Name = "nameTextBox"; 314 330 this.nameTextBox.Size = new System.Drawing.Size(501, 20); 315 this.nameTextBox.TabIndex = 21;331 this.nameTextBox.TabIndex = 1; 316 332 this.nameTextBox.Validated += new System.EventHandler(this.nameTextBox_Validated); 317 333 // … … 334 350 this.isPrivilegedCheckBox.Name = "isPrivilegedCheckBox"; 335 351 this.isPrivilegedCheckBox.Size = new System.Drawing.Size(72, 17); 336 this.isPrivilegedCheckBox.TabIndex = 26;352 this.isPrivilegedCheckBox.TabIndex = 3; 337 353 this.isPrivilegedCheckBox.Text = "Privileged"; 338 354 this.toolTip.SetToolTip(this.isPrivilegedCheckBox, "If checked, the task will be executed in a privileged sandbox on the slave."); … … 420 436 this.jobsLabel.TabIndex = 0; 421 437 this.jobsLabel.Text = "Waiting:"; 422 //423 // runCollectionViewHost424 //425 this.runCollectionViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)426 | System.Windows.Forms.AnchorStyles.Left)427 | System.Windows.Forms.AnchorStyles.Right)));428 this.runCollectionViewHost.Caption = "View";429 this.runCollectionViewHost.Content = null;430 this.runCollectionViewHost.Enabled = false;431 this.runCollectionViewHost.Location = new System.Drawing.Point(3, 3);432 this.runCollectionViewHost.Name = "runCollectionViewHost";433 this.runCollectionViewHost.ReadOnly = false;434 this.runCollectionViewHost.Size = new System.Drawing.Size(703, 420);435 this.runCollectionViewHost.TabIndex = 2;436 this.runCollectionViewHost.ViewsLabelVisible = true;437 this.runCollectionViewHost.ViewType = null;438 438 // 439 439 // RefreshableHiveJobView … … 484 484 private Core.Views.LogView logView; 485 485 private System.Windows.Forms.TabPage tasksTabPage; 486 private HeuristicLab.Clients.Hive.Views. ExperimentManager.HiveTaskItemTreeView jobsTreeView;486 private HeuristicLab.Clients.Hive.Views.HiveTaskItemTreeView jobsTreeView; 487 487 private System.Windows.Forms.Label nameLabel; 488 488 private System.Windows.Forms.TextBox nameTextBox; -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r6976 r7215 24 24 using System.Linq; 25 25 using System.Threading; 26 using System.Threading.Tasks; 26 27 using System.Windows.Forms; 27 28 using HeuristicLab.Clients.Hive.Views; … … 301 302 } 302 303 private void Content_ExceptionOccured(object sender, EventArgs<Exception> e) { 303 // don't show exception, it is logged anyway304 throw e.Value; 304 305 } 305 306 private void Content_StateLogListChanged(object sender, EventArgs e) { … … 317 318 } 318 319 } 319 320 320 321 321 private void UpdateStateLogList() { … … 334 334 #region Control events 335 335 private void startButton_Click(object sender, EventArgs e) { 336 HiveClient.StartJob((Exception ex) => ErrorHandling.ShowErrorDialog(this, "Start failed.", ex), Content, new CancellationToken()); 337 } 336 if (nameTextBox.Text.Trim() == string.Empty) { 337 MessageBox.Show("Please enter a name for the job before uploading it!", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); 338 } else if (Content.ExecutionState == ExecutionState.Paused) { 339 var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeJobAsync, Content); 340 task.ContinueWith((t) => { 341 FinishProgressView(); 342 MessageBox.Show("An error occured resuming the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 343 Content.Log.LogException(t.Exception); 344 }, TaskContinuationOptions.OnlyOnFaulted); 345 } else { 346 HiveClient.StartJob((Exception ex) => ErrorHandling.ShowErrorDialog(this, "Start failed.", ex), Content, new CancellationToken()); 347 } 348 } 349 338 350 private void pauseButton_Click(object sender, EventArgs e) { 339 HiveClient.PauseJob(Content); 340 } 351 var task = System.Threading.Tasks.Task.Factory.StartNew(PauseJobAsync, Content); 352 task.ContinueWith((t) => { 353 FinishProgressView(); 354 MessageBox.Show("An error occured pausing the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 355 Content.Log.LogException(t.Exception); 356 }, TaskContinuationOptions.OnlyOnFaulted); 357 } 358 341 359 private void stopButton_Click(object sender, EventArgs e) { 342 HiveClient.StopJob(Content); 360 var task = System.Threading.Tasks.Task.Factory.StartNew(StopJobAsync, Content); 361 task.ContinueWith((t) => { 362 FinishProgressView(); 363 MessageBox.Show("An error occured stopping the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 364 Content.Log.LogException(t.Exception); 365 }, TaskContinuationOptions.OnlyOnFaulted); 343 366 } 344 367 private void resetButton_Click(object sender, EventArgs e) { } 368 369 private void PauseJobAsync(object job) { 370 IProgress prog = new Progress(); 371 prog.Status = "Pausing job..."; 372 SetProgressView(prog); 373 HiveClient.PauseJob((RefreshableJob)job); 374 FinishProgressView(); 375 } 376 377 private void StopJobAsync(object job) { 378 IProgress prog = new Progress(); 379 prog.Status = "Stopping job..."; 380 SetProgressView(prog); 381 HiveClient.StopJob((RefreshableJob)job); 382 FinishProgressView(); 383 } 384 385 private void ResumeJobAsync(object job) { 386 IProgress prog = new Progress(); 387 prog.Status = "Resuming job..."; 388 SetProgressView(prog); 389 HiveClient.ResumeJob((RefreshableJob)job); 390 FinishProgressView(); 391 } 345 392 346 393 private void nameTextBox_Validated(object sender, EventArgs e) { … … 375 422 376 423 private void refreshPermissionsButton_Click(object sender, EventArgs e) { 377 hiveExperimentPermissionListView.Content = HiveClient.GetJobPermissions(this.Content.Job.Id); 378 } 379 380 424 if (this.Content.Job.Id == Guid.Empty) { 425 MessageBox.Show("You have to upload the Job first before you can share it.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); 426 } else { 427 hiveExperimentPermissionListView.Content = HiveClient.GetJobPermissions(this.Content.Job.Id); 428 } 429 } 381 430 #endregion 382 431 … … 386 435 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false; 387 436 } else { 388 startButton.Enabled = Content.IsControllable && Content.HiveTasks != null && Content.HiveTasks.Count > 0 && Content.ExecutionState == ExecutionState.Prepared;437 startButton.Enabled = Content.IsControllable && Content.HiveTasks != null && Content.HiveTasks.Count > 0 && (Content.ExecutionState == ExecutionState.Prepared || Content.ExecutionState == ExecutionState.Paused); 389 438 pauseButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started; 390 439 stopButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started; … … 408 457 409 458 private void SetProgressView() { 410 if (progressView == null) { 411 progressView = new ProgressView(this, Content.Progress); 412 } 413 progressView.Progress = Content.Progress; 459 if (InvokeRequired) { 460 Invoke(new Action(SetProgressView)); 461 } else { 462 if (progressView == null) { 463 progressView = new ProgressView(this, Content.Progress); 464 } else { 465 progressView.Progress = Content.Progress; 466 } 467 } 468 } 469 470 private void SetProgressView(IProgress progress) { 471 if (InvokeRequired) { 472 Invoke(new Action<IProgress>(SetProgressView), progress); 473 } else { 474 if (progressView == null) { 475 progressView = new ProgressView(this, progress); 476 } else { 477 progressView.Progress = progress; 478 } 479 } 414 480 } 415 481 416 482 private void FinishProgressView() { 417 if (progressView != null) { 418 progressView.Finish(); 419 progressView = null; 420 SetEnabledStateOfControls(); 483 if (InvokeRequired) { 484 Invoke(new Action(FinishProgressView)); 485 } else { 486 if (progressView != null) { 487 progressView.Finish(); 488 progressView = null; 489 SetEnabledStateOfControls(); 490 } 421 491 } 422 492 } … … 432 502 var obj = e.Data.GetData(Constants.DragDropDataFormat); 433 503 if (obj is IOptimizer) { 434 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key 504 if (Content.Id != Guid.Empty) e.Effect = DragDropEffects.None; 505 else if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key 435 506 else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy; 436 507 } … … 443 514 var optimizer = obj as IOptimizer; 444 515 if (optimizer != null) { 445 Content.HiveTasks.Add(new OptimizerHiveTask(e.Effect.HasFlag(DragDropEffects.Copy) ? (IOptimizer)optimizer.Clone() : optimizer)); 516 IOptimizer newOptimizer = null; 517 if (e.Effect.HasFlag(DragDropEffects.Copy)) { 518 newOptimizer = (IOptimizer)optimizer.Clone(); 519 } else { 520 newOptimizer = optimizer; 521 } 522 if (newOptimizer.ExecutionState != ExecutionState.Prepared) { 523 newOptimizer.Prepare(); 524 } 525 526 Content.HiveTasks.Add(new OptimizerHiveTask(newOptimizer)); 446 527 } 447 528 } … … 452 533 if (tabControl.SelectedTab == permissionTabPage) { 453 534 if (!Content.IsSharable) { 454 MessageBox.Show("Unable to load tab. You have insufficient access privileges.");535 MessageBox.Show("Unable to load permissions. You have insufficient access privileges.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); 455 536 tabControl.SelectedTab = tasksTabPage; 456 537 }
Note: See TracChangeset
for help on using the changeset viewer.