- Timestamp:
- 03/22/11 15:54:58 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs
r5789 r5793 159 159 switch (container.Message) { 160 160 case MessageContainer.MessageType.CalculateJob: 161 clientCom.LogMessage("Task.StartNew[0]: jobId: " + container.JobId);162 161 Task.Factory.StartNew((jobIdObj) => { 163 162 Guid jobId = (Guid)jobIdObj; 164 clientCom.LogMessage("Task.StartNew[1]: jobId: " + jobId);165 163 Job job = wcfService.GetJob(jobId); 166 164 if (job == null) throw new JobNotFoundException(jobId); … … 217 215 218 216 private void DoPauseJob(Guid jobId) { 219 Job job = Jobs[jobId]; 220 221 if (job != null) { 222 engines[job.Id].Pause(); 223 JobData sJob = engines[job.Id].GetPausedJob(); 224 // job.Exception = engines[job.Id].CurrentException; // can there be an exception if a job is paused 225 job.ExecutionTime = engines[job.Id].ExecutionTime; 226 227 try { 228 clientCom.LogMessage("Sending the paused job with id: " + job.Id); 229 wcfService.UpdateJobData(job, sJob, ConfigManager.Instance.GetClientInfo().Id, JobState.Paused); 230 SlaveStatusInfo.JobsProcessed++; //TODO: count or not count, thats the question 231 } 232 catch (Exception e) { 233 clientCom.LogMessage("Transmitting to server failed. Storing the paused job with id: " + job.Id + " to hdd (" + e.ToString() + ")"); 234 } 235 finally { 236 KillAppDomain(job.Id); // kill app-domain in every case 237 } 238 } 239 } 240 241 private void DoStopJob(Guid guid) { 242 Job job = Jobs[guid]; 243 244 if (job != null) { 245 engines[job.Id].Stop(); 246 JobData sJob = engines[job.Id].GetFinishedJob(); 247 // job.Exception = engines[job.Id].CurrentException; // can there be an exception if a job is stopped regularly 248 job.ExecutionTime = engines[job.Id].ExecutionTime; 249 250 try { 251 clientCom.LogMessage("Sending the stoppped job with id: " + job.Id); 252 wcfService.UpdateJobData(job, sJob, ConfigManager.Instance.GetClientInfo().Id, JobState.Paused); 253 SlaveStatusInfo.JobsProcessed++; //TODO: count or not count, thats the question 254 } 255 catch (Exception e) { 256 clientCom.LogMessage("Transmitting to server failed. Storing the paused job with id: " + job.Id + " to hdd (" + e.ToString() + ")"); 257 } 258 finally { 259 KillAppDomain(job.Id); // kill app-domain in every case 217 if (!Jobs.ContainsKey(jobId)) { 218 clientCom.LogMessage("DoPauseJob: Can't find job with id " + jobId); 219 } else { 220 Job job = Jobs[jobId]; 221 222 if (job != null) { 223 engines[job.Id].Pause(); 224 JobData sJob = engines[job.Id].GetPausedJob(); 225 job.ExecutionTime = engines[job.Id].ExecutionTime; 226 227 try { 228 clientCom.LogMessage("Sending the paused job with id: " + job.Id); 229 wcfService.UpdateJobData(job, sJob, ConfigManager.Instance.GetClientInfo().Id, JobState.Paused); 230 SlaveStatusInfo.JobsProcessed++; //TODO: count or not count, thats the question 231 } 232 catch (Exception e) { 233 clientCom.LogMessage("Transmitting to server failed. Storing the paused job with id: " + job.Id + " to hdd (" + e.ToString() + ")"); 234 } 235 finally { 236 KillAppDomain(job.Id); // kill app-domain in every case 237 } 238 } 239 } 240 } 241 242 private void DoStopJob(Guid jobId) { 243 if (!Jobs.ContainsKey(jobId)) { 244 clientCom.LogMessage("DoStopJob: Can't find job with id " + jobId); 245 } else { 246 Job job = Jobs[jobId]; 247 248 if (job != null) { 249 engines[job.Id].Stop(); 250 JobData sJob = engines[job.Id].GetFinishedJob(); 251 job.ExecutionTime = engines[job.Id].ExecutionTime; 252 253 try { 254 clientCom.LogMessage("Sending the stoppped job with id: " + job.Id); 255 wcfService.UpdateJobData(job, sJob, ConfigManager.Instance.GetClientInfo().Id, JobState.Finished); 256 SlaveStatusInfo.JobsProcessed++; //TODO: count or not count, thats the question 257 } 258 catch (Exception e) { 259 clientCom.LogMessage("Transmitting to server failed. Storing the paused job with id: " + job.Id + " to hdd (" + e.ToString() + ")"); 260 } 261 finally { 262 KillAppDomain(job.Id); // kill app-domain in every case 263 } 260 264 } 261 265 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs
r5789 r5793 76 76 Job.Resume(childjobs.Select(j => PersistenceUtil.Deserialize<IJob>(j.Data))); 77 77 } else { 78 Job.Prepare();78 // Job.Prepare(); // do NOT prepare here, otherwise paused jobs get restarted 79 79 Job.Start(); 80 80 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/Administration/MenuItems/AdministrationMenuItem.cs
r5469 r5793 27 27 public class AdministrationMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider { 28 28 public override string Name { 29 get { return "& Administration"; }29 get { return "&Administration (dev)"; } 30 30 } 31 31 public override IEnumerable<string> Structure { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/HiveJobView.cs
r5779 r5793 71 71 } 72 72 73 void Content_OptimizerJobChanged(object sender, EventArgs e) {73 protected void Content_OptimizerJobChanged(object sender, EventArgs e) { 74 74 RegisterJobEvents(); 75 75 Job_OptimizerChanged(this, e); 76 76 } 77 77 78 void Job_OptimizerChanged(object sender, EventArgs e) {78 protected void Job_OptimizerChanged(object sender, EventArgs e) { 79 79 if (Content != null && Content.Job != null && Content.OptimizerJob.Optimizer != null) { 80 80 optimizerNamedItemView.Content = Content.OptimizerJob.Optimizer; … … 130 130 this.dateFinishedTextBox.Text = Content.Job.DateFinished.ToString(); 131 131 this.exceptionTextBox.Text = Content.Job.CurrentStateLog != null ? Content.Job.CurrentStateLog.Exception : string.Empty; 132 this.lastUpdatedTextBox.Text = Content.Job.LastJobDataUpdate.ToString(); 132 133 if (Content.OptimizerJob.ComputeInParallel) { 133 134 this.stateLogViewHost.Content = new StateLogListList( … … 144 145 this.exceptionTextBox.Text = string.Empty; 145 146 this.stateLogViewHost.Content = null; 147 this.lastUpdatedTextBox.Text = string.Empty; 146 148 } 147 149 SetEnabledStateOfControls(); … … 158 160 this.dateFinishedTextBox.ReadOnly = true; 159 161 this.exceptionTextBox.ReadOnly = true; 162 this.lastUpdatedTextBox.ReadOnly = true; 160 163 161 164 this.priorityTextBox.ReadOnly = this.ReadOnly; … … 167 170 this.pauseButton.Enabled = Content != null && Content.Job.State == JobState.Calculating; 168 171 this.stopButton.Enabled = Content != null && (Content.Job.State == JobState.Calculating || Content.Job.State == JobState.Waiting || Content.Job.State == JobState.Paused); 172 this.showOptimizerButton.Enabled = Content != null && Content.Job.State == JobState.Paused && Content.OptimizerJob != null && Content.OptimizerJob.Optimizer != null; 169 173 170 174 optimizerNamedItemView.ReadOnly = true; … … 204 208 Content.Stop(); 205 209 } 210 private void showOptimizerButton_Click(object sender, EventArgs e) { 211 MainFormManager.MainForm.ShowContent(Content.OptimizerJob.Optimizer); 212 } 206 213 } 207 214 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/HiveJobView.designer.cs
r5779 r5793 32 32 this.runCollectionViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 33 33 this.detailsTabPage = new System.Windows.Forms.TabPage(); 34 this.restartButton = new System.Windows.Forms.Button(); 35 this.pauseButton = new System.Windows.Forms.Button(); 36 this.stopButton = new System.Windows.Forms.Button(); 34 37 this.optimizerGroupBox = new System.Windows.Forms.GroupBox(); 38 this.showOptimizerButton = new System.Windows.Forms.Button(); 39 this.lastUpdatedTextBox = new System.Windows.Forms.TextBox(); 40 this.lastUpdatedLabel = new System.Windows.Forms.Label(); 35 41 this.optimizerNamedItemView = new HeuristicLab.Core.Views.NamedItemView(); 36 42 this.configurationGroupBox = new System.Windows.Forms.GroupBox(); … … 59 65 this.exceptionTextBox = new System.Windows.Forms.TextBox(); 60 66 this.tabControl = new System.Windows.Forms.TabControl(); 61 this.restartButton = new System.Windows.Forms.Button();62 this.pauseButton = new System.Windows.Forms.Button();63 this.stopButton = new System.Windows.Forms.Button();64 67 this.logTabPage.SuspendLayout(); 65 68 this.stateLogTabPage.SuspendLayout(); … … 78 81 this.logTabPage.Name = "logTabPage"; 79 82 this.logTabPage.Padding = new System.Windows.Forms.Padding(3); 80 this.logTabPage.Size = new System.Drawing.Size( 406, 492);83 this.logTabPage.Size = new System.Drawing.Size(611, 492); 81 84 this.logTabPage.TabIndex = 1; 82 85 this.logTabPage.Text = "Log"; … … 125 128 this.runsTabPage.Location = new System.Drawing.Point(4, 22); 126 129 this.runsTabPage.Name = "runsTabPage"; 127 this.runsTabPage.Size = new System.Drawing.Size( 406, 492);130 this.runsTabPage.Size = new System.Drawing.Size(611, 492); 128 131 this.runsTabPage.TabIndex = 4; 129 132 this.runsTabPage.Text = "Runs"; … … 164 167 this.detailsTabPage.UseVisualStyleBackColor = true; 165 168 // 169 // restartButton 170 // 171 this.restartButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 172 this.restartButton.Image = ((System.Drawing.Image)(resources.GetObject("restartButton.Image"))); 173 this.restartButton.Location = new System.Drawing.Point(3, 465); 174 this.restartButton.Name = "restartButton"; 175 this.restartButton.Size = new System.Drawing.Size(24, 24); 176 this.restartButton.TabIndex = 30; 177 this.restartButton.UseVisualStyleBackColor = true; 178 this.restartButton.Click += new System.EventHandler(this.restartButton_Click); 179 // 180 // pauseButton 181 // 182 this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 183 this.pauseButton.Enabled = false; 184 this.pauseButton.Image = ((System.Drawing.Image)(resources.GetObject("pauseButton.Image"))); 185 this.pauseButton.Location = new System.Drawing.Point(33, 465); 186 this.pauseButton.Name = "pauseButton"; 187 this.pauseButton.Size = new System.Drawing.Size(24, 24); 188 this.pauseButton.TabIndex = 31; 189 this.pauseButton.UseVisualStyleBackColor = true; 190 this.pauseButton.Click += new System.EventHandler(this.pauseButton_Click); 191 // 192 // stopButton 193 // 194 this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 195 this.stopButton.Image = ((System.Drawing.Image)(resources.GetObject("stopButton.Image"))); 196 this.stopButton.Location = new System.Drawing.Point(63, 465); 197 this.stopButton.Name = "stopButton"; 198 this.stopButton.Size = new System.Drawing.Size(24, 24); 199 this.stopButton.TabIndex = 32; 200 this.stopButton.UseVisualStyleBackColor = true; 201 this.stopButton.Click += new System.EventHandler(this.stopButton_Click); 202 // 166 203 // optimizerGroupBox 167 204 // 168 205 this.optimizerGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 169 206 | System.Windows.Forms.AnchorStyles.Right))); 207 this.optimizerGroupBox.Controls.Add(this.showOptimizerButton); 208 this.optimizerGroupBox.Controls.Add(this.lastUpdatedTextBox); 209 this.optimizerGroupBox.Controls.Add(this.lastUpdatedLabel); 170 210 this.optimizerGroupBox.Controls.Add(this.optimizerNamedItemView); 171 211 this.optimizerGroupBox.Location = new System.Drawing.Point(6, 29); 172 212 this.optimizerGroupBox.Name = "optimizerGroupBox"; 173 this.optimizerGroupBox.Size = new System.Drawing.Size(599, 74);213 this.optimizerGroupBox.Size = new System.Drawing.Size(599, 129); 174 214 this.optimizerGroupBox.TabIndex = 28; 175 215 this.optimizerGroupBox.TabStop = false; 176 216 this.optimizerGroupBox.Text = "Optimizer"; 217 // 218 // showOptimizerButton 219 // 220 this.showOptimizerButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 221 | System.Windows.Forms.AnchorStyles.Right))); 222 this.showOptimizerButton.Location = new System.Drawing.Point(12, 99); 223 this.showOptimizerButton.Name = "showOptimizerButton"; 224 this.showOptimizerButton.Size = new System.Drawing.Size(581, 23); 225 this.showOptimizerButton.TabIndex = 3; 226 this.showOptimizerButton.Text = "Show Optimizer"; 227 this.showOptimizerButton.UseVisualStyleBackColor = true; 228 this.showOptimizerButton.Click += new System.EventHandler(this.showOptimizerButton_Click); 229 // 230 // lastUpdatedTextBox 231 // 232 this.lastUpdatedTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 233 | System.Windows.Forms.AnchorStyles.Right))); 234 this.lastUpdatedTextBox.Location = new System.Drawing.Point(78, 73); 235 this.lastUpdatedTextBox.Name = "lastUpdatedTextBox"; 236 this.lastUpdatedTextBox.Size = new System.Drawing.Size(515, 20); 237 this.lastUpdatedTextBox.TabIndex = 2; 238 // 239 // lastUpdatedLabel 240 // 241 this.lastUpdatedLabel.AutoSize = true; 242 this.lastUpdatedLabel.Location = new System.Drawing.Point(9, 76); 243 this.lastUpdatedLabel.Name = "lastUpdatedLabel"; 244 this.lastUpdatedLabel.Size = new System.Drawing.Size(71, 13); 245 this.lastUpdatedLabel.TabIndex = 1; 246 this.lastUpdatedLabel.Text = "LastUpdated:"; 177 247 // 178 248 // optimizerNamedItemView … … 200 270 this.configurationGroupBox.Controls.Add(this.computeInParallelLabel); 201 271 this.configurationGroupBox.Controls.Add(this.computeInParallelCheckBox); 202 this.configurationGroupBox.Location = new System.Drawing.Point(6, 1 06);272 this.configurationGroupBox.Location = new System.Drawing.Point(6, 164); 203 273 this.configurationGroupBox.Name = "configurationGroupBox"; 204 274 this.configurationGroupBox.Size = new System.Drawing.Size(599, 119); … … 314 384 this.jobStatusGroupBox.Controls.Add(this.dateFinishedLabel); 315 385 this.jobStatusGroupBox.Controls.Add(this.exceptionTextBox); 316 this.jobStatusGroupBox.Location = new System.Drawing.Point(6, 2 26);386 this.jobStatusGroupBox.Location = new System.Drawing.Point(6, 289); 317 387 this.jobStatusGroupBox.Name = "jobStatusGroupBox"; 318 388 this.jobStatusGroupBox.Size = new System.Drawing.Size(599, 162); … … 444 514 this.tabControl.Size = new System.Drawing.Size(619, 518); 445 515 this.tabControl.TabIndex = 25; 446 //447 // restartButton448 //449 this.restartButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));450 this.restartButton.Image = ((System.Drawing.Image)(resources.GetObject("restartButton.Image")));451 this.restartButton.Location = new System.Drawing.Point(3, 465);452 this.restartButton.Name = "restartButton";453 this.restartButton.Size = new System.Drawing.Size(24, 24);454 this.restartButton.TabIndex = 30;455 this.restartButton.UseVisualStyleBackColor = true;456 this.restartButton.Click += new System.EventHandler(this.restartButton_Click);457 //458 // pauseButton459 //460 this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));461 this.pauseButton.Enabled = false;462 this.pauseButton.Image = ((System.Drawing.Image)(resources.GetObject("pauseButton.Image")));463 this.pauseButton.Location = new System.Drawing.Point(33, 465);464 this.pauseButton.Name = "pauseButton";465 this.pauseButton.Size = new System.Drawing.Size(24, 24);466 this.pauseButton.TabIndex = 31;467 this.pauseButton.UseVisualStyleBackColor = true;468 this.pauseButton.Click += new System.EventHandler(this.pauseButton_Click);469 //470 // stopButton471 //472 this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));473 this.stopButton.Image = ((System.Drawing.Image)(resources.GetObject("stopButton.Image")));474 this.stopButton.Location = new System.Drawing.Point(63, 465);475 this.stopButton.Name = "stopButton";476 this.stopButton.Size = new System.Drawing.Size(24, 24);477 this.stopButton.TabIndex = 32;478 this.stopButton.UseVisualStyleBackColor = true;479 this.stopButton.Click += new System.EventHandler(this.stopButton_Click);480 516 // 481 517 // HiveJobView … … 492 528 this.detailsTabPage.PerformLayout(); 493 529 this.optimizerGroupBox.ResumeLayout(false); 530 this.optimizerGroupBox.PerformLayout(); 494 531 this.configurationGroupBox.ResumeLayout(false); 495 532 this.configurationGroupBox.PerformLayout(); … … 525 562 private System.Windows.Forms.GroupBox jobStatusGroupBox; 526 563 private System.Windows.Forms.TextBox stateTextBox; 527 private System.Windows.Forms.Label dateCalculatedLabel;528 564 private System.Windows.Forms.Label stateLabel; 529 private System.Windows.Forms.TextBox dateCalculatedText;530 565 private System.Windows.Forms.TextBox dateFinishedTextBox; 531 566 private System.Windows.Forms.TextBox executionTimeTextBox; 532 private System.Windows.Forms.TextBox dateCreatedTextBox;533 567 private System.Windows.Forms.Label executionTimeLabel; 534 568 private System.Windows.Forms.Label exceptionLabel; 535 private System.Windows.Forms.Label dateCreatedLabel;536 569 private System.Windows.Forms.Label dateFinishedLabel; 537 570 private System.Windows.Forms.TextBox exceptionTextBox; … … 540 573 private System.Windows.Forms.Button pauseButton; 541 574 private System.Windows.Forms.Button stopButton; 575 private System.Windows.Forms.Button showOptimizerButton; 576 private System.Windows.Forms.TextBox lastUpdatedTextBox; 577 private System.Windows.Forms.Label lastUpdatedLabel; 578 private System.Windows.Forms.Label dateCalculatedLabel; 579 private System.Windows.Forms.TextBox dateCalculatedText; 580 private System.Windows.Forms.TextBox dateCreatedTextBox; 581 private System.Windows.Forms.Label dateCreatedLabel; 542 582 543 583 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/ItemTreeView.cs
r5779 r5793 52 52 item.ItemsRemoved -= new CollectionItemsChangedEventHandler<IItemTree>(item_ItemsRemoved); 53 53 item.CollectionReset -= new CollectionItemsChangedEventHandler<IItemTree>(item_CollectionReset); 54 item.ToStringChanged -= new System.EventHandler(item_ToStringChanged);54 item.ToStringChanged -= new EventHandler(item_ToStringChanged); 55 55 item.ItemImageChanged -= new EventHandler(item_ItemImageChanged); 56 56 foreach (TreeNode childNode in node.Nodes) { … … 70 70 item.ItemsRemoved += new CollectionItemsChangedEventHandler<IItemTree>(item_ItemsRemoved); 71 71 item.CollectionReset += new CollectionItemsChangedEventHandler<IItemTree>(item_CollectionReset); 72 item.ToStringChanged += new System.EventHandler(item_ToStringChanged);72 item.ToStringChanged += new EventHandler(item_ToStringChanged); 73 73 item.ItemImageChanged += new EventHandler(item_ItemImageChanged); 74 74 foreach (TreeNode childNode in node.Nodes) { … … 78 78 79 79 #region Event Handlers (Content) 80 // Put event handlers of the content here 80 private void item_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IItemTree> e) { 81 if (InvokeRequired) { 82 Invoke(new CollectionItemsChangedEventHandler<IItemTree>(item_ItemsAdded), sender, e); 83 } else { 84 TreeNode node = GetNodeByItem(sender as IItemTree); 85 foreach (IItemTree item in e.Items) { 86 AddChildNodes(item, node.Nodes, true); 87 node.ExpandAll(); 88 UpdateNodeItemImage(node); 89 } 90 } 91 } 92 93 private void item_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IItemTree> e) { 94 if (InvokeRequired) { 95 Invoke(new CollectionItemsChangedEventHandler<IItemTree>(item_ItemsRemoved), sender, e); 96 } else { 97 TreeNode node = GetNodeByItem(sender as IItemTree); 98 foreach (IItemTree item in e.Items) { 99 RemoveChildNodes(item, node.Nodes); 100 } 101 RebuildImageList(); 102 } 103 } 104 105 private void item_CollectionReset(object sender, CollectionItemsChangedEventArgs<IItemTree> e) { 106 if (InvokeRequired) { 107 Invoke(new CollectionItemsChangedEventHandler<IItemTree>(item_CollectionReset), sender, e); 108 } else { 109 TreeNode node = GetNodeByItem(sender as IItemTree); 110 foreach (IItemTree item in e.OldItems) { 111 RemoveChildNodes(item, node.Nodes); 112 } 113 RebuildImageList(); 114 foreach (IItemTree item in e.Items) { 115 AddChildNodes(item, node.Nodes, true); 116 } 117 } 118 } 119 120 private void item_ToStringChanged(object sender, EventArgs e) { 121 if (InvokeRequired) { 122 Invoke(new EventHandler(item_ToStringChanged), sender, e); 123 } else { 124 var item = sender as IItemTree; 125 TreeNode node = GetNodeByItem(item); 126 node.Text = item.ToString(); 127 } 128 } 129 130 private void item_ItemImageChanged(object sender, EventArgs e) { 131 if (InvokeRequired) { 132 Invoke(new EventHandler(item_ItemImageChanged), sender, e); 133 } else { 134 var item = sender as IItemTree; 135 TreeNode node = GetNodeByItem(item); 136 UpdateNodeItemImage(node); 137 } 138 } 139 140 private void treeView_DoubleClick(object sender, EventArgs e) { 141 if (InvokeRequired) { 142 Invoke(new EventHandler(treeView_DoubleClick), sender, e); 143 } else { 144 if (treeView.SelectedNode != null) { 145 var item = treeView.SelectedNode.Tag as IItemTree; 146 if (item != null) { 147 IContentView view = MainFormManager.MainForm.ShowContent(item); 148 if (view != null) { 149 view.ReadOnly = ReadOnly; 150 view.Locked = Locked; 151 } 152 } 153 } 154 } 155 } 81 156 #endregion 82 157 … … 86 161 // Add code when content has been changed and is null 87 162 ClearNodes(); 163 detailsViewHost.Content = null; 88 164 } else { 89 165 // Add code when content has been changed and is not null … … 122 198 treeNodeCollection.RemoveAt(idx); 123 199 } 124 125 private void item_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IItemTree> e) { 126 TreeNode node = GetNodeByItem(sender as IItemTree); 127 foreach (IItemTree item in e.Items) { 128 AddChildNodes(item, node.Nodes, true); 129 node.ExpandAll(); 130 UpdateNodeItemImage(node); 131 } 132 } 133 134 private void item_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IItemTree> e) { 135 TreeNode node = GetNodeByItem(sender as IItemTree); 136 foreach (IItemTree item in e.Items) { 137 RemoveChildNodes(item, node.Nodes); 138 } 139 RebuildImageList(); 140 } 141 142 private void item_CollectionReset(object sender, CollectionItemsChangedEventArgs<IItemTree> e) { 143 TreeNode node = GetNodeByItem(sender as IItemTree); 144 foreach (IItemTree item in e.OldItems) { 145 RemoveChildNodes(item, node.Nodes); 146 } 147 RebuildImageList(); 148 foreach (IItemTree item in e.Items) { 149 AddChildNodes(item, node.Nodes, true); 150 } 151 } 152 153 private void item_ToStringChanged(object sender, EventArgs e) { 154 var item = sender as IItemTree; 155 TreeNode node = GetNodeByItem(item); 156 node.Text = item.ToString(); 157 } 158 159 private void item_ItemImageChanged(object sender, EventArgs e) { 160 var item = sender as IItemTree; 161 TreeNode node = GetNodeByItem(item); 162 UpdateNodeItemImage(node); 163 } 164 200 165 201 private TreeNode GetNodeByItem(IItemTree item) { 166 202 TreeNode found = null; … … 212 248 // Put event handlers of child controls here. 213 249 private void treeView_AfterSelect(object sender, TreeViewEventArgs e) { 214 viewHost.Content = (IContent)treeView.SelectedNode.Tag;250 detailsViewHost.Content = (IContent)treeView.SelectedNode.Tag; 215 251 } 216 252 #endregion … … 232 268 } 233 269 } 234 235 private void treeView_DoubleClick(object sender, EventArgs e) {236 if (treeView.SelectedNode != null) {237 var item = treeView.SelectedNode.Tag as IItemTree;238 if (item != null) {239 IContentView view = MainFormManager.MainForm.ShowContent(item);240 if (view != null) {241 view.ReadOnly = ReadOnly;242 view.Locked = Locked;243 }244 }245 }246 }247 270 } 248 271 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/ItemTreeView.designer.cs
r5779 r5793 29 29 this.imageList = new System.Windows.Forms.ImageList(this.components); 30 30 this.detailsGroupBox = new System.Windows.Forms.GroupBox(); 31 this. viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();31 this.detailsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 32 32 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); 33 33 this.splitContainer.Panel1.SuspendLayout(); … … 77 77 // detailsGroupBox 78 78 // 79 this.detailsGroupBox.Controls.Add(this. viewHost);79 this.detailsGroupBox.Controls.Add(this.detailsViewHost); 80 80 this.detailsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; 81 81 this.detailsGroupBox.Location = new System.Drawing.Point(0, 0); … … 86 86 this.detailsGroupBox.Text = "Details"; 87 87 // 88 // viewHost88 // detailsViewHost 89 89 // 90 this. viewHost.Caption = "View";91 this. viewHost.Content = null;92 this. viewHost.Dock = System.Windows.Forms.DockStyle.Fill;93 this. viewHost.Enabled = false;94 this. viewHost.Location = new System.Drawing.Point(3, 16);95 this. viewHost.Name = "viewHost";96 this. viewHost.ReadOnly = false;97 this. viewHost.Size = new System.Drawing.Size(414, 444);98 this. viewHost.TabIndex = 0;99 this. viewHost.ViewsLabelVisible = true;100 this. viewHost.ViewType = null;90 this.detailsViewHost.Caption = "View"; 91 this.detailsViewHost.Content = null; 92 this.detailsViewHost.Dock = System.Windows.Forms.DockStyle.Fill; 93 this.detailsViewHost.Enabled = false; 94 this.detailsViewHost.Location = new System.Drawing.Point(3, 16); 95 this.detailsViewHost.Name = "detailsViewHost"; 96 this.detailsViewHost.ReadOnly = false; 97 this.detailsViewHost.Size = new System.Drawing.Size(414, 444); 98 this.detailsViewHost.TabIndex = 0; 99 this.detailsViewHost.ViewsLabelVisible = true; 100 this.detailsViewHost.ViewType = null; 101 101 // 102 102 // ItemTreeView … … 119 119 private System.Windows.Forms.SplitContainer splitContainer; 120 120 private System.Windows.Forms.TreeView treeView; 121 private MainForm.WindowsForms.ViewHost viewHost;121 private MainForm.WindowsForms.ViewHost detailsViewHost; 122 122 private System.Windows.Forms.ImageList imageList; 123 123 private System.Windows.Forms.GroupBox detailsGroupBox; -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/MenuItems/ExperimentManagerMenuItem.cs
r5512 r5793 27 27 public class ExperimentManagerMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider { 28 28 public override string Name { 29 get { return "&Experiment Manager 3.4"; }29 get { return "&Experiment Manager (dev)"; } 30 30 } 31 31 public override IEnumerable<string> Structure { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveExperimentClient.cs
r5786 r5793 495 495 jobResultPoller.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobResultPoller_ExceptionOccured); 496 496 jobResultPoller.JobResultsReceived += new EventHandler<EventArgs<IEnumerable<LightweightJob>>>(jobResultPoller_JobResultReceived); 497 jobResultPoller.PollingStarted += new EventHandler(jobResultPoller_PollingStarted);498 jobResultPoller.PollingFinished += new EventHandler(jobResultPoller_PollingFinished);499 497 jobResultPoller.IsPollingChanged += new EventHandler(jobResultPoller_IsPollingChanged); 500 498 } … … 502 500 jobResultPoller.ExceptionOccured -= new EventHandler<EventArgs<Exception>>(jobResultPoller_ExceptionOccured); 503 501 jobResultPoller.JobResultsReceived -= new EventHandler<EventArgs<IEnumerable<LightweightJob>>>(jobResultPoller_JobResultReceived); 504 jobResultPoller.PollingStarted -= new EventHandler(jobResultPoller_PollingStarted);505 jobResultPoller.PollingFinished -= new EventHandler(jobResultPoller_PollingFinished);506 502 jobResultPoller.IsPollingChanged -= new EventHandler(jobResultPoller_IsPollingChanged); 507 503 } 508 504 private void jobResultPoller_IsPollingChanged(object sender, EventArgs e) { 509 505 this.IsPollingResults = jobResultPoller.IsPolling; 510 }511 private void jobResultPoller_PollingFinished(object sender, EventArgs e) {512 LogMessage("Polling results finished");513 }514 private void jobResultPoller_PollingStarted(object sender, EventArgs e) {515 LogMessage("Polling results started");516 506 } 517 507 private void jobResultPoller_JobResultReceived(object sender, EventArgs<IEnumerable<LightweightJob>> e) { … … 527 517 OptimizerJob optimizerJob = LoadOptimizerJob(hj.Job.Id); 528 518 if (optimizerJob == null) { 529 // something bad happened to this job. set to finished to allow the rest beeing downloaded 530 //hj.IsFinishedOptimizerDownloaded = true; 519 // something bad happened to this job. bad job, BAAAD job! 531 520 } else { 532 521 // if the job is paused, download but don't integrate into parent optimizer (to avoid Prepare) 533 522 if (hj.Job.State == JobState.Paused) { 534 523 hj.OptimizerJob = optimizerJob; 535 524 } else { 536 525 if (lightweightJob.ParentJobId.HasValue) { 537 526 HiveJob parentHiveJob = HiveJob.GetHiveJobByJobId(lightweightJob.ParentJobId.Value); 538 527 parentHiveJob.UpdateChildOptimizer(optimizerJob, hj.Job.Id); 539 } else {540 //this.HiveJob.IsFinishedOptimizerDownloaded = true;541 528 } 542 529 } … … 554 541 555 542 private bool AllJobsFinished() { 556 //return HiveJob.GetAllHiveJobs().All(hj => hj.IsFinishedOptimizerDownloaded);557 543 return HiveJob.GetAllHiveJobs().All(j => j.Job.State == JobState.Finished 558 544 || j.Job.State == JobState.Aborted … … 623 609 this.HiveJob = allHiveJobs[this.rootJobId]; 624 610 625 626 //// download them first627 //IDictionary<Guid, Job> allJobs = new Dictionary<Guid, Job>();628 //IDictionary<Guid, JobData> allJobDatas = new Dictionary<Guid, JobData>();629 //foreach (LightweightJob lightweightJob in allResults) {630 // jobCount++;631 // progress.Status = string.Format("Downloading {0} of {1} jobs...", jobCount, totalJobCount);632 // allJobs.Add(lightweightJob.Id, service.GetJob(lightweightJob.Id));633 // allJobDatas.Add(lightweightJob.Id, service.GetJobData(lightweightJob.Id));634 // progress.ProgressValue = (double)jobCount / totalJobCount;635 //}636 637 //jobCount = 1;638 //progress.Status = string.Format("Deserializing {0} of {1} jobs... ({2} kb)", jobCount, totalJobCount, allJobDatas[this.rootJobId].Data.Count() / 1024);639 //this.HiveJob = new HiveJob(allJobs[this.rootJobId], allJobDatas[this.rootJobId], false);640 //allJobDatas.Remove(this.rootJobId); // reduce memory footprint641 //allJobs.Remove(this.rootJobId);642 //progress.ProgressValue = (double)jobCount / totalJobCount;643 644 645 611 if (this.HiveJob.Job.DateFinished.HasValue && this.HiveJob.Job.DateCreated.HasValue) { 646 612 this.ExecutionTime = this.HiveJob.Job.DateFinished.Value - this.HiveJob.Job.DateCreated.Value; … … 656 622 657 623 // build child-job tree 658 //LoadChildResults(service, this.HiveJob, allResults, allJobs, allJobDatas, progress, totalJobCount, ref jobCount);659 624 BuildHiveJobTree(this.HiveJob, allJobs, allHiveJobs); 660 625 StartResultPolling(); … … 739 704 return pluginDatas; 740 705 } 741 742 /// <summary>743 /// Gets the Ids of all plugins needed for executing the job.744 /// All loaded plugins are assumed to be necessary.745 /// If a plugin with the same name and version is already online, it is used. Otherwise the local plugin is uploaded.746 /// If useLocalPlugins is true, all local plugins are uploaded regardless of the existence of the same plugin online.747 /// </summary>748 //public static List<Guid> GetPluginsNeededIds(bool useLocalPlugins) {749 // IEnumerable<IPluginDescription> localPlugins = ApplicationManager.Manager.Plugins;750 // List<Guid> pluginsNeededIds = new List<Guid>();751 752 // using (var service = ServiceLocator.Instance.GetService()) {753 // IEnumerable<Plugin> onlinePlugins = service.Obj.GetPlugins();754 755 // foreach (IPluginDescription localPlugin in localPlugins) {756 // Plugin found = onlinePlugins.Where(onlinePlugin => onlinePlugin.Name == localPlugin.Name && onlinePlugin.Version == localPlugin.Version).SingleOrDefault();757 // if (!useLocalPlugins && found != null) {758 // // plugin is available online; reuse759 // pluginsNeededIds.Add(found.Id);760 // } else {761 // // upload the plugin762 // Plugin p = new Plugin() { Name = localPlugin.Name, Version = localPlugin.Version, IsLocal = useLocalPlugins };763 // List<PluginData> pluginDatas = new List<PluginData>();764 765 // foreach (IPluginFile pf in localPlugin.Files) {766 // PluginData pluginData = new PluginData();767 768 // pluginData.Data = File.ReadAllBytes(pf.Name);769 // pluginDatas.Add(pluginData);770 // }771 // pluginsNeededIds.Add(service.Obj.AddPlugin(p, pluginDatas));772 // }773 // }774 // }775 // return pluginsNeededIds;776 //}777 706 #endregion 778 707 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobClient.cs
r5786 r5793 70 70 public OptimizerJob OptimizerJob { 71 71 get { return optimizerJob; } 72 privateset {72 internal set { 73 73 if (optimizerJob != null && syncJobsWithOptimizers) { 74 74 this.childHiveJobs.Clear(); … … 289 289 syncJobsWithOptimizers = false; 290 290 if (this.OptimizerJob != null && hiveJob.OptimizerJob != null) { 291 // if job is in state Paused, it has to preserve its ResultCollection, which is cleared when a optimizer is added to an experiment 292 OptimizerJob optimizerJobClone = null; 293 if (hiveJob.Job.State == JobState.Paused) { 294 optimizerJobClone = (OptimizerJob)hiveJob.OptimizerJob.Clone(); 295 } 296 291 297 if (this.OptimizerJob.Optimizer is Optimization.Experiment) { 292 298 if (!this.OptimizerJob.OptimizerAsExperiment.Optimizers.Contains(hiveJob.OptimizerJob.Optimizer)) { … … 295 301 } else if (this.OptimizerJob.Optimizer is Optimization.BatchRun) { 296 302 UpdateOptimizerInBatchRun(this.OptimizerJob.OptimizerAsBatchRun, hiveJob.OptimizerJob); 303 } 304 305 if (hiveJob.Job.State == JobState.Paused) { 306 hiveJob.OptimizerJob = optimizerJobClone; 297 307 } 298 308 } … … 524 534 private void OnOptimizerJobChanged() { 525 535 OptimizerJob_ComputeInParallelChanged(this, EventArgs.Empty); 526 var handler = JobChanged;536 var handler = OptimizerJobChanged; 527 537 if (handler != null) handler(this, EventArgs.Empty); 528 538 } … … 649 659 650 660 public void Restart() { 651 ServiceLocator.Instance.CallHiveService(s => s.RestartJob(this.job.Id)); 661 ServiceLocator.Instance.CallHiveService(service => { 662 JobData jobData = new JobData(); 663 jobData.JobId = this.job.Id; 664 jobData.Data = PersistenceUtil.Serialize(this.optimizerJob); 665 service.UpdateJobData(this.Job, jobData); 666 service.RestartJob(this.job.Id); 667 Job job = service.GetJob(this.job.Id); 668 this.job.LastJobDataUpdate = job.LastJobDataUpdate; 669 }); 652 670 } 653 671 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobDownloader.cs
r5599 r5793 88 88 HiveJob hiveJob = new HiveJob(job, jobData, false); 89 89 jobData.Data = null; // reduce memory consumption. 90 hiveJob.OptimizerJob.Prepare(); // reduce memory consumption.91 90 hiveJob.Job = job; 92 91 return hiveJob; -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs
r5779 r5793 2 2 using System.Collections.Generic; 3 3 using System.Linq; 4 using System.Security.Permissions; 4 5 using System.ServiceModel; 5 6 using HeuristicLab.Services.Hive.Common; … … 32 33 33 34 #region Job Methods 34 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]35 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]35 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 36 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 36 37 public Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> resourceIds) { 37 38 return trans.UseTransaction(() => { … … 52 53 } 53 54 54 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]55 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]55 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 56 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 56 57 public Guid AddChildJob(Guid parentJobId, Job job, JobData jobData) { 57 58 return trans.UseTransaction(() => { … … 61 62 } 62 63 63 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]64 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]65 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]64 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 65 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 66 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 66 67 public Job GetJob(Guid jobId) { 67 68 return dao.GetJob(jobId); 68 69 } 69 70 70 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]71 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]71 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 72 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 72 73 public IEnumerable<Job> GetJobs() { 73 74 return dao.GetJobs(x => true); 74 75 } 75 76 76 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]77 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]77 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 78 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 78 79 public IEnumerable<LightweightJob> GetLightweightJobs(IEnumerable<Guid> jobIds) { 79 80 return dao.GetJobs(x => jobIds.Contains(x.JobId)).Select(x => new LightweightJob(x)).ToArray(); 80 81 } 81 82 82 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]83 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]83 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 84 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 84 85 public IEnumerable<LightweightJob> GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent) { 85 86 return GetChildJobs(parentJobId, recursive, includeParent).Select(x => new LightweightJob(x)).ToArray(); 86 87 } 87 88 88 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]89 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]90 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]89 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 90 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 91 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 91 92 public JobData GetJobData(Guid jobId) { 92 93 return dao.GetJobData(jobId); 93 94 } 94 95 95 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]96 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]97 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]96 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 97 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 98 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 98 99 public void UpdateJob(Job job) { 99 100 trans.UseTransaction(() => { … … 102 103 } 103 104 104 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]105 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]106 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]105 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 106 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 107 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 107 108 public void UpdateJobData(Job job, JobData jobData) { 108 109 trans.UseTransaction(() => { … … 113 114 } 114 115 115 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]116 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]117 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]116 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 117 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 118 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 118 119 public void DeleteJob(Guid jobId) { 119 120 trans.UseTransaction(() => { … … 122 123 } 123 124 124 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]125 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]126 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]125 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 126 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 127 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 127 128 public void DeleteChildJobs(Guid parentJobId) { 128 129 trans.UseTransaction(() => { … … 135 136 } 136 137 137 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]138 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]139 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]138 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 139 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 140 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 140 141 public Job UpdateJobState(Guid jobId, JobState jobState, Guid? slaveId, Guid? userId, string exception) { 141 142 return trans.UseTransaction(() => { … … 155 156 156 157 #region Job Control Methods 157 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]158 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]159 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]158 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 159 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 160 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 160 161 public void StopJob(Guid jobId) { 161 162 trans.UseTransaction(() => { … … 167 168 } 168 169 169 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]170 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]171 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]170 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 171 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 172 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 172 173 public void PauseJob(Guid jobId) { 173 174 trans.UseTransaction(() => { … … 179 180 } 180 181 181 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]182 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]183 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]182 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 183 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 184 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 184 185 public void RestartJob(Guid jobId) { 185 186 trans.UseTransaction(() => { … … 192 193 193 194 #region HiveExperiment Methods 194 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]195 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]195 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 196 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 196 197 public HiveExperiment GetHiveExperiment(Guid id) { 197 198 return dao.GetHiveExperiments(x => … … 201 202 } 202 203 203 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]204 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]204 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 205 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 205 206 public IEnumerable<HiveExperiment> GetHiveExperiments() { 206 207 return dao.GetHiveExperiments(x => x.OwnerUserId == auth.UserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != Permission.NotAllowed && hep.GrantedUserId == auth.UserId) > 0); 207 208 } 208 209 209 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]210 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 210 211 public IEnumerable<HiveExperiment> GetAllHiveExperiments() { 211 212 return dao.GetHiveExperiments(x => true); 212 213 } 213 214 214 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]215 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]215 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 216 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 216 217 public Guid AddHiveExperiment(HiveExperiment hiveExperimentDto) { 217 218 return trans.UseTransaction(() => { … … 222 223 } 223 224 224 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]225 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]225 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 226 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 226 227 public void UpdateHiveExperiment(HiveExperiment hiveExperimentDto) { 227 228 trans.UseTransaction(() => { … … 230 231 } 231 232 232 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]233 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]233 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 234 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 234 235 public void DeleteHiveExperiment(Guid hiveExperimentId) { 235 236 trans.UseTransaction(() => { … … 241 242 242 243 #region Login Methods 243 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]244 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 244 245 public void Hello(Slave slaveInfo) { 245 246 trans.UseTransaction(() => { … … 254 255 } 255 256 256 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]257 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 257 258 public void GoodBye(Guid slaveId) { 258 259 trans.UseTransaction(() => { … … 267 268 268 269 #region Heartbeat Methods 269 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]270 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 270 271 public List<MessageContainer> Heartbeat(Heartbeat heartbeat) { 271 272 TriggerLifecycle(false); … … 275 276 276 277 #region Plugin Methods 277 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]278 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]278 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 279 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 279 280 public Guid AddPlugin(Plugin plugin, List<PluginData> pluginDatas) { 280 281 return trans.UseTransaction(() => { … … 290 291 } 291 292 292 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]293 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]294 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]293 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 294 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 295 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 295 296 public IEnumerable<Plugin> GetPlugins() { 296 297 return dao.GetPlugins(x => x.IsLocal == false); 297 298 } 298 299 299 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]300 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]301 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]300 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 301 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 302 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 302 303 public IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds) { 303 304 List<PluginData> pluginDatas = new List<PluginData>(); … … 319 320 320 321 #region Slave Methods 321 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]322 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]322 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 323 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 323 324 public Guid AddSlave(Slave slave) { 324 325 return trans.UseTransaction(() => dao.AddSlave(slave)); 325 326 } 326 327 327 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]328 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]328 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 329 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 329 330 public Guid AddSlaveGroup(SlaveGroup slaveGroup) { 330 331 return trans.UseTransaction(() => dao.AddSlaveGroup(slaveGroup)); 331 332 } 332 333 333 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]334 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]334 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 335 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 335 336 public Slave GetSlave(Guid slaveId) { 336 337 return dao.GetSlave(slaveId); … … 341 342 } 342 343 343 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]344 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]344 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 345 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 345 346 public IEnumerable<Slave> GetSlaves() { 346 347 return dao.GetSlaves(x => true); 347 348 } 348 349 349 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]350 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]350 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 351 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 351 352 public IEnumerable<SlaveGroup> GetSlaveGroups() { 352 353 return dao.GetSlaveGroups(x => true); 353 354 } 354 355 355 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]356 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]356 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 357 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 357 358 public void UpdateSlave(Slave slave) { 358 359 trans.UseTransaction(() => { … … 361 362 } 362 363 363 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]364 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]364 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 365 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 365 366 public void UpdateSlaveGroup(SlaveGroup slaveGroup) { 366 367 trans.UseTransaction(() => { … … 369 370 } 370 371 371 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]372 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]372 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 373 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 373 374 public void DeleteSlave(Guid slaveId) { 374 375 trans.UseTransaction(() => { … … 377 378 } 378 379 379 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]380 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]380 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 381 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 381 382 public void DeleteSlaveGroup(Guid slaveGroupId) { 382 383 trans.UseTransaction(() => { … … 385 386 } 386 387 387 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]388 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]388 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 389 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 389 390 public void AddResourceToGroup(Guid slaveGroupId, Guid resourceId) { 390 391 trans.UseTransaction(() => { … … 395 396 } 396 397 397 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]398 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]398 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 399 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 399 400 public void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId) { 400 401 trans.UseTransaction(() => { … … 405 406 } 406 407 407 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]408 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]408 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 409 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 409 410 public Guid GetResourceId(string resourceName) { 410 411 return trans.UseTransaction(() => { … … 450 451 #region Appointment Methods 451 452 452 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]453 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 453 454 public Guid AddAppointment(Appointment appointment) { 454 455 return trans.UseTransaction(() => dao.AddAppointment(appointment)); 455 456 } 456 457 457 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]458 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 458 459 public void DeleteAppointment(Guid appointmentId) { 459 460 trans.UseTransaction(() => { … … 462 463 } 463 464 464 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]465 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 465 466 public void UpdateAppointment(Appointment appointment) { 466 467 trans.UseTransaction(() => { … … 469 470 } 470 471 471 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]472 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 472 473 public IEnumerable<Appointment> GetScheduleForResource(Guid resourceId) { 473 474 return trans.UseTransaction(() => dao.GetAppointments(x => x.ResourceId == resourceId));
Note: See TracChangeset
for help on using the changeset viewer.