- Timestamp:
- 01/31/11 18:15:15 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveExperimentClient.cs
r5155 r5402 29 29 using HeuristicLab.Services.Hive.Common; 30 30 using HeuristicLab.Services.Hive.Common.ServiceContracts; 31 using HeuristicLab.Services.Hive.Common.DataTransfer; 32 using HeuristicLab.Clients.Hive.Jobs; 33 using HeuristicLab.Clients.Common; 34 using HeuristicLab.Optimization; 31 35 32 36 namespace HeuristicLab.Clients.Hive { 33 37 using DT = HeuristicLab.Services.Hive.Common.DataTransfer; 34 using HeuristicLab.Services.Hive.Common.DataTransfer; 35 using HeuristicLab.Clients.Hive.Jobs; 36 using HeuristicLab.Clients.Common; 38 using HeuristicLab.PluginInfrastructure; 39 using System.IO; 37 40 38 41 /// <summary> … … 111 114 } 112 115 116 private List<Guid> pluginsNeededIds; 117 public List<Guid> PluginsNeededIds { 118 get { return pluginsNeededIds; } 119 set { pluginsNeededIds = value; } 120 } 121 122 private bool useLocalPlugins; 123 public bool UseLocalPlugins { 124 get { return useLocalPlugins; } 125 set { useLocalPlugins = value; } 126 } 127 113 128 public HiveExperimentClient() : base(itemName, itemDescription) { 114 129 // TODO //this.ResourceIds = HeuristicLab.Hive.Experiment.Properties.Settings.Default.ResourceIds; 115 this.ResourceIds = " MyGroup";130 this.ResourceIds = "HEAL"; 116 131 this.log = new Log(); 117 132 InitTimer(); … … 151 166 } 152 167 153 public void SetExperiment( Optimization.Experiment experiment) {168 public void SetExperiment(Experiment experiment) { 154 169 this.HiveJob = new HiveJob(experiment); 155 170 Prepare(); … … 171 186 /// Returns the experiment from the root HiveJob 172 187 /// </summary> 173 public Optimization.Experiment GetExperiment() {188 public Experiment GetExperiment() { 174 189 if (this.HiveJob != null) { 175 190 return HiveJob.OptimizerJob.OptimizerAsExperiment; … … 179 194 180 195 #region IExecutable Members 181 private Core.ExecutionState executionState;196 private ExecutionState executionState; 182 197 public ExecutionState ExecutionState { 183 198 get { return executionState; } … … 231 246 int jobCount = 0; 232 247 248 this.progress.Status = "Uploading plugins..."; 249 this.PluginsNeededIds = GetPluginsNeededIds(this.useLocalPlugins); 250 233 251 this.progress.Status = "Uploading jobs..."; 234 252 UploadJobWithChildren(service.Obj, this.HiveJob, null, groups, ref jobCount, totalJobCount); … … 251 269 IsProgressing = false; 252 270 } 271 } 272 273 /// <summary> 274 /// Gets the Ids of all plugins needed for executing the job. 275 /// All loaded plugins are assumed to be necessary. 276 /// If a plugin with the same name and version is already online, it is used. Otherwise the local plugin is uploaded. 277 /// If useLocalPlugins is true, all local plugins are uploaded regardless of the existence of the same plugin online. 278 /// </summary> 279 public static List<Guid> GetPluginsNeededIds(bool useLocalPlugins) { 280 IEnumerable<IPluginDescription> localPlugins = ApplicationManager.Manager.Plugins; 281 List<Guid> pluginsNeededIds = new List<Guid>(); 282 283 using (var service = ServiceLocator.Instance.GetService()) { 284 IEnumerable<Plugin> onlinePlugins = service.Obj.GetPlugins(); 285 286 foreach (IPluginDescription localPlugin in localPlugins) { 287 Plugin found = onlinePlugins.Where(onlinePlugin => onlinePlugin.Name == localPlugin.Name && onlinePlugin.Version == localPlugin.Version).SingleOrDefault(); 288 if (!useLocalPlugins && found != null) { 289 // plugin is available online; reuse 290 pluginsNeededIds.Add(found.Id); 291 } else { 292 // upload the plugin 293 Plugin p = new Plugin() { Name = localPlugin.Name, Version = localPlugin.Version, IsLocal = useLocalPlugins }; 294 List<PluginData> pluginDatas = new List<PluginData>(); 295 296 foreach (IPluginFile pf in localPlugin.Files) { 297 PluginData pluginData = new PluginData(); 298 299 pluginData.Data = File.ReadAllBytes(pf.Name); 300 pluginDatas.Add(pluginData); 301 } 302 pluginsNeededIds.Add(service.Obj.AddPlugin(p, pluginDatas)); 303 } 304 } 305 } 306 return pluginsNeededIds; 253 307 } 254 308 … … 273 327 jobData = hiveJob.GetAsJobData(false); 274 328 } 329 330 hiveJob.Job.PluginsNeededIds = this.PluginsNeededIds; 275 331 276 332 this.progress.Status = string.Format("Uploading job {0} of {1} ({2} kb)", jobCount, totalJobCount, jobData.Data.Count() / 1024); … … 618 674 } 619 675 } 676 620 677 } 621 678 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveExperimentManagerClient.cs
r5055 r5402 137 137 } 138 138 139 void hiveExperiments_ItemsRemoved(object sender, Collection s.CollectionItemsChangedEventArgs<Collections.IndexedItem<HiveExperimentClient>> e) {139 void hiveExperiments_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<HiveExperimentClient>> e) { 140 140 if (!currentlyUpdating) { 141 141 using (Disposable<IHiveService> service = ServiceLocator.Instance.GetService()) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobClient.cs
r5363 r5402 107 107 public HiveJob() { 108 108 this.Job = new Job() { 109 JobState = JobState. Waiting,109 JobState = JobState.Offline, 110 110 DateCreated = DateTime.Now, 111 111 CoresNeeded = 1, … … 191 191 if (OptimizerJob.Optimizer is Optimization.Experiment) { 192 192 Optimization.Experiment experiment = OptimizerJob.OptimizerAsExperiment; 193 experiment.Optimizers.ItemsAdded += new Collection s.CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsAdded);194 experiment.Optimizers.ItemsReplaced += new Collection s.CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsReplaced);195 experiment.Optimizers.ItemsRemoved += new Collection s.CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsRemoved);193 experiment.Optimizers.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsAdded); 194 experiment.Optimizers.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsReplaced); 195 experiment.Optimizers.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsRemoved); 196 196 experiment.Optimizers.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_CollectionReset); 197 197 } else if (OptimizerJob.Optimizer is Optimization.BatchRun) { … … 208 208 if (OptimizerJob.Optimizer is Optimization.Experiment) { 209 209 Optimization.Experiment experiment = OptimizerJob.OptimizerAsExperiment; 210 experiment.Optimizers.ItemsAdded -= new Collection s.CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsAdded);211 experiment.Optimizers.ItemsReplaced -= new Collection s.CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsReplaced);212 experiment.Optimizers.ItemsRemoved -= new Collection s.CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsRemoved);210 experiment.Optimizers.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsAdded); 211 experiment.Optimizers.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsReplaced); 212 experiment.Optimizers.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsRemoved); 213 213 experiment.Optimizers.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_CollectionReset); 214 214 } else if (OptimizerJob.Optimizer is Optimization.BatchRun) { … … 222 222 } 223 223 224 void batchRun_OptimizerChanged(object sender, EventArgs e) {224 private void batchRun_OptimizerChanged(object sender, EventArgs e) { 225 225 if (syncJobsWithOptimizers) { 226 226 this.childHiveJobs.Clear(); … … 229 229 } 230 230 231 void batchRun_RepetitionsChanged(object sender, EventArgs e) {231 private void batchRun_RepetitionsChanged(object sender, EventArgs e) { 232 232 if (syncJobsWithOptimizers) { 233 233 UpdateChildHiveJobs(); … … 235 235 } 236 236 237 void OptimizerJob_ToStringChanged(object sender, EventArgs e) {237 private void OptimizerJob_ToStringChanged(object sender, EventArgs e) { 238 238 this.OnToStringChanged(); 239 239 } … … 267 267 } 268 268 } 269 void Optimizers_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) {269 private void Optimizers_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) { 270 270 if (syncJobsWithOptimizers && this.OptimizerJob.ComputeInParallel) { 271 271 foreach (var item in e.Items) { … … 275 275 } 276 276 277 void OptimizerJob_ComputeInParallelChanged(object sender, EventArgs e) {277 private void OptimizerJob_ComputeInParallelChanged(object sender, EventArgs e) { 278 278 if (OptimizerJob != null && syncJobsWithOptimizers) { 279 279 if (OptimizerJob.ComputeInParallel) { … … 445 445 } 446 446 447 UpdateRequiredPlugins();448 449 447 JobData jobData = new JobData() { 450 448 JobId = job.Id, … … 453 451 454 452 return jobData; 455 }456 457 /// <summary>458 /// find out which which plugins are needed for the given object459 /// </summary>460 private void UpdateRequiredPlugins() {461 List<Guid> pluginList = new List<Guid>();462 463 IEnumerable<IPluginDescription> neededPlugins = ApplicationManager.Manager.Plugins; //HivePluginInfoDto.FindPluginsNeeded(optimizerJob.GetType());464 using (var service = ServiceLocator.Instance.GetService()) {465 IEnumerable<Plugin> availablePlugins = service.Obj.GetPlugins();466 foreach (IPluginDescription neededPlugin in neededPlugins) {467 Plugin found = availablePlugins.Where(availablePlugin => availablePlugin.Name == neededPlugin.Name && availablePlugin.Version.Major == neededPlugin.Version.Major && availablePlugin.Version.Minor == neededPlugin.Version.Minor && availablePlugin.Version.Revision == neededPlugin.Version.Revision && availablePlugin.Version.MinorRevision == neededPlugin.Version.MinorRevision).SingleOrDefault();468 if (found != null) {469 pluginList.Add(found.Id);470 } else {471 Plugin p = new Plugin() { Name = neededPlugin.Name, Version = neededPlugin.Version };472 List<PluginData> pluginDatas = new List<PluginData>();473 474 foreach (IPluginFile pf in neededPlugin.Files) {475 PluginData pluginData = new PluginData();476 477 pluginData.Data = File.ReadAllBytes(pf.Name);478 pluginDatas.Add(pluginData);479 }480 pluginList.Add(service.Obj.AddPlugin(p, pluginDatas));481 }482 }483 }484 this.Job.PluginsNeededIds = pluginList;485 453 } 486 454 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HeuristicLab.Clients.Hive-3.4.csproj
r5264 r5402 37 37 <PropertyGroup> 38 38 <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile> 39 </PropertyGroup> 40 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> 41 <DebugSymbols>true</DebugSymbols> 42 <OutputPath>bin\x86\Debug\</OutputPath> 43 <DefineConstants>DEBUG;TRACE</DefineConstants> 44 <DebugType>full</DebugType> 45 <PlatformTarget>x86</PlatformTarget> 46 <CodeAnalysisLogFile>bin\Debug\HeuristicLab.Clients.Hive-3.4.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile> 47 <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> 48 <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> 49 <ErrorReport>prompt</ErrorReport> 50 <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> 51 <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories> 52 <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets> 53 <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories> 54 <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules> 55 </PropertyGroup> 56 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> 57 <OutputPath>bin\x86\Release\</OutputPath> 58 <DefineConstants>TRACE</DefineConstants> 59 <Optimize>true</Optimize> 60 <DebugType>pdbonly</DebugType> 61 <PlatformTarget>x86</PlatformTarget> 62 <CodeAnalysisLogFile>bin\Release\HeuristicLab.Clients.Hive-3.4.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile> 63 <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> 64 <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> 65 <ErrorReport>prompt</ErrorReport> 66 <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> 67 <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories> 68 <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets> 69 <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories> 70 <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules> 39 71 </PropertyGroup> 40 72 <ItemGroup> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/app.config
r5264 r5402 15 15 </bindings> 16 16 <client> 17 <endpoint address="http://localhost :9000/Hive-3.4" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding" contract="HeuristicLab.Services.Hive.Common.ServiceContracts.IHiveService" name="wsHttpBinding_IHiveService">17 <endpoint address="http://localhost/Hive-3.4/HiveService.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding" contract="HeuristicLab.Services.Hive.Common.ServiceContracts.IHiveService" name="wsHttpBinding_IHiveService"> 18 18 <identity> 19 19 <certificate encodedValue="AwAAAAEAAAAUAAAAfEKvcVixnJay+q4hCPFuO0JL5TQgAAAAAQAAAPIBAAAwggHuMIIBW6ADAgECAhCNN5wrUcXMmE/9xwp4TYa9MAkGBSsOAwIdBQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEwMTAxOTEwNTMxNVoXDTM5MTIzMTIzNTk1OVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXwC5TGcAffd/0oAWHtm0s6YXVXEgXgb1AYmBkkkhkKIFJG/e/Z0KSYbJepmSJD44W3oOAVm+x1DAsZxU79HahDYgWCuHLMm1TLpwSmYOQ0kV3pGHWHhiWV7h7oGLds/eqZ2EOpaNGryfEPnrA4VmxY91vV5/2BTeVSWG6F8lRKQIDAQABo0kwRzBFBgNVHQEEPjA8gBAR7kBnMRHO5gzThEqda0wWoRYwFDESMBAGA1UEAxMJbG9jYWxob3N0ghCNN5wrUcXMmE/9xwp4TYa9MAkGBSsOAwIdBQADgYEAoPwEG4QTDXhlxERNDfsZmM2IhEpV42ppz1kEah2oYKDa/ElIMVtvqLv6flVtg18ENN/mEJWiHZ3NyP3qr2Pip+sh+/2WBiSbOaukES/CM7OJn9kJCImH7M/xqM8pxqY8IfgM6iBVrVj9uHqj3j2BBck+cYY8fKyh3CFifMIp6ac="/>
Note: See TracChangeset
for help on using the changeset viewer.