Changeset 7417
- Timestamp:
- 01/26/12 22:01:38 (13 years ago)
- Location:
- branches/HiveHiveEngine
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveHiveEngine/HeuristicLab.HiveEngine.Views/3.3/HiveEngineView.Designer.cs
r7287 r7417 39 39 this.executionTimeTextBox = new System.Windows.Forms.TextBox(); 40 40 this.isPrivilegedCheckBox = new System.Windows.Forms.CheckBox(); 41 this.pauseOnWaitCheckbox = 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(4 28, 20);63 this.resourceIdsTextBox.Size = new System.Drawing.Size(415, 20); 63 64 this.resourceIdsTextBox.TabIndex = 4; 64 65 this.resourceIdsTextBox.Text = "HEAL"; … … 100 101 this.executionTimeOnHiveTextBox.Name = "executionTimeOnHiveTextBox"; 101 102 this.executionTimeOnHiveTextBox.ReadOnly = true; 102 this.executionTimeOnHiveTextBox.Size = new System.Drawing.Size( 577, 20);103 this.executionTimeOnHiveTextBox.Size = new System.Drawing.Size(475, 20); 103 104 this.executionTimeOnHiveTextBox.TabIndex = 8; 104 105 // … … 135 136 this.hiveExperimentListView.Name = "hiveExperimentListView"; 136 137 this.hiveExperimentListView.ReadOnly = false; 138 this.hiveExperimentListView.ShowDetails = true; 137 139 this.hiveExperimentListView.Size = new System.Drawing.Size(686, 428); 138 140 this.hiveExperimentListView.TabIndex = 0; … … 184 186 this.isPrivilegedCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 185 187 this.isPrivilegedCheckBox.AutoSize = true; 186 this.isPrivilegedCheckBox.Location = new System.Drawing.Point(6 23, 54);188 this.isPrivilegedCheckBox.Location = new System.Drawing.Point(610, 54); 187 189 this.isPrivilegedCheckBox.Name = "isPrivilegedCheckBox"; 188 190 this.isPrivilegedCheckBox.Size = new System.Drawing.Size(80, 17); … … 192 194 this.isPrivilegedCheckBox.Validated += new System.EventHandler(this.isPrivilegedCheckBox_Validated); 193 195 // 196 // pauseOnWaitCheckbox 197 // 198 this.pauseOnWaitCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 199 this.pauseOnWaitCheckbox.AutoSize = true; 200 this.pauseOnWaitCheckbox.Location = new System.Drawing.Point(610, 28); 201 this.pauseOnWaitCheckbox.Name = "pauseOnWaitCheckbox"; 202 this.pauseOnWaitCheckbox.Size = new System.Drawing.Size(93, 17); 203 this.pauseOnWaitCheckbox.TabIndex = 14; 204 this.pauseOnWaitCheckbox.Text = "Pause on wait"; 205 this.pauseOnWaitCheckbox.UseVisualStyleBackColor = true; 206 this.pauseOnWaitCheckbox.Validated += new System.EventHandler(this.pauseOnWaitCheckbox_Validated); 207 // 194 208 // HiveEngineView 195 209 // 196 210 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 197 211 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 212 this.Controls.Add(this.pauseOnWaitCheckbox); 198 213 this.Controls.Add(this.isPrivilegedCheckBox); 199 214 this.Controls.Add(this.executionTimeTextBox); … … 232 247 private RefreshableHiveJobListView hiveExperimentListView; 233 248 private System.Windows.Forms.CheckBox isPrivilegedCheckBox; 249 private System.Windows.Forms.CheckBox pauseOnWaitCheckbox; 234 250 } 235 251 } -
branches/HiveHiveEngine/HeuristicLab.HiveEngine.Views/3.3/HiveEngineView.cs
r7287 r7417 74 74 executionTimeOnHiveTextBox.Text = string.Empty; 75 75 isPrivilegedCheckBox.Checked = false; 76 pauseOnWaitCheckbox.Checked = true; 76 77 hiveExperimentListView.Content = null; 77 78 logView.Content = null; … … 83 84 hiveExperimentListView.Content = Content.Jobs; 84 85 logView.Content = Content.Log; 86 pauseOnWaitCheckbox.Checked = Content.PauseWhileCalculatingChilds; 85 87 } 86 88 } … … 112 114 Content.IsPrivileged = isPrivilegedCheckBox.Checked; 113 115 } 116 117 private void pauseOnWaitCheckbox_Validated(object sender, EventArgs e) { 118 Content.PauseWhileCalculatingChilds = pauseOnWaitCheckbox.Checked; 119 } 114 120 #endregion 115 121 } -
branches/HiveHiveEngine/HeuristicLab.HiveEngine/3.3/HiveEngine.cs
r7320 r7417 47 47 48 48 [Storable] 49 public bool PauseWhileCalculatingChilds { get; set; } 50 51 [Storable] 49 52 private IOperator currentOperator; 50 53 … … 131 134 username = cl.ClientCredentials.UserName.UserName; 132 135 password = cl.ClientCredentials.UserName.Password; 136 PauseWhileCalculatingChilds = true; 133 137 } 134 138 … … 157 161 this.nrOfSentRuns = original.nrOfSentRuns; 158 162 this.ParentTaskId = original.ParentTaskId; 163 this.PauseWhileCalculatingChilds = original.PauseWhileCalculatingChilds; 159 164 // do not clone jobs - otherwise they would be sent with every task 160 165 } … … 200 205 cancellationToken.ThrowIfCancellationRequested(); 201 206 202 if (continueCollection != null && lastJobGuid != Guid.Empty ) {207 if (continueCollection != null && lastJobGuid != Guid.Empty && PauseWhileCalculatingChilds) { 203 208 EngineTask[] eTasks = RetrieveResultsFromHive(lastJobGuid); 204 209 RestoreStateFromExecutedHiveTasks(eTasks, continueCollection); … … 224 229 225 230 var experiment = CreateJob(); 226 ExecuteOnHive(experiment, tasks, parentScopeClone, new CancellationToken()); 227 continueCollection = coll; 228 Pause(); 231 var engineTasks = ExecuteOnHive(experiment, tasks, parentScopeClone, new CancellationToken()); 232 if (PauseWhileCalculatingChilds) { 233 continueCollection = coll; 234 Pause(); 235 } else { 236 RestoreStateFromExecutedHiveTasks(engineTasks, coll); 237 } 229 238 } 230 239 catch { … … 304 313 305 314 /// <summary> 306 /// This method blocks until all jobs are finished307 315 /// TODO: Cancelation needs to be refined; all tasks currently stay in Semaphore.WaitOne after cancelation 308 316 /// </summary> 309 317 /// <param name="tasks"></param> 310 private voidExecuteOnHive(RefreshableJob refreshableJob, EngineTask[] tasks, IScope parentScopeClone, CancellationToken cancellationToken) {318 private EngineTask[] ExecuteOnHive(RefreshableJob refreshableJob, EngineTask[] tasks, IScope parentScopeClone, CancellationToken cancellationToken) { 311 319 log.LogMessage(string.Format("Executing {0} operations on the hive.", tasks.Length)); 312 320 IScope[] scopes = new Scope[tasks.Length]; … … 319 327 var engineHiveTask = new EngineHiveTask(tasks[i], parentScopeClone); 320 328 engineHiveTask.Task.Priority = this.Priority; 321 if (ParentTaskId != Guid.Empty ) {329 if (ParentTaskId != Guid.Empty && PauseWhileCalculatingChilds) { 322 330 engineHiveTask.Task.ParentTaskId = ParentTaskId; 323 331 } … … 325 333 326 334 // shuffle random variable to avoid the same random sequence in each operation; todo: does not yet work (it cannot find the random variable) 327 IRandom random = FindRandomParameter(tasks[i].InitialOperation as IExecutionContext);328 if (random != null)329 335 //IRandom random = FindRandomParameter(tasks[i].InitialOperation as IExecutionContext); 336 //if (random != null) 337 //random.Reset(random.Next()); 330 338 } 331 339 HiveClient.StartJob((e) => { log.LogException(e); }, refreshableJob, cancellationToken); … … 338 346 handle.WaitOne(); 339 347 refreshableJob.Progress.Finished -= new EventHandler(Progress_Finished); 348 349 if (!PauseWhileCalculatingChilds) { 350 351 while (!refreshableJob.AllJobsFinished()) { 352 Thread.Sleep(1000); 353 } 354 355 List<HiveTask> allHiveTasks = refreshableJob.HiveTasks.ToList(); 356 allHiveTasks.ForEach(x => this.ExecutionTimeOnHive += x.Task.ExecutionTime); 357 358 var failedJobs = allHiveTasks.Where(x => x.Task.State != TaskState.Finished); 359 if (failedJobs.Count() > 0) { 360 throw new HiveEngineException("Task (" + failedJobs.First().Task.Id + ") failed: " + failedJobs.First().Task.StateLog.Last().Exception); 361 } 362 363 List<EngineTask> engineTasks = new List<EngineTask>(); 364 365 foreach (var hTask in allHiveTasks) { 366 EngineTask ehTask = (EngineTask)hTask.ItemTask; 367 engineTasks.Add(ehTask); 368 } 369 370 jobs.Clear(); 371 DeleteHiveExperiment(refreshableJob.Id); 372 373 return engineTasks.ToArray(); 374 } else { 375 return null; 376 } 340 377 } 341 378 catch (OperationCanceledException e) {
Note: See TracChangeset
for help on using the changeset viewer.