- Timestamp:
- 04/12/11 13:43:05 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources
- Property svn:ignore
-
old new 4 4 PrecompiledWeb 5 5 CreateEventLogSources 6 WindowsFormsTestProject
-
- Property svn:ignore
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4
- Property svn:ignore
-
old new 2 2 obj 3 3 HeuristicLab.HiveEngine-3.4.csproj.vs10x 4 HeuristicLabHiveEnginePlugin.cs
-
- Property svn:ignore
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/HeuristicLab.HiveEngine-3.4.csproj
r5958 r6006 104 104 <Reference Include="HeuristicLab.Clients.Common-3.3"> 105 105 <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Clients.Common-3.3.dll</HintPath> 106 </Reference> 107 <Reference Include="HeuristicLab.Clients.Hive.Views-3.4"> 108 <HintPath>..\..\HeuristicLab.Clients.Hive.Views\3.4\obj\Debug\HeuristicLab.Clients.Hive.Views-3.4.dll</HintPath> 106 109 </Reference> 107 110 <Reference Include="HeuristicLab.Collections-3.3"> … … 162 165 <Compile Include="HiveEngine.cs" /> 163 166 <Compile Include="Exceptions\HiveEngineException.cs" /> 164 <Compile Include="Properties\AssemblyInfo.cs" /> 165 <None Include="Properties\AssemblyInfo.frame" /> 167 <None Include="Properties\AssemblyInfo.cs.frame" /> 166 168 </ItemGroup> 167 169 <ItemGroup> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/HiveEngine.cs
r6000 r6006 25 25 26 26 [Storable] 27 public string Resource Ids { get; set; }27 public string ResourceNames { get; set; } 28 28 29 29 [Storable] … … 46 46 } 47 47 48 [Storable] 49 private bool useLocalPlugins; 50 public bool UseLocalPlugins { 51 get { return useLocalPlugins; } 52 set { useLocalPlugins = value; } 53 } 54 55 [Storable] 56 private ItemCollection<HiveExperiment> hiveExperiments; 57 public ItemCollection<HiveExperiment> HiveExperiments { 58 get { return hiveExperiments; } 59 set { hiveExperiments = value; } 60 } 61 48 62 private List<Plugin> onlinePlugins; 49 63 public List<Plugin> OnlinePlugins { … … 60 74 #region constructors and cloning 61 75 public HiveEngine() { 62 ResourceIds = "HEAL"; 76 ResourceNames = "HEAL"; 77 HiveExperiments = new ItemCollection<HiveExperiment>(); 78 Priority = 0; 63 79 } 64 80 … … 67 83 protected HiveEngine(HiveEngine original, Cloner cloner) 68 84 : base(original, cloner) { 69 this.Resource Ids = original.ResourceIds;85 this.ResourceNames = original.ResourceNames; 70 86 this.currentOperator = cloner.Clone(original.currentOperator); 71 87 this.priority = original.priority; 72 88 this.executionTimeOnHive = original.executionTimeOnHive; 89 this.useLocalPlugins = original.useLocalPlugins; 73 90 } 74 91 public override IDeepCloneable Clone(Cloner cloner) { … … 123 140 124 141 IScope[] scopes = ExecuteOnHive(jobs, parentScopeClone, cancellationToken); 125 //IScope[] scopes = ExecuteLocally(jobs, parentScopeClone, cancellationToken);126 142 127 143 for (int i = 0; i < coll.Count; i++) { … … 186 202 } 187 203 188 private IScope[] ExecuteLocally(EngineJob[] jobs, IScope parentScopeClone, CancellationToken cancellationToken) { 189 IScope[] scopes = new Scope[jobs.Length]; 190 191 for (int i = 0; i < jobs.Length; i++) { 192 var job = (EngineJob)jobs[i].Clone(); 193 job.Start(); 194 while (job.ExecutionState != ExecutionState.Stopped) { 195 Thread.Sleep(100); 196 } 197 scopes[i] = ((IAtomicOperation)job.InitialOperation).Scope; 198 } 199 200 return scopes; 201 } 204 // testfunction: 205 //private IScope[] ExecuteLocally(EngineJob[] jobs, IScope parentScopeClone, CancellationToken cancellationToken) { 206 // IScope[] scopes = new Scope[jobs.Length]; 207 // for (int i = 0; i < jobs.Length; i++) { 208 // var job = (EngineJob)jobs[i].Clone(); 209 // job.Start(); 210 // while (job.ExecutionState != ExecutionState.Stopped) { 211 // Thread.Sleep(100); 212 // } 213 // scopes[i] = ((IAtomicOperation)job.InitialOperation).Scope; 214 // } 215 // return scopes; 216 //} 202 217 203 218 /// <summary> … … 211 226 object locker = new object(); 212 227 IDictionary<Guid, int> jobIndices = new Dictionary<Guid, int>(); 228 var hiveExperiment = new HiveExperiment();; 213 229 214 230 try { … … 218 234 int finishedCount = 0; 219 235 int uploadCount = 0; 236 237 // create hive experiment 238 hiveExperiment.Name = "HiveEngine Run " + hiveExperiments.Count; 239 hiveExperiment.UseLocalPlugins = this.UseLocalPlugins; 240 hiveExperiment.ResourceNames = this.ResourceNames; 241 hiveExperiment.RefreshAutomatically = false; 242 hiveExperiment.Id = ServiceLocator.Instance.CallHiveService(s => s.AddHiveExperiment(hiveExperiment)); 243 hiveExperiments.Add(hiveExperiment); 220 244 221 245 // create upload-tasks … … 230 254 231 255 uploadTasks.Add(Task.Factory.StartNew<Job>((keyValuePairObj) => { 232 return UploadJob(keyValuePairObj, parentScopeClone, cancellationToken, GetResourceIds() );256 return UploadJob(keyValuePairObj, parentScopeClone, cancellationToken, GetResourceIds(), hiveExperiment.Id); 233 257 }, new KeyValuePair<int, EngineJob>(i, job), cancellationToken)); 234 258 } … … 313 337 314 338 LogMessage(string.Format("All jobs finished (TotalExecutionTime: {0}).", executionTimes.Sum())); 315 Delete Jobs(jobIndices);339 DeleteHiveExperiment(hiveExperiment.Id); 316 340 317 341 return scopes; … … 319 343 catch (OperationCanceledException e) { 320 344 lock (locker) { 321 if (jobIndices != null) Delete Jobs(jobIndices);345 if (jobIndices != null) DeleteHiveExperiment(hiveExperiment.Id); 322 346 } 323 347 throw e; … … 325 349 catch (Exception e) { 326 350 lock (locker) { 327 if (jobIndices != null) Delete Jobs(jobIndices);351 if (jobIndices != null) DeleteHiveExperiment(hiveExperiment.Id); 328 352 } 329 353 LogException(e); … … 332 356 } 333 357 334 private void DeleteJobs(IDictionary<Guid, int> jobIndices) { 335 if (jobIndices.Count > 0) { 336 TryAndRepeat(() => { 337 LogMessage(string.Format("Deleting {0} jobs on hive.", jobIndices.Count)); 338 ServiceLocator.Instance.CallHiveService(service => { 339 foreach (Guid jobId in jobIndices.Keys) { 340 service.DeleteJob(jobId); 341 } 342 jobIndices.Clear(); 343 }); 344 }, 5, string.Format("Could not delete {0} jobs", jobIndices.Count)); 345 } 358 private void DeleteHiveExperiment(Guid hiveExperimentId) { 359 TryAndRepeat(() => { 360 ServiceLocator.Instance.CallHiveService(s => s.DeleteHiveExperiment(hiveExperimentId)); 361 }, 5, string.Format("Could not delete jobs")); 346 362 } 347 363 348 364 private static object locker = new object(); 349 private Job UploadJob(object keyValuePairObj, IScope parentScopeClone, CancellationToken cancellationToken, List<Guid> resourceIds ) {365 private Job UploadJob(object keyValuePairObj, IScope parentScopeClone, CancellationToken cancellationToken, List<Guid> resourceIds, Guid hiveExperimentId) { 350 366 var keyValuePair = (KeyValuePair<int, EngineJob>)keyValuePairObj; 351 367 Job job = new Job(); … … 370 386 job.PluginsNeededIds = ServiceLocator.Instance.CallHiveService(s => PluginUtil.GetPluginDependencies(s, this.OnlinePlugins, this.AlreadyUploadedPlugins, neededPlugins, false)); 371 387 job.Priority = priority; 388 job.HiveExperimentId = hiveExperimentId; 372 389 373 390 try { … … 396 413 private List<Guid> GetResourceIds() { 397 414 return ServiceLocator.Instance.CallHiveService(service => { 398 var resourceNames = Resource Ids.Split(';');415 var resourceNames = ResourceNames.Split(';'); 399 416 var resourceIds = new List<Guid>(); 400 417 foreach (var resourceName in resourceNames) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/Properties
-
Property
svn:ignore
set to
AssemblyInfo.cs
-
Property
svn:ignore
set to
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/Views/HiveEngineView.Designer.cs
r5958 r6006 30 30 this.label1 = new System.Windows.Forms.Label(); 31 31 this.executionTimeOnHiveTextBox = new System.Windows.Forms.TextBox(); 32 this.tabControl = new System.Windows.Forms.TabControl(); 33 this.jobsTabPage = new System.Windows.Forms.TabPage(); 34 this.hiveExperimentListView = new HeuristicLab.Clients.Hive.Views.HiveExperimentListView(); 35 this.logTabPage = new System.Windows.Forms.TabPage(); 36 this.logView = new HeuristicLab.Core.Views.LogView(); 37 this.executionTimeLabel = new System.Windows.Forms.Label(); 38 this.executionTimeTextBox = new System.Windows.Forms.TextBox(); 39 this.useLocalPluginsCheckBox = new System.Windows.Forms.CheckBox(); 40 this.tabControl.SuspendLayout(); 41 this.jobsTabPage.SuspendLayout(); 42 this.logTabPage.SuspendLayout(); 32 43 this.SuspendLayout(); 33 //34 // executionTimeTextBox35 //36 this.executionTimeTextBox.Size = new System.Drawing.Size(623, 20);37 //38 // logView39 //40 this.logView.Location = new System.Drawing.Point(0, 78);41 this.logView.Size = new System.Drawing.Size(715, 469);42 44 // 43 45 // resourceIdsLabel … … 57 59 this.resourceIdsTextBox.Location = new System.Drawing.Point(189, 52); 58 60 this.resourceIdsTextBox.Name = "resourceIdsTextBox"; 59 this.resourceIdsTextBox.Size = new System.Drawing.Size( 526, 20);61 this.resourceIdsTextBox.Size = new System.Drawing.Size(405, 20); 60 62 this.resourceIdsTextBox.TabIndex = 4; 61 63 this.resourceIdsTextBox.Text = "HEAL"; … … 97 99 this.executionTimeOnHiveTextBox.Name = "executionTimeOnHiveTextBox"; 98 100 this.executionTimeOnHiveTextBox.ReadOnly = true; 99 this.executionTimeOnHiveTextBox.Size = new System.Drawing.Size(5 86, 20);101 this.executionTimeOnHiveTextBox.Size = new System.Drawing.Size(577, 20); 100 102 this.executionTimeOnHiveTextBox.TabIndex = 8; 103 // 104 // tabControl 105 // 106 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 107 | System.Windows.Forms.AnchorStyles.Left) 108 | System.Windows.Forms.AnchorStyles.Right))); 109 this.tabControl.Controls.Add(this.jobsTabPage); 110 this.tabControl.Controls.Add(this.logTabPage); 111 this.tabControl.Location = new System.Drawing.Point(3, 78); 112 this.tabControl.Name = "tabControl"; 113 this.tabControl.SelectedIndex = 0; 114 this.tabControl.Size = new System.Drawing.Size(700, 460); 115 this.tabControl.TabIndex = 9; 116 // 117 // jobsTabPage 118 // 119 this.jobsTabPage.Controls.Add(this.hiveExperimentListView); 120 this.jobsTabPage.Location = new System.Drawing.Point(4, 22); 121 this.jobsTabPage.Name = "jobsTabPage"; 122 this.jobsTabPage.Padding = new System.Windows.Forms.Padding(3); 123 this.jobsTabPage.Size = new System.Drawing.Size(692, 434); 124 this.jobsTabPage.TabIndex = 0; 125 this.jobsTabPage.Text = "Jobs"; 126 this.jobsTabPage.UseVisualStyleBackColor = true; 127 // 128 // hiveExperimentListView 129 // 130 this.hiveExperimentListView.Caption = "HiveExperimentList View"; 131 this.hiveExperimentListView.Content = null; 132 this.hiveExperimentListView.Dock = System.Windows.Forms.DockStyle.Fill; 133 this.hiveExperimentListView.Location = new System.Drawing.Point(3, 3); 134 this.hiveExperimentListView.Name = "hiveExperimentListView"; 135 this.hiveExperimentListView.ReadOnly = false; 136 this.hiveExperimentListView.Size = new System.Drawing.Size(686, 428); 137 this.hiveExperimentListView.TabIndex = 0; 138 // 139 // logTabPage 140 // 141 this.logTabPage.Controls.Add(this.logView); 142 this.logTabPage.Location = new System.Drawing.Point(4, 22); 143 this.logTabPage.Name = "logTabPage"; 144 this.logTabPage.Padding = new System.Windows.Forms.Padding(3); 145 this.logTabPage.Size = new System.Drawing.Size(692, 434); 146 this.logTabPage.TabIndex = 1; 147 this.logTabPage.Text = "Log"; 148 this.logTabPage.UseVisualStyleBackColor = true; 149 // 150 // logView 151 // 152 this.logView.Caption = "SlaveView"; 153 this.logView.Content = null; 154 this.logView.Dock = System.Windows.Forms.DockStyle.Fill; 155 this.logView.Location = new System.Drawing.Point(3, 3); 156 this.logView.Name = "logView"; 157 this.logView.ReadOnly = false; 158 this.logView.Size = new System.Drawing.Size(686, 428); 159 this.logView.TabIndex = 0; 160 // 161 // executionTimeLabel 162 // 163 this.executionTimeLabel.AutoSize = true; 164 this.executionTimeLabel.Location = new System.Drawing.Point(4, 6); 165 this.executionTimeLabel.Name = "executionTimeLabel"; 166 this.executionTimeLabel.Size = new System.Drawing.Size(83, 13); 167 this.executionTimeLabel.TabIndex = 10; 168 this.executionTimeLabel.Text = "Execution Time:"; 169 // 170 // executionTimeTextBox 171 // 172 this.executionTimeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 173 | System.Windows.Forms.AnchorStyles.Left) 174 | System.Windows.Forms.AnchorStyles.Right))); 175 this.executionTimeTextBox.Location = new System.Drawing.Point(129, 3); 176 this.executionTimeTextBox.Name = "executionTimeTextBox"; 177 this.executionTimeTextBox.ReadOnly = true; 178 this.executionTimeTextBox.Size = new System.Drawing.Size(577, 20); 179 this.executionTimeTextBox.TabIndex = 11; 180 // 181 // useLocalPluginsCheckBox 182 // 183 this.useLocalPluginsCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 184 this.useLocalPluginsCheckBox.AutoSize = true; 185 this.useLocalPluginsCheckBox.Location = new System.Drawing.Point(600, 55); 186 this.useLocalPluginsCheckBox.Name = "useLocalPluginsCheckBox"; 187 this.useLocalPluginsCheckBox.Size = new System.Drawing.Size(103, 17); 188 this.useLocalPluginsCheckBox.TabIndex = 12; 189 this.useLocalPluginsCheckBox.Text = "useLocalPlugins"; 190 this.useLocalPluginsCheckBox.UseVisualStyleBackColor = true; 191 this.useLocalPluginsCheckBox.CheckedChanged += new System.EventHandler(this.useLocalPluginsCheckBox_CheckedChanged); 101 192 // 102 193 // HiveEngineView … … 104 195 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 105 196 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 197 this.Controls.Add(this.useLocalPluginsCheckBox); 198 this.Controls.Add(this.executionTimeTextBox); 199 this.Controls.Add(this.executionTimeLabel); 200 this.Controls.Add(this.tabControl); 106 201 this.Controls.Add(this.label1); 107 202 this.Controls.Add(this.executionTimeOnHiveTextBox); … … 111 206 this.Controls.Add(this.resourceIdsTextBox); 112 207 this.Name = "HiveEngineView"; 113 this.Size = new System.Drawing.Size(715, 550); 114 this.Controls.SetChildIndex(this.resourceIdsTextBox, 0); 115 this.Controls.SetChildIndex(this.resourceIdsLabel, 0); 116 this.Controls.SetChildIndex(this.priorityLabel, 0); 117 this.Controls.SetChildIndex(this.priorityTextBox, 0); 118 this.Controls.SetChildIndex(this.logView, 0); 119 this.Controls.SetChildIndex(this.executionTimeLabel, 0); 120 this.Controls.SetChildIndex(this.executionTimeTextBox, 0); 121 this.Controls.SetChildIndex(this.executionTimeOnHiveTextBox, 0); 122 this.Controls.SetChildIndex(this.label1, 0); 208 this.Size = new System.Drawing.Size(706, 541); 209 this.tabControl.ResumeLayout(false); 210 this.jobsTabPage.ResumeLayout(false); 211 this.logTabPage.ResumeLayout(false); 123 212 this.ResumeLayout(false); 124 213 this.PerformLayout(); … … 134 223 private System.Windows.Forms.Label label1; 135 224 protected System.Windows.Forms.TextBox executionTimeOnHiveTextBox; 225 private System.Windows.Forms.TabControl tabControl; 226 private System.Windows.Forms.TabPage jobsTabPage; 227 private System.Windows.Forms.TabPage logTabPage; 228 private System.Windows.Forms.Label executionTimeLabel; 229 protected System.Windows.Forms.TextBox executionTimeTextBox; 230 private System.Windows.Forms.CheckBox useLocalPluginsCheckBox; 231 private HeuristicLab.Core.Views.LogView logView; 232 private Clients.Hive.Views.HiveExperimentListView hiveExperimentListView; 136 233 } 137 234 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/Views/HiveEngineView.cs
r5958 r6006 1 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Drawing; 5 using System.Data; 6 using System.Linq; 7 using System.Text; 2 using HeuristicLab.Core.Views; 8 3 using HeuristicLab.MainForm; 9 using HeuristicLab.Optimization.Views;10 using HeuristicLab.Core.Views;11 4 12 5 namespace HeuristicLab.HiveEngine.Views { 13 6 [View("Hive Engine View")] 14 7 [Content(typeof(HiveEngine), IsDefaultView = true)] 15 public sealed partial class HiveEngineView : EngineView {8 public sealed partial class HiveEngineView : ItemView { 16 9 public new HiveEngine Content { 17 10 get { return (HiveEngine)base.Content; } … … 24 17 25 18 protected override void DeregisterContentEvents() { 19 Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged); 26 20 Content.ExecutionTimeOnHiveChanged -= new EventHandler(Content_ExecutionTimeOnHiveChanged); 27 21 base.DeregisterContentEvents(); … … 30 24 protected override void RegisterContentEvents() { 31 25 base.RegisterContentEvents(); 26 Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged); 32 27 Content.ExecutionTimeOnHiveChanged += new EventHandler(Content_ExecutionTimeOnHiveChanged); 33 28 } 34 29 35 30 #region Event Handlers (Content) 31 private void Content_ExecutionStateChanged(object sender, EventArgs e) { 32 if (InvokeRequired) { 33 Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e); 34 } else { 35 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 36 } 37 } 38 36 39 private void Content_ExecutionTimeOnHiveChanged(object sender, EventArgs e) { 37 40 if (InvokeRequired) { … … 49 52 priorityTextBox.Text = string.Empty; 50 53 executionTimeOnHiveTextBox.Text = string.Empty; 54 useLocalPluginsCheckBox.Checked = false; 55 hiveExperimentListView.Content = null; 56 logView.Content = null; 51 57 } else { 52 resourceIdsTextBox.Text = Content.Resource Ids;58 resourceIdsTextBox.Text = Content.ResourceNames; 53 59 priorityTextBox.Text = Content.Priority.ToString(); 54 60 executionTimeOnHiveTextBox.Text = Content.ExecutionTimeOnHive.ToString(); 61 useLocalPluginsCheckBox.Checked = Content.UseLocalPlugins; 62 hiveExperimentListView.Content = Content.HiveExperiments; 63 logView.Content = Content.Log; 55 64 } 56 65 } … … 62 71 resourceIdsTextBox.ReadOnly = this.ReadOnly; 63 72 priorityTextBox.ReadOnly = this.ReadOnly; 73 useLocalPluginsCheckBox.Enabled = !this.ReadOnly; 64 74 } else { 65 75 resourceIdsTextBox.ReadOnly = false; 66 76 priorityTextBox.ReadOnly = false; 77 useLocalPluginsCheckBox.Enabled = false; 67 78 } 68 79 } … … 70 81 #region Event Handlers (child controls) 71 82 private void resourceIdsTextBox_TextChanged(object sender, EventArgs e) { 72 Content.Resource Ids = resourceIdsTextBox.Text;83 Content.ResourceNames = resourceIdsTextBox.Text; 73 84 } 74 #endregion75 85 76 86 private void priorityTextBox_TextChanged(object sender, EventArgs e) { 77 87 Content.Priority = int.Parse(priorityTextBox.Text); 78 88 } 89 90 private void useLocalPluginsCheckBox_CheckedChanged(object sender, EventArgs e) { 91 Content.UseLocalPlugins = useLocalPluginsCheckBox.Checked; 92 } 93 #endregion 94 95 79 96 } 80 97 }
Note: See TracChangeset
for help on using the changeset viewer.