Changeset 6381 for branches/HeuristicLab.Hive-3.4
- Timestamp:
- 06/08/11 00:04:16 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 7 added
- 6 deleted
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Administration/3.4
-
Property
svn:ignore
set to
bin
obj
HeuristicLab.Clients.Hive.Administration-3.4.csproj.user
HeuristicLab.Clients.Hive.Administration-3.4.csproj.vs10x
HeuristicLabClientsHiveAdministrationPlugin.cs
-
Property
svn:ignore
set to
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4
-
Property
svn:ignore
set to
bin
HeuristicLab.Clients.Hive.ExperimentManager-3.4.csproj.user
HeuristicLab.Clients.Hive.ExperimentManager-3.4.csproj.vs10x
HeuristicLabClientsHiveExperimentManagerPlugin.cs
obj
-
Property
svn:ignore
set to
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/HeuristicLab.Clients.Hive.ExperimentManager-3.4.csproj
r6373 r6381 151 151 </ItemGroup> 152 152 <ItemGroup> 153 <Compile Include="Views\ HiveExperimentListView.cs">153 <Compile Include="Views\RefreshableHiveExperimentListView.cs"> 154 154 <SubType>UserControl</SubType> 155 155 </Compile> 156 <Compile Include="Views\ HiveExperimentListView.Designer.cs">157 <DependentUpon> HiveExperimentListView.cs</DependentUpon>156 <Compile Include="Views\RefreshableHiveExperimentListView.Designer.cs"> 157 <DependentUpon>RefreshableHiveExperimentListView.cs</DependentUpon> 158 158 </Compile> 159 159 <Compile Include="Views\HiveExperimentManagerView.cs"> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/HiveExperimentManagerView.Designer.cs
r6373 r6381 46 46 private void InitializeComponent() { 47 47 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HiveExperimentManagerView)); 48 this.hiveExperimentListView = new HiveExperimentListView();48 this.hiveExperimentListView = new RefreshableHiveExperimentListView(); 49 49 this.refreshButton = new System.Windows.Forms.Button(); 50 50 this.SuspendLayout(); … … 86 86 #endregion 87 87 88 private HiveExperimentListView hiveExperimentListView;88 private RefreshableHiveExperimentListView hiveExperimentListView; 89 89 private System.Windows.Forms.Button refreshButton; 90 90 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/RefreshableHiveExperimentView.Designer.cs
r6373 r6381 50 50 this.tabControl = new System.Windows.Forms.TabControl(); 51 51 this.jobsTabPage = new System.Windows.Forms.TabPage(); 52 this.jobsTreeView = new HeuristicLab.Clients.Hive.Views.ExperimentManager.HiveJobItemTreeView(); 52 53 this.logTabPage = new System.Windows.Forms.TabPage(); 53 54 this.logView = new HeuristicLab.Core.Views.LogView(); … … 73 74 this.calculatingLabel = new System.Windows.Forms.Label(); 74 75 this.jobsLabel = new System.Windows.Forms.Label(); 75 this. jobsTreeView = new HeuristicLab.Clients.Hive.Views.ExperimentManager.HiveJobItemTreeView();76 this.isPrivilegedCheckBox = new System.Windows.Forms.CheckBox(); 76 77 this.tabControl.SuspendLayout(); 77 78 this.jobsTabPage.SuspendLayout(); … … 90 91 this.tabControl.Name = "tabControl"; 91 92 this.tabControl.SelectedIndex = 0; 92 this.tabControl.Size = new System.Drawing.Size( 821, 520);93 this.tabControl.Size = new System.Drawing.Size(717, 452); 93 94 this.tabControl.TabIndex = 4; 94 95 // … … 98 99 this.jobsTabPage.Location = new System.Drawing.Point(4, 22); 99 100 this.jobsTabPage.Name = "jobsTabPage"; 100 this.jobsTabPage.Size = new System.Drawing.Size( 813, 494);101 this.jobsTabPage.Size = new System.Drawing.Size(709, 426); 101 102 this.jobsTabPage.TabIndex = 5; 102 103 this.jobsTabPage.Text = "Jobs"; 103 104 this.jobsTabPage.UseVisualStyleBackColor = true; 105 // 106 // jobsTreeView 107 // 108 this.jobsTreeView.AllowDrop = true; 109 this.jobsTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 110 | System.Windows.Forms.AnchorStyles.Left) 111 | System.Windows.Forms.AnchorStyles.Right))); 112 this.jobsTreeView.Caption = "ItemTree View"; 113 this.jobsTreeView.Content = null; 114 this.jobsTreeView.Location = new System.Drawing.Point(2, 3); 115 this.jobsTreeView.Name = "jobsTreeView"; 116 this.jobsTreeView.ReadOnly = false; 117 this.jobsTreeView.Size = new System.Drawing.Size(704, 420); 118 this.jobsTreeView.TabIndex = 0; 119 this.jobsTreeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.jobsTreeView_DragDrop); 120 this.jobsTreeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.jobsTreeView_DragEnter); 121 this.jobsTreeView.DragOver += new System.Windows.Forms.DragEventHandler(this.jobsTreeView_DragOver); 104 122 // 105 123 // logTabPage … … 128 146 this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 129 147 this.startButton.Image = ((System.Drawing.Image)(resources.GetObject("startButton.Image"))); 130 this.startButton.Location = new System.Drawing.Point(0, 604);148 this.startButton.Location = new System.Drawing.Point(0, 536); 131 149 this.startButton.Name = "startButton"; 132 150 this.startButton.Size = new System.Drawing.Size(24, 24); … … 140 158 this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 141 159 this.stopButton.Image = ((System.Drawing.Image)(resources.GetObject("stopButton.Image"))); 142 this.stopButton.Location = new System.Drawing.Point(60, 604);160 this.stopButton.Location = new System.Drawing.Point(60, 536); 143 161 this.stopButton.Name = "stopButton"; 144 162 this.stopButton.Size = new System.Drawing.Size(24, 24); … … 153 171 this.resetButton.Enabled = false; 154 172 this.resetButton.Image = ((System.Drawing.Image)(resources.GetObject("resetButton.Image"))); 155 this.resetButton.Location = new System.Drawing.Point(90, 604);173 this.resetButton.Location = new System.Drawing.Point(90, 536); 156 174 this.resetButton.Name = "resetButton"; 157 175 this.resetButton.Size = new System.Drawing.Size(24, 24); … … 165 183 this.executionTimeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 166 184 this.executionTimeLabel.AutoSize = true; 167 this.executionTimeLabel.Location = new System.Drawing.Point( 595, 611);185 this.executionTimeLabel.Location = new System.Drawing.Point(491, 543); 168 186 this.executionTimeLabel.Name = "executionTimeLabel"; 169 187 this.executionTimeLabel.Size = new System.Drawing.Size(83, 13); … … 174 192 // 175 193 this.executionTimeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 176 this.executionTimeTextBox.Location = new System.Drawing.Point( 684, 608);194 this.executionTimeTextBox.Location = new System.Drawing.Point(580, 540); 177 195 this.executionTimeTextBox.Name = "executionTimeTextBox"; 178 196 this.executionTimeTextBox.ReadOnly = true; … … 185 203 this.pauseButton.Enabled = false; 186 204 this.pauseButton.Image = ((System.Drawing.Image)(resources.GetObject("pauseButton.Image"))); 187 this.pauseButton.Location = new System.Drawing.Point(30, 604);205 this.pauseButton.Location = new System.Drawing.Point(30, 536); 188 206 this.pauseButton.Name = "pauseButton"; 189 207 this.pauseButton.Size = new System.Drawing.Size(24, 24); … … 208 226 this.resourceNamesTextBox.Location = new System.Drawing.Point(73, 53); 209 227 this.resourceNamesTextBox.Name = "resourceNamesTextBox"; 210 this.resourceNamesTextBox.Size = new System.Drawing.Size( 494, 20);228 this.resourceNamesTextBox.Size = new System.Drawing.Size(304, 20); 211 229 this.resourceNamesTextBox.TabIndex = 14; 212 230 this.resourceNamesTextBox.Validated += new System.EventHandler(this.resourceNamesTextBox_Validated); … … 216 234 this.useLocalPluginsCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 217 235 this.useLocalPluginsCheckBox.AutoSize = true; 218 this.useLocalPluginsCheckBox.Location = new System.Drawing.Point( 573, 56);236 this.useLocalPluginsCheckBox.Location = new System.Drawing.Point(469, 56); 219 237 this.useLocalPluginsCheckBox.Name = "useLocalPluginsCheckBox"; 220 238 this.useLocalPluginsCheckBox.Size = new System.Drawing.Size(105, 17); … … 239 257 this.nameTextBox.Location = new System.Drawing.Point(73, 27); 240 258 this.nameTextBox.Name = "nameTextBox"; 241 this.nameTextBox.Size = new System.Drawing.Size( 605, 20);259 this.nameTextBox.Size = new System.Drawing.Size(501, 20); 242 260 this.nameTextBox.TabIndex = 21; 243 261 this.nameTextBox.Validated += new System.EventHandler(this.nameTextBox_Validated); … … 274 292 this.infoGroupBox.Controls.Add(this.calculatingLabel); 275 293 this.infoGroupBox.Controls.Add(this.jobsLabel); 276 this.infoGroupBox.Location = new System.Drawing.Point( 684, 5);294 this.infoGroupBox.Location = new System.Drawing.Point(580, 5); 277 295 this.infoGroupBox.Name = "infoGroupBox"; 278 296 this.infoGroupBox.Size = new System.Drawing.Size(133, 89); … … 335 353 this.jobsLabel.Text = "Jobs:"; 336 354 // 337 // jobsTreeView 338 // 339 this.jobsTreeView.AllowDrop = true; 340 this.jobsTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 341 | System.Windows.Forms.AnchorStyles.Left) 342 | System.Windows.Forms.AnchorStyles.Right))); 343 this.jobsTreeView.Caption = "ItemTree View"; 344 this.jobsTreeView.Content = null; 345 this.jobsTreeView.Location = new System.Drawing.Point(2, 3); 346 this.jobsTreeView.Name = "jobsTreeView"; 347 this.jobsTreeView.ReadOnly = false; 348 this.jobsTreeView.Size = new System.Drawing.Size(808, 488); 349 this.jobsTreeView.TabIndex = 0; 350 this.jobsTreeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.jobsTreeView_DragDrop); 351 this.jobsTreeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.jobsTreeView_DragEnter); 352 this.jobsTreeView.DragOver += new System.Windows.Forms.DragEventHandler(this.jobsTreeView_DragOver); 355 // isPrivilegedCheckBox 356 // 357 this.isPrivilegedCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 358 this.isPrivilegedCheckBox.AutoSize = true; 359 this.isPrivilegedCheckBox.Location = new System.Drawing.Point(383, 55); 360 this.isPrivilegedCheckBox.Name = "isPrivilegedCheckBox"; 361 this.isPrivilegedCheckBox.Size = new System.Drawing.Size(80, 17); 362 this.isPrivilegedCheckBox.TabIndex = 26; 363 this.isPrivilegedCheckBox.Text = "IsPrivileged"; 364 this.toolTip.SetToolTip(this.isPrivilegedCheckBox, "If checked, the job will be executed in a privileged sandbox on the slave."); 365 this.isPrivilegedCheckBox.UseVisualStyleBackColor = true; 366 this.isPrivilegedCheckBox.CheckedChanged += new System.EventHandler(this.isPrivilegedCheckBox_CheckedChanged); 353 367 // 354 368 // RefreshableHiveExperimentView … … 356 370 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 357 371 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 372 this.Controls.Add(this.isPrivilegedCheckBox); 358 373 this.Controls.Add(this.infoGroupBox); 359 374 this.Controls.Add(this.refreshAutomaticallyCheckBox); … … 372 387 this.Controls.Add(this.resetButton); 373 388 this.Name = "RefreshableHiveExperimentView"; 374 this.Size = new System.Drawing.Size( 821, 628);389 this.Size = new System.Drawing.Size(717, 560); 375 390 this.tabControl.ResumeLayout(false); 376 391 this.jobsTabPage.ResumeLayout(false); … … 410 425 private System.Windows.Forms.Label calculatingLabel; 411 426 private System.Windows.Forms.Label jobsLabel; 427 private System.Windows.Forms.CheckBox isPrivilegedCheckBox; 412 428 413 429 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/RefreshableHiveExperimentView.cs
r6373 r6381 103 103 resourceNamesTextBox.Text = string.Empty; 104 104 useLocalPluginsCheckBox.Checked = false; 105 isPrivilegedCheckBox.Checked = false; 105 106 logView.Content = null; 106 //includeJobsCheckBox.Checked = false; 107 refreshAutomaticallyCheckBox.Checked = false; 107 refreshAutomaticallyCheckBox.Checked = false; 108 108 logView.Content = null; 109 109 } else { … … 112 112 resourceNamesTextBox.Text = Content.HiveExperiment.ResourceNames; 113 113 useLocalPluginsCheckBox.Checked = Content.HiveExperiment.UseLocalPlugins; 114 //includeJobsCheckBox.Checked = Content.IncludeJobs;114 isPrivilegedCheckBox.Checked = Content.HiveExperiment.IsPrivileged; 115 115 refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically; 116 116 logView.Content = Content.Log; … … 138 138 this.jobsTreeView.ReadOnly = !Content.IsControllable || Content.HiveExperiment.ExecutionState != ExecutionState.Prepared || alreadyUploaded; 139 139 140 this.isPrivilegedCheckBox.Enabled = Content.IsControllable && !(Content.HiveExperiment.ExecutionState != ExecutionState.Prepared || alreadyUploaded); // TODO: check if user has the rights to do this 140 141 this.useLocalPluginsCheckBox.Enabled = Content.IsControllable && !(Content.HiveExperiment.ExecutionState != ExecutionState.Prepared || alreadyUploaded); 141 142 this.refreshAutomaticallyCheckBox.Enabled = Content.IsControllable && alreadyUploaded && jobsLoaded && Content.HiveExperiment.ExecutionState == ExecutionState.Started; 142 143 this.refreshButton.Enabled = Content.IsControllable && alreadyUploaded; 143 144 this.Locked = !Content.IsControllable || Content.HiveExperiment.ExecutionState == ExecutionState.Started; 145 144 146 } 145 147 SetEnabledStateOfExecutableButtons(); … … 296 298 private void useLocalPluginsCheckBox_CheckedChanged(object sender, EventArgs e) { 297 299 if (Content != null) Content.HiveExperiment.UseLocalPlugins = useLocalPluginsCheckBox.Checked; 300 } 301 302 private void isPrivilegedCheckBox_CheckedChanged(object sender, EventArgs e) { 303 if (Content != null) Content.HiveExperiment.IsPrivileged = isPrivilegedCheckBox.Checked; 298 304 } 299 305 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs
r6371 r6381 228 228 Guid jobId = (Guid)jobIdObj; 229 229 Job job = null; 230 bool usedCoresIncremented = false;230 int usedCores = 0; 231 231 try { 232 232 job = wcfService.GetJob(jobId); … … 234 234 if (ConfigManager.Instance.GetFreeCores() < job.CoresNeeded) throw new OutOfCoresException(); 235 235 if (ConfigManager.GetFreeMemory() < job.MemoryNeeded) throw new OutOfMemoryException(); 236 SlaveStatusInfo.IncrementUsedCores(job.CoresNeeded); usedCores Incremented = true;236 SlaveStatusInfo.IncrementUsedCores(job.CoresNeeded); usedCores = job.CoresNeeded; 237 237 JobData jobData = wcfService.GetJobData(jobId); 238 238 if (jobData == null) throw new JobDataNotFoundException(jobId); … … 242 242 } 243 243 catch (JobNotFoundException) { 244 if (usedCoresIncremented) SlaveStatusInfo.DecrementUsedCores(job.CoresNeeded);244 SlaveStatusInfo.DecrementUsedCores(usedCores); 245 245 throw; 246 246 } 247 247 catch (JobDataNotFoundException) { 248 SlaveStatusInfo.DecrementUsedCores( job.CoresNeeded);248 SlaveStatusInfo.DecrementUsedCores(usedCores); 249 249 throw; 250 250 } 251 251 catch (JobAlreadyRunningException) { 252 SlaveStatusInfo.DecrementUsedCores( job.CoresNeeded);252 SlaveStatusInfo.DecrementUsedCores(usedCores); 253 253 throw; 254 254 } … … 261 261 throw; 262 262 } 263 catch (Exception) { 264 if (usedCoresIncremented) SlaveStatusInfo.DecrementUsedCores(job.CoresNeeded); 263 catch (Exception e) { 264 SlaveStatusInfo.DecrementUsedCores(usedCores); 265 wcfService.UpdateJobState(jobId, JobState.Waiting, e.ToString()); // unknown internal error - report and set waiting again 265 266 throw; 266 267 } … … 372 373 job.ExecutionTime = slaveJob.ExecutionTime; 373 374 if (jobData != null) { 374 wcfService.UpdateJobData(job, jobData, configManager.GetClientInfo().Id, JobState.Failed );375 wcfService.UpdateJobData(job, jobData, configManager.GetClientInfo().Id, JobState.Failed, exception.ToString()); 375 376 } else { 376 377 wcfService.UpdateJobState(job.Id, JobState.Failed, exception.ToString()); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs
r6371 r6381 154 154 #region Job Events 155 155 private void Job_JobFailed(object sender, EventArgs e) { 156 IsStopping = true; 156 157 EventArgs<Exception> ex = (EventArgs<Exception>)e; 157 158 currentException = ex.Value; … … 161 162 162 163 private void Job_JobStopped(object sender, EventArgs e) { 164 IsStopping = true; 163 165 if (wasJobAborted) 164 166 pauseStopSem.Release(); … … 168 170 169 171 private void Job_JobPaused(object sender, EventArgs e) { 172 IsPausing = true; 170 173 pauseStopSem.Release(); 171 174 executorQueue.AddMessage(ExecutorMessageType.JobPaused); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Manager/JobManager.cs
r6371 r6381 86 86 } 87 87 catch (Exception) { 88 RemoveSlaveJob(job.Id, slaveJob); // clean up and rethrow 88 89 slaveJob.DisposeAppDomain(); 89 RemoveSlaveJob(job.Id, slaveJob); // clean up and rethrow90 90 throw; 91 91 } … … 268 268 if (jobData == null) throw new SerializationException(); 269 269 } 270 catch { }270 catch { /* jobData will be null */ } 271 271 SlaveStatusInfo.IncrementJobsFailed(); 272 272 OnJobFailed(slaveJob, jobData, e.Value2); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/WcfService.cs
r6371 r6381 101 101 /// Uploads the jobData and sets a new jobState (while correctly setting Transferring state) 102 102 /// </summary> 103 public void UpdateJobData(Job job, JobData jobData, Guid slaveId, JobState state ) {103 public void UpdateJobData(Job job, JobData jobData, Guid slaveId, JobState state, string exception = "") { 104 104 CallHiveService(service => { 105 105 service.UpdateJob(job); 106 106 job = service.UpdateJobState(job.Id, JobState.Transferring, slaveId, null, null); 107 107 service.UpdateJobData(job, jobData); 108 service.UpdateJobState(job.Id, state, slaveId, null, null);108 service.UpdateJobState(job.Id, state, slaveId, null, exception); 109 109 }); 110 110 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/HeuristicLab.Clients.Hive.Views-3.4.csproj
r6373 r6381 125 125 </ItemGroup> 126 126 <ItemGroup> 127 <Compile Include="HiveJobs\ ControllableHiveJobView.cs">128 <SubType>UserControl</SubType> 129 </Compile> 130 <Compile Include="HiveJobs\ ControllableHiveJobView.designer.cs">131 <DependentUpon> ControllableHiveJobView.cs</DependentUpon>127 <Compile Include="HiveJobs\OptimizerHiveJobView.cs"> 128 <SubType>UserControl</SubType> 129 </Compile> 130 <Compile Include="HiveJobs\OptimizerHiveJobView.designer.cs"> 131 <DependentUpon>OptimizerHiveJobView.cs</DependentUpon> 132 132 </Compile> 133 133 <Compile Include="HiveItemView.cs"> … … 220 220 </ItemGroup> 221 221 <ItemGroup> 222 <EmbeddedResource Include="HiveJobs\ ControllableHiveJobView.resx">223 <DependentUpon> ControllableHiveJobView.cs</DependentUpon>222 <EmbeddedResource Include="HiveJobs\OptimizerHiveJobView.resx"> 223 <DependentUpon>OptimizerHiveJobView.cs</DependentUpon> 224 224 </EmbeddedResource> 225 225 <EmbeddedResource Include="HiveJobs\HiveJobView.resx"> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveClient.cs
r6373 r6381 225 225 226 226 foreach (HiveJob hiveJob in refreshableHiveExperiment.HiveExperiment.HiveJobs) { 227 UploadJobWithChildren(refreshableHiveExperiment.HiveExperiment.Progress, service, hiveJob, null, resourceIds, ref jobCount, totalJobCount, configFilePlugin.Id, refreshableHiveExperiment.HiveExperiment.UseLocalPlugins, refreshableHiveExperiment.HiveExperiment.Id, refreshableHiveExperiment.Log );227 UploadJobWithChildren(refreshableHiveExperiment.HiveExperiment.Progress, service, hiveJob, null, resourceIds, ref jobCount, totalJobCount, configFilePlugin.Id, refreshableHiveExperiment.HiveExperiment.UseLocalPlugins, refreshableHiveExperiment.HiveExperiment.Id, refreshableHiveExperiment.Log, refreshableHiveExperiment.HiveExperiment.IsPrivileged); 228 228 } 229 229 … … 257 257 /// <param name="parentHiveJob">shall be null if its the root job</param> 258 258 /// <param name="groups"></param> 259 private void UploadJobWithChildren(IProgress progress, IHiveService service, HiveJob hiveJob, HiveJob parentHiveJob, IEnumerable<Guid> groups, ref int jobCount, int totalJobCount, Guid configPluginId, bool useLocalPlugins, Guid hiveExperimentId, ILog log ) {259 private void UploadJobWithChildren(IProgress progress, IHiveService service, HiveJob hiveJob, HiveJob parentHiveJob, IEnumerable<Guid> groups, ref int jobCount, int totalJobCount, Guid configPluginId, bool useLocalPlugins, Guid hiveExperimentId, ILog log, bool isPrivileged) { 260 260 jobCount++; 261 261 progress.Status = string.Format("Serializing job {0} of {1}", jobCount, totalJobCount); … … 263 263 List<IPluginDescription> plugins; 264 264 265 if (hiveJob.ItemJob.ComputeInParallel && 266 (hiveJob.ItemJob.Item is Optimization.Experiment || hiveJob.ItemJob.Item is Optimization.BatchRun)) { 265 if (hiveJob.ItemJob.ComputeInParallel && (hiveJob.ItemJob.Item is Optimization.Experiment || hiveJob.ItemJob.Item is Optimization.BatchRun)) { 267 266 hiveJob.Job.IsParentJob = true; 268 267 hiveJob.Job.FinishWhenChildJobsFinished = true; … … 279 278 hiveJob.Job.PluginsNeededIds.Add(configPluginId); 280 279 hiveJob.Job.HiveExperimentId = hiveExperimentId; 280 hiveJob.Job.IsPrivileged = isPrivileged; 281 281 282 282 progress.Status = string.Format("Uploading job {0} of {1} ({2} kb, {3} objects)", jobCount, totalJobCount, jobData.Data.Count() / 1024, hiveJob.ItemJob.GetObjectGraphObjects().Count()); … … 293 293 294 294 foreach (HiveJob child in hiveJob.ChildHiveJobs) { 295 UploadJobWithChildren(progress, service, child, hiveJob, groups, ref jobCount, totalJobCount, configPluginId, useLocalPlugins, hiveExperimentId, log );295 UploadJobWithChildren(progress, service, child, hiveJob, groups, ref jobCount, totalJobCount, configPluginId, useLocalPlugins, hiveExperimentId, log, isPrivileged); 296 296 } 297 297 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveJobs/EngineHiveJob.cs
r6373 r6381 56 56 57 57 // clone operation and remove unnecessary scopes; don't do this earlier to avoid memory problems 58 lock (locker) {58 //lock (locker) { 59 59 ((IAtomicOperation)ItemJob.InitialOperation).Scope.Parent = parentScopeClone; 60 60 ItemJob.InitialOperation = (IOperation)ItemJob.InitialOperation.Clone(); 61 61 ((IAtomicOperation)ItemJob.InitialOperation).Scope.ClearParentScopes(); 62 62 jobData.Data = PersistenceUtil.Serialize(ItemJob, out usedTypes); 63 }63 //} 64 64 65 65 // add type objects from object graph to work around ticket #1527 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveJobs/HiveJob.cs
r6373 r6381 25 25 using System.Drawing; 26 26 using System.Linq; 27 using System.Threading; 27 28 using HeuristicLab.Collections; 28 29 using HeuristicLab.Common; … … 37 38 public class HiveJob : NamedItem, IItemTree<HiveJob> { 38 39 protected static object locker = new object(); 40 protected ReaderWriterLockSlim childHiveJobsLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); 39 41 40 42 public override Image ItemImage { … … 109 111 protected ItemList<HiveJob> childHiveJobs; 110 112 public virtual ReadOnlyItemList<HiveJob> ChildHiveJobs { 111 get { return childHiveJobs.AsReadOnly(); } 113 get { 114 childHiveJobsLock.EnterReadLock(); 115 try { 116 return childHiveJobs.AsReadOnly(); 117 } 118 finally { childHiveJobsLock.ExitReadLock(); } 119 } 112 120 } 113 121 … … 117 125 #region Constructors and Cloning 118 126 public HiveJob() { 119 this.Job = new Job() { 120 CoresNeeded = 1, 121 MemoryNeeded = 0 122 }; 127 this.Job = new Job() { CoresNeeded = 1, MemoryNeeded = 0 }; 123 128 job.State = JobState.Offline; 124 129 this.childHiveJobs = new ItemList<HiveJob>(); … … 152 157 this.Job = cloner.Clone(original.job); 153 158 this.ItemJob = cloner.Clone(original.ItemJob); 154 this.childHiveJobs = cloner.Clone(original.childHiveJobs); 159 original.childHiveJobsLock.EnterReadLock(); 160 try { 161 this.childHiveJobs = cloner.Clone(original.childHiveJobs); 162 } 163 finally { original.childHiveJobsLock.ExitReadLock(); } 155 164 this.syncJobsWithOptimizers = original.syncJobsWithOptimizers; 156 165 this.isFinishedJobDownloaded = original.isFinishedJobDownloaded; … … 198 207 199 208 public virtual void AddChildHiveJob(HiveJob hiveJob) { 200 this.childHiveJobs.Add(hiveJob); 209 childHiveJobsLock.EnterWriteLock(); 210 try { 211 this.childHiveJobs.Add(hiveJob); 212 } 213 finally { childHiveJobsLock.ExitWriteLock(); } 201 214 } 202 215 … … 237 250 IEnumerable<Type> usedTypes; 238 251 byte[] jobByteArray = PersistenceUtil.Serialize(this.ItemJob, out usedTypes); 239 240 JobData jobData = new JobData() { 241 JobId = job.Id, 242 Data = jobByteArray 243 }; 244 252 JobData jobData = new JobData() { JobId = job.Id, Data = jobByteArray }; 245 253 PluginUtil.CollectDeclaringPlugins(plugins, usedTypes); 246 247 254 return jobData; 248 255 } … … 295 302 /// </summary> 296 303 public IEnumerable<HiveJob> GetAllHiveJobs() { 297 var jobs = new List<HiveJob>(); 298 jobs.Add(this); 299 foreach (HiveJob child in this.ChildHiveJobs) { 300 jobs.AddRange(child.GetAllHiveJobs()); 301 } 302 return jobs; 304 childHiveJobsLock.EnterReadLock(); 305 try { 306 var jobs = new List<HiveJob>(); 307 jobs.Add(this); 308 foreach (HiveJob child in this.childHiveJobs) { 309 jobs.AddRange(child.GetAllHiveJobs()); 310 } 311 return jobs; 312 } 313 finally { childHiveJobsLock.ExitReadLock(); } 303 314 } 304 315 305 316 public HiveJob GetParentByJobId(Guid jobId) { 306 if (this.ChildHiveJobs.SingleOrDefault(j => j.job.Id == jobId) != null) 307 return this; 308 foreach (HiveJob child in this.childHiveJobs) { 309 HiveJob result = child.GetParentByJobId(jobId); 310 if (result != null) 311 return result; 312 } 313 return null; 317 childHiveJobsLock.EnterReadLock(); 318 try { 319 if (this.ChildHiveJobs.SingleOrDefault(j => j.job.Id == jobId) != null) 320 return this; 321 foreach (HiveJob child in this.childHiveJobs) { 322 HiveJob result = child.GetParentByJobId(jobId); 323 if (result != null) 324 return result; 325 } 326 return null; 327 } 328 finally { childHiveJobsLock.ExitWriteLock(); } 314 329 } 315 330 … … 321 336 return this; 322 337 } else { 323 foreach (HiveJob child in this.ChildHiveJobs) { 324 HiveJob result = child.GetHiveJobByJobId(jobId); 325 if (result != null) 326 return result; 327 } 338 childHiveJobsLock.EnterReadLock(); 339 try { 340 foreach (HiveJob child in this.childHiveJobs) { 341 HiveJob result = child.GetHiveJobByJobId(jobId); 342 if (result != null) 343 return result; 344 } 345 } 346 finally { childHiveJobsLock.ExitReadLock(); } 328 347 } 329 348 return null; … … 331 350 332 351 public void RemoveByJobId(Guid jobId) { 333 IEnumerable<HiveJob> jobs = ChildHiveJobs.Where(j => j.Job.Id == jobId).ToList(); // if Guid.Empty needs to be removed, there could be more than one with this jobId 334 foreach (HiveJob j in jobs) { 335 this.childHiveJobs.Remove(j); 336 } 337 foreach (HiveJob child in ChildHiveJobs) { 338 child.RemoveByJobId(jobId); 339 } 352 childHiveJobsLock.EnterWriteLock(); 353 try { 354 IEnumerable<HiveJob> jobs = childHiveJobs.Where(j => j.Job.Id == jobId).ToList(); 355 foreach (HiveJob j in jobs) { 356 this.childHiveJobs.Remove(j); 357 } 358 foreach (HiveJob child in childHiveJobs) { 359 child.RemoveByJobId(jobId); 360 } 361 } 362 finally { childHiveJobsLock.ExitWriteLock(); } 340 363 } 341 364 342 365 public IEnumerable<IItemTree<HiveJob>> GetChildItems() { 343 return this. childHiveJobs;366 return this.ChildHiveJobs; 344 367 } 345 368 … … 371 394 public void Pause() { 372 395 if (this.Job.IsParentJob) { 373 foreach (var child in ChildHiveJobs) { 374 ServiceLocator.Instance.CallHiveService(s => s.PauseJob(child.job.Id)); 375 } 396 childHiveJobsLock.EnterReadLock(); 397 try { 398 foreach (var child in childHiveJobs) { 399 ServiceLocator.Instance.CallHiveService(s => s.PauseJob(child.job.Id)); 400 } 401 } 402 finally { childHiveJobsLock.ExitReadLock(); } 376 403 } else { 377 404 ServiceLocator.Instance.CallHiveService(s => s.PauseJob(this.job.Id)); … … 381 408 public void Stop() { 382 409 if (this.Job.IsParentJob) { 383 foreach (var child in ChildHiveJobs) { 384 ServiceLocator.Instance.CallHiveService(s => s.StopJob(child.job.Id)); 385 } 410 childHiveJobsLock.EnterReadLock(); 411 try { 412 foreach (var child in childHiveJobs) { 413 ServiceLocator.Instance.CallHiveService(s => s.StopJob(child.job.Id)); 414 } 415 } 416 finally { childHiveJobsLock.ExitReadLock(); } 386 417 } else { 387 418 ServiceLocator.Instance.CallHiveService(s => s.StopJob(this.job.Id)); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveJobs/OptimizerHiveJob.cs
r6373 r6381 129 129 private void Optimizers_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) { 130 130 if (syncJobsWithOptimizers && this.ItemJob.ComputeInParallel) { 131 foreach (var item in e.Items) { 132 if (GetChildByOptimizer(item.Value) == null && item.Value.Name != "Placeholder") { 133 this.childHiveJobs.Add(new OptimizerHiveJob(item.Value)); 134 } 135 } 131 childHiveJobsLock.EnterWriteLock(); 132 try { 133 foreach (var item in e.Items) { 134 if (GetChildByOptimizer(item.Value) == null && item.Value.Name != "Placeholder") { 135 this.childHiveJobs.Add(new OptimizerHiveJob(item.Value)); 136 } 137 } 138 } 139 finally { childHiveJobsLock.ExitWriteLock(); } 136 140 } 137 141 } 138 142 private void Optimizers_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) { 139 143 if (syncJobsWithOptimizers && this.ItemJob.ComputeInParallel) { 140 foreach (var item in e.OldItems) { 141 this.childHiveJobs.Remove(this.GetChildByOptimizer(item.Value)); 142 } 143 foreach (var item in e.Items) { 144 if (GetChildByOptimizer(item.Value) == null && item.Value.Name != "Placeholder") { 145 this.childHiveJobs.Add(new OptimizerHiveJob(item.Value)); 146 } 147 } 144 childHiveJobsLock.EnterWriteLock(); 145 try { 146 foreach (var item in e.OldItems) { 147 this.childHiveJobs.Remove(this.GetChildByOptimizer(item.Value)); 148 } 149 foreach (var item in e.Items) { 150 if (GetChildByOptimizer(item.Value) == null && item.Value.Name != "Placeholder") { 151 this.childHiveJobs.Add(new OptimizerHiveJob(item.Value)); 152 } 153 } 154 } 155 finally { childHiveJobsLock.ExitWriteLock(); } 148 156 } 149 157 } 150 158 private void Optimizers_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) { 151 159 if (syncJobsWithOptimizers && this.ItemJob.ComputeInParallel) { 152 foreach (var item in e.Items) { 153 this.childHiveJobs.Remove(this.GetChildByOptimizer(item.Value)); 154 } 160 childHiveJobsLock.EnterWriteLock(); 161 try { 162 foreach (var item in e.Items) { 163 this.childHiveJobs.Remove(this.GetChildByOptimizer(item.Value)); 164 } 165 } 166 finally { childHiveJobsLock.ExitWriteLock(); } 155 167 } 156 168 } 157 169 private void Optimizers_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) { 158 170 if (syncJobsWithOptimizers && this.ItemJob.ComputeInParallel) { 159 foreach (var item in e.Items) { 160 this.childHiveJobs.Remove(this.GetChildByOptimizer(item.Value)); 161 } 171 childHiveJobsLock.EnterWriteLock(); 172 try { 173 foreach (var item in e.Items) { 174 this.childHiveJobs.Remove(this.GetChildByOptimizer(item.Value)); 175 } 176 } 177 finally { childHiveJobsLock.ExitWriteLock(); } 162 178 } 163 179 } … … 182 198 183 199 OptimizerHiveJob child = (OptimizerHiveJob)this.ChildHiveJobs.Single(j => j.Job.Id == childJobId); 184 if (!optimizerJob.ComputeInParallel) { 185 child.syncJobsWithOptimizers = false; 186 child.ItemJob = optimizerJob; 187 child.syncJobsWithOptimizers = true; 188 } 200 childHiveJobsLock.EnterReadLock(); 201 try { 202 if (!optimizerJob.ComputeInParallel) { 203 child.syncJobsWithOptimizers = false; 204 child.ItemJob = optimizerJob; 205 child.syncJobsWithOptimizers = true; 206 } 207 } 208 finally { childHiveJobsLock.ExitReadLock(); } 189 209 syncJobsWithOptimizers = true; 190 210 } … … 243 263 } 244 264 } 245 foreach (OptimizerHiveJob child in childHiveJobs) { 246 child.SetIndexInParentOptimizerList(this); 247 } 265 childHiveJobsLock.EnterReadLock(); 266 try { 267 foreach (OptimizerHiveJob child in childHiveJobs) { 268 child.SetIndexInParentOptimizerList(this); 269 } 270 } 271 finally { childHiveJobsLock.ExitReadLock(); } 248 272 } 249 273 … … 302 326 } 303 327 304 JobData jobData = new JobData() { 305 JobId = job.Id, 306 Data = jobByteArray 307 }; 308 328 JobData jobData = new JobData() { JobId = job.Id, Data = jobByteArray }; 309 329 PluginUtil.CollectDeclaringPlugins(plugins, usedTypes); 310 311 330 return jobData; 312 331 } 313 332 314 333 public OptimizerHiveJob GetChildByOptimizerJob(OptimizerJob optimizerJob) { 315 foreach (OptimizerHiveJob child in ChildHiveJobs) { 316 if (child.ItemJob == optimizerJob) 317 return child; 318 } 319 return null; 334 childHiveJobsLock.EnterReadLock(); 335 try { 336 foreach (OptimizerHiveJob child in childHiveJobs) { 337 if (child.ItemJob == optimizerJob) 338 return child; 339 } 340 return null; 341 } 342 finally { childHiveJobsLock.ExitReadLock(); } 320 343 } 321 344 322 345 public HiveJob<OptimizerJob> GetChildByOptimizer(IOptimizer optimizer) { 323 foreach (OptimizerHiveJob child in ChildHiveJobs) { 324 if (child.ItemJob.Item == optimizer) 325 return child; 326 } 327 return null; 346 childHiveJobsLock.EnterReadLock(); 347 try { 348 foreach (OptimizerHiveJob child in childHiveJobs) { 349 if (child.ItemJob.Item == optimizer) 350 return child; 351 } 352 return null; 353 } 354 finally { childHiveJobsLock.ExitReadLock(); } 328 355 } 329 356 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/Jobs/ItemJob.cs
r6373 r6381 31 31 [Item("Item Job", "Represents a executable hive job which contains a HeuristicLab Item.")] 32 32 [StorableClass] 33 public abstract class ItemJob : DeepCloneable, IJob {33 public abstract class ItemJob : NamedItem, IJob { 34 34 public virtual bool IsParallelizable { 35 35 get { return true; } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/Jobs/OptimizerJob.cs
r6373 r6381 86 86 87 87 #region IJob Members 88 89 88 public override ExecutionState ExecutionState { 90 89 get { return Item.ExecutionState; } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/RefreshableHiveExperiment.cs
r6373 r6381 395 395 396 396 public override string ToString() { 397 return HiveExperiment.ToString();397 return string.Format("{0} {1}", HiveExperiment.DateCreated.ToString("MM.dd.yyyy HH:mm"), HiveExperiment.ToString()); 398 398 } 399 399 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveExperiment.cs
r6372 r6381 33 33 get { return useLocalPlugins; } 34 34 set { useLocalPlugins = value; } 35 } 36 37 private bool isPrivileged; 38 public bool IsPrivileged { 39 get { return isPrivileged; } 40 set { isPrivileged = value; } 35 41 } 36 42 … … 89 95 this.ResourceNames = "HEAL"; 90 96 this.HiveJobs = new ItemCollection<HiveJob>(); 97 this.DateCreated = DateTime.Now; 91 98 } 92 99 … … 103 110 this.UseLocalPlugins = original.UseLocalPlugins; 104 111 this.ExecutionTime = original.ExecutionTime; 112 this.IsPrivileged = original.IsPrivileged; 105 113 } 106 114 public override IDeepCloneable Clone(Cloner cloner) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Hive/3.4/IJob.cs
r6372 r6381 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 25 26 namespace HeuristicLab.Hive { 26 public interface IJob : INamedItem { 27 27 public interface IJob : IDeepCloneable, ICloneable { 28 28 TimeSpan ExecutionTime { get; } 29 29 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine.Views/3.4/HiveEngineView.Designer.cs
r6373 r6381 33 33 this.tabControl = new System.Windows.Forms.TabControl(); 34 34 this.jobsTabPage = new System.Windows.Forms.TabPage(); 35 this.hiveExperimentListView = new H iveExperimentListView();35 this.hiveExperimentListView = new HeuristicLab.Clients.Hive.ExperimentManager.Views.RefreshableHiveExperimentListView(); 36 36 this.logTabPage = new System.Windows.Forms.TabPage(); 37 37 this.logView = new HeuristicLab.Core.Views.LogView(); … … 39 39 this.executionTimeTextBox = new System.Windows.Forms.TextBox(); 40 40 this.useLocalPluginsCheckBox = new System.Windows.Forms.CheckBox(); 41 this.isPrivilegedCheckBox = new System.Windows.Forms.CheckBox(); 41 42 this.tabControl.SuspendLayout(); 42 43 this.jobsTabPage.SuspendLayout(); … … 60 61 this.resourceIdsTextBox.Location = new System.Drawing.Point(189, 52); 61 62 this.resourceIdsTextBox.Name = "resourceIdsTextBox"; 62 this.resourceIdsTextBox.Size = new System.Drawing.Size( 405, 20);63 this.resourceIdsTextBox.Size = new System.Drawing.Size(319, 20); 63 64 this.resourceIdsTextBox.TabIndex = 4; 64 65 this.resourceIdsTextBox.Text = "HEAL"; … … 184 185 this.useLocalPluginsCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 185 186 this.useLocalPluginsCheckBox.AutoSize = true; 186 this.useLocalPluginsCheckBox.Location = new System.Drawing.Point( 600, 55);187 this.useLocalPluginsCheckBox.Location = new System.Drawing.Point(598, 55); 187 188 this.useLocalPluginsCheckBox.Name = "useLocalPluginsCheckBox"; 188 this.useLocalPluginsCheckBox.Size = new System.Drawing.Size(10 3, 17);189 this.useLocalPluginsCheckBox.Size = new System.Drawing.Size(105, 17); 189 190 this.useLocalPluginsCheckBox.TabIndex = 12; 190 this.useLocalPluginsCheckBox.Text = " useLocalPlugins";191 this.useLocalPluginsCheckBox.Text = "UseLocalPlugins"; 191 192 this.useLocalPluginsCheckBox.UseVisualStyleBackColor = true; 192 193 this.useLocalPluginsCheckBox.CheckedChanged += new System.EventHandler(this.useLocalPluginsCheckBox_CheckedChanged); 193 194 // 195 // isPrivilegedCheckBox 196 // 197 this.isPrivilegedCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 198 this.isPrivilegedCheckBox.AutoSize = true; 199 this.isPrivilegedCheckBox.Location = new System.Drawing.Point(514, 55); 200 this.isPrivilegedCheckBox.Name = "isPrivilegedCheckBox"; 201 this.isPrivilegedCheckBox.Size = new System.Drawing.Size(80, 17); 202 this.isPrivilegedCheckBox.TabIndex = 13; 203 this.isPrivilegedCheckBox.Text = "IsPrivileged"; 204 this.isPrivilegedCheckBox.UseVisualStyleBackColor = true; 205 this.isPrivilegedCheckBox.CheckedChanged += new System.EventHandler(this.isPrivilegedCheckBox_CheckedChanged); 206 // 194 207 // HiveEngineView 195 208 // 196 209 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 197 210 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 211 this.Controls.Add(this.isPrivilegedCheckBox); 198 212 this.Controls.Add(this.useLocalPluginsCheckBox); 199 213 this.Controls.Add(this.executionTimeTextBox); … … 231 245 private System.Windows.Forms.CheckBox useLocalPluginsCheckBox; 232 246 private HeuristicLab.Core.Views.LogView logView; 233 private HiveExperimentListView hiveExperimentListView; 247 private RefreshableHiveExperimentListView hiveExperimentListView; 248 private System.Windows.Forms.CheckBox isPrivilegedCheckBox; 234 249 } 235 250 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine.Views/3.4/HiveEngineView.cs
r6212 r6381 74 74 executionTimeOnHiveTextBox.Text = string.Empty; 75 75 useLocalPluginsCheckBox.Checked = false; 76 isPrivilegedCheckBox.Checked = false; 76 77 hiveExperimentListView.Content = null; 77 78 logView.Content = null; … … 81 82 executionTimeOnHiveTextBox.Text = Content.ExecutionTimeOnHive.ToString(); 82 83 useLocalPluginsCheckBox.Checked = Content.UseLocalPlugins; 84 isPrivilegedCheckBox.Checked = Content.IsPrivileged; 83 85 hiveExperimentListView.Content = Content.HiveExperiments; 84 86 logView.Content = Content.Log; … … 93 95 priorityTextBox.ReadOnly = this.ReadOnly; 94 96 useLocalPluginsCheckBox.Enabled = !this.ReadOnly; 97 isPrivilegedCheckBox.Enabled = !this.ReadOnly; // TODO: check for user rights 95 98 } else { 96 99 resourceIdsTextBox.ReadOnly = false; 97 100 priorityTextBox.ReadOnly = false; 98 101 useLocalPluginsCheckBox.Enabled = false; 102 isPrivilegedCheckBox.Enabled = false; 99 103 } 100 104 } … … 112 116 Content.UseLocalPlugins = useLocalPluginsCheckBox.Checked; 113 117 } 118 119 private void isPrivilegedCheckBox_CheckedChanged(object sender, EventArgs e) { 120 Content.IsPrivileged = isPrivilegedCheckBox.Checked; 121 } 114 122 #endregion 115 116 117 123 } 118 124 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/HiveEngine.cs
r6373 r6381 74 74 } 75 75 76 [Storable] 77 private bool isPrivileged; 78 public bool IsPrivileged { 79 get { return isPrivileged; } 80 set { isPrivileged = value; } 81 } 82 76 83 // [Storable] -> HiveExperiment can't be storable, so RefreshableHiveExperiment can't be stored 77 84 private ItemCollection<RefreshableHiveExperiment> hiveExperiments = new ItemCollection<RefreshableHiveExperiment>(); … … 108 115 this.executionTimeOnHive = original.executionTimeOnHive; 109 116 this.useLocalPlugins = original.useLocalPlugins; 117 this.IsPrivileged = original.IsPrivileged; 110 118 // this.hiveExperiments = cloner.Clone(original.hiveExperiments); do not clone hiveExperiments - otherwise they would be sent with every job 111 119 } … … 187 195 // } 188 196 //} else if (coll.Parallel) { 189 if (coll.Parallel) {197 if (coll.Parallel) { 190 198 // clone the parent scope here and reuse it for each operation. otherwise for each job the whole scope-tree first needs to be copied and then cleaned, which causes a lot of work for the Garbage Collector 191 199 IScope parentScopeClone = (IScope)((IAtomicOperation)coll.First()).Scope.Parent.Clone(); … … 272 280 IScope[] scopes = new Scope[jobs.Length]; 273 281 object locker = new object(); 274 IDictionary<Guid, int> jobIndices = new Dictionary<Guid, int>();275 282 var hiveExperiment = refreshableHiveExperiment.HiveExperiment; 276 283 277 284 try { 278 List<Guid> remainingJobIds = new List<Guid>();279 280 285 // create upload-tasks 281 var uploadTasks = new List<Task<Job>>();282 286 for (int i = 0; i < jobs.Length; i++) { 283 hiveExperiment.HiveJobs.Add(new EngineHiveJob(jobs[i], parentScopeClone)); 287 var engineHiveJob = new EngineHiveJob(jobs[i], parentScopeClone); 288 engineHiveJob.Job.Priority = this.Priority; 289 hiveExperiment.HiveJobs.Add(engineHiveJob); 284 290 285 291 // shuffle random variable to avoid the same random sequence in each operation; todo: does not yet work (it cannot find the random variable) … … 288 294 random.Reset(random.Next()); 289 295 } 290 HiveClient.StartExperiment((e) => { 291 LogException(e); 292 }, refreshableHiveExperiment); 296 HiveClient.StartExperiment((e) => { LogException(e); }, refreshableHiveExperiment); 293 297 294 298 // do polling until experiment is finished and all jobs are downloaded 295 299 while (!refreshableHiveExperiment.AllJobsFinished()) { 296 Thread.Sleep( 500);300 Thread.Sleep(2000); 297 301 this.ExecutionTimeOnHive = TimeSpan.FromMilliseconds(hiveExperiments.Sum(x => x.HiveExperiment.ExecutionTime.TotalMilliseconds)); 298 302 cancellationToken.ThrowIfCancellationRequested(); 299 303 } 300 304 LogMessage(string.Format("{0} finished (TotalExecutionTime: {1}).", refreshableHiveExperiment.ToString(), refreshableHiveExperiment.HiveExperiment.ExecutionTime)); 305 306 var failedJobs = hiveExperiment.HiveJobs.Where(x => x.Job.State == JobState.Failed); 307 if(failedJobs.Count() > 0) { 308 throw new HiveEngineException("Job failed: " + failedJobs.First().Job.StateLog.Last().Exception); 309 } 301 310 302 311 // get scopes 303 312 int j = 0; 304 313 foreach (var hiveJob in hiveExperiment.HiveJobs) { 305 if (hiveJob.Job.State != JobState.Finished)306 throw new HiveEngineException("Job failed: " + hiveJob.Job.StateLog.Last().Exception);307 308 314 var scope = ((IAtomicOperation)((EngineJob)hiveJob.ItemJob).InitialOperation).Scope; 309 315 scopes[j++] = scope; … … 313 319 catch (OperationCanceledException e) { 314 320 lock (locker) { 315 if (jobIndices != null)DeleteHiveExperiment(hiveExperiment.Id);321 DeleteHiveExperiment(hiveExperiment.Id); 316 322 } 317 323 throw e; … … 319 325 catch (Exception e) { 320 326 lock (locker) { 321 if (jobIndices != null)DeleteHiveExperiment(hiveExperiment.Id);327 DeleteHiveExperiment(hiveExperiment.Id); 322 328 } 323 329 LogException(e); … … 333 339 hiveExperiment.UseLocalPlugins = this.UseLocalPlugins; 334 340 hiveExperiment.ResourceNames = this.ResourceNames; 341 hiveExperiment.IsPrivileged = this.IsPrivileged; 335 342 var refreshableHiveExperiment = new RefreshableHiveExperiment(hiveExperiment); 336 343 refreshableHiveExperiment.IsControllable = false; -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/Tests
- Property svn:ignore
-
old new 5 5 HeuristicLab.HiveEngine-3.4.Tests.csproj.vs10x 6 6 Meta-GA - Meta Optimization Problem (Genetic Programming - Symbolic Regression 3.4 scaled)_small.hl 7 HeuristicLab.HiveEngine-3.4.ConsoleTests.csproj.user 8 HeuristicLab.HiveEngine-3.4.ConsoleTests.csproj.vs10x
-
- Property svn:ignore
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/Tests/Program.cs
r6373 r6381 47 47 GeneticAlgorithm alg = new GeneticAlgorithm(); 48 48 alg.Problem = new SingleObjectiveTestFunctionProblem(); 49 alg.Engine = new HiveEngine() { ResourceNames = " CHRISTOPH-PC" };49 alg.Engine = new HiveEngine() { ResourceNames = "HEAL" }; 50 50 alg.Elites.Value = 0; 51 51 alg.PopulationSize.Value = 10;
Note: See TracChangeset
for help on using the changeset viewer.