- Timestamp:
- 06/16/11 12:39:32 (13 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/HiveClient.cs
r6419 r6426 219 219 this.OnlinePlugins = service.GetPlugins(); 220 220 this.AlreadyUploadedPlugins = new List<Plugin>(); 221 Plugin configFilePlugin = UploadConfigurationFile(service );221 Plugin configFilePlugin = UploadConfigurationFile(service, onlinePlugins); 222 222 this.alreadyUploadedPlugins.Add(configFilePlugin); 223 223 … … 226 226 227 227 foreach (HiveJob hiveJob in refreshableHiveExperiment.HiveExperiment.HiveJobs) { 228 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 UploadJobWithChildren(refreshableHiveExperiment.HiveExperiment.Progress, service, hiveJob, null, resourceIds, ref jobCount, totalJobCount, configFilePlugin.Id, refreshableHiveExperiment.HiveExperiment.Id, refreshableHiveExperiment.Log, refreshableHiveExperiment.HiveExperiment.IsPrivileged); 229 229 } 230 230 … … 240 240 /// Uploads the local configuration file as plugin 241 241 /// </summary> 242 private static Plugin UploadConfigurationFile(IHiveService service ) {242 private static Plugin UploadConfigurationFile(IHiveService service, List<Plugin> onlinePlugins) { 243 243 string exeFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "HeuristicLab 3.3.exe"); 244 244 string configFileName = Path.GetFileName(ConfigurationManager.OpenExeConfiguration(exeFilePath).FilePath); … … 251 251 } 252 252 253 Plugin configPlugin = new Plugin() { Name = "Configuration", IsLocal = true,Version = new Version(), Hash = hash };253 Plugin configPlugin = new Plugin() { Name = "Configuration", Version = new Version(), Hash = hash }; 254 254 PluginData configFile = new PluginData() { FileName = configFileName, Data = data }; 255 configPlugin.Id = service.AddPlugin(configPlugin, new List<PluginData> { configFile }); 256 return configPlugin; 255 256 IEnumerable<Plugin> onlineConfig = onlinePlugins.Where(p => p.Hash.SequenceEqual(hash)); 257 258 if (onlineConfig.Count() > 0) { 259 return onlineConfig.First(); 260 } else { 261 configPlugin.Id = service.AddPlugin(configPlugin, new List<PluginData> { configFile }); 262 return configPlugin; 263 } 257 264 } 258 265 … … 264 271 /// <param name="parentHiveJob">shall be null if its the root job</param> 265 272 /// <param name="groups"></param> 266 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) {273 private void UploadJobWithChildren(IProgress progress, IHiveService service, HiveJob hiveJob, HiveJob parentHiveJob, IEnumerable<Guid> groups, ref int jobCount, int totalJobCount, Guid configPluginId, Guid hiveExperimentId, ILog log, bool isPrivileged) { 267 274 jobCount++; 268 275 progress.Status = string.Format("Serializing job {0} of {1}", jobCount, totalJobCount); … … 281 288 282 289 TryAndRepeat(() => { 283 hiveJob.Job.PluginsNeededIds = PluginUtil.GetPluginDependencies(service, this.onlinePlugins, this.alreadyUploadedPlugins, plugins , useLocalPlugins);290 hiveJob.Job.PluginsNeededIds = PluginUtil.GetPluginDependencies(service, this.onlinePlugins, this.alreadyUploadedPlugins, plugins); 284 291 }, -1, "Failed to upload plugins"); 285 292 hiveJob.Job.PluginsNeededIds.Add(configPluginId); … … 300 307 301 308 foreach (HiveJob child in hiveJob.ChildHiveJobs) { 302 UploadJobWithChildren(progress, service, child, hiveJob, groups, ref jobCount, totalJobCount, configPluginId, useLocalPlugins,hiveExperimentId, log, isPrivileged);309 UploadJobWithChildren(progress, service, child, hiveJob, groups, ref jobCount, totalJobCount, configPluginId, hiveExperimentId, log, isPrivileged); 303 310 } 304 311 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveExperiment.cs
r6419 r6426 30 30 namespace HeuristicLab.Clients.Hive { 31 31 public partial class HiveExperiment : IDeepCloneable, IContent, IProgressReporter { 32 private bool useLocalPlugins;33 public bool UseLocalPlugins {34 get { return useLocalPlugins; }35 set { useLocalPlugins = value; }36 }37 32 38 33 private bool isPrivileged; … … 115 110 this.Id = original.Id; 116 111 this.HiveJobs = cloner.Clone(original.HiveJobs); 117 this.UseLocalPlugins = original.UseLocalPlugins;118 112 this.ExecutionTime = original.ExecutionTime; 119 113 this.IsPrivileged = original.IsPrivileged; … … 213 207 OnHiveJobsAdded(e); 214 208 } 215 209 216 210 private void item_StateLogChanged(object sender, EventArgs e) { 217 211 OnStateLogListChanged(); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveServiceClient.cs
r6407 r6426 514 514 515 515 [System.Runtime.Serialization.OptionalFieldAttribute()] 516 private bool IsLocalField;517 518 [System.Runtime.Serialization.OptionalFieldAttribute()]519 516 private System.Guid UserIdField; 520 517 … … 544 541 this.HashField = value; 545 542 this.RaisePropertyChanged("Hash"); 546 }547 }548 }549 550 [System.Runtime.Serialization.DataMemberAttribute()]551 public bool IsLocal {552 get {553 return this.IsLocalField;554 }555 set {556 if ((this.IsLocalField.Equals(value) != true)) {557 this.IsLocalField = value;558 this.RaisePropertyChanged("IsLocal");559 543 } 560 544 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/Plugin.cs
r6372 r6426 33 33 this.UserId = original.UserId; 34 34 this.DateCreated = original.DateCreated; 35 this.IsLocal = original.IsLocal;36 35 } 37 36 … … 41 40 42 41 public override string ToString() { 43 return string.Format("{0}-{1}", this.Name, this.Version.ToString()) + (this.IsLocal ? ", Local" : string.Empty);42 return string.Format("{0}-{1}", this.Name, this.Version.ToString()); 44 43 } 45 44 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/Util/PluginUtil.cs
r6408 r6426 38 38 /// <param name="alreadyUploadedPlugins">List of plugins which have been uploaded from this HiveExperiment</param> 39 39 /// <param name="neededPlugins">List of plugins which need to be uploaded</param> 40 /// <param name="useLocalPlugins">If true, the plugins which are already online are ignored. All local plugins are uploaded, but only once.</param>41 40 /// <returns></returns> 42 public static List<Guid> GetPluginDependencies(IHiveService service, List<Plugin> onlinePlugins, List<Plugin> alreadyUploadedPlugins, IEnumerable<IPluginDescription> neededPlugins , bool useLocalPlugins) {41 public static List<Guid> GetPluginDependencies(IHiveService service, List<Plugin> onlinePlugins, List<Plugin> alreadyUploadedPlugins, IEnumerable<IPluginDescription> neededPlugins) { 43 42 var pluginIds = new List<Guid>(); 44 43 Dictionary<IPluginDescription, byte[]> checksumsNeededPlugins = CalcChecksumsForPlugins(neededPlugins); … … 55 54 }); 56 55 57 if ( useLocalPlugins ||foundPlugin == null) {58 Plugin p = CreatePlugin(neededPlugin.Key, useLocalPlugins,neededPlugin.Value);56 if (foundPlugin == null) { 57 Plugin p = CreatePlugin(neededPlugin.Key, neededPlugin.Value); 59 58 List<PluginData> pd = CreatePluginDatas(neededPlugin.Key); 60 59 try { … … 76 75 } 77 76 78 private static Plugin CreatePlugin(IPluginDescription plugin, b ool useLocalPlugins, byte[] hash) {79 return new Plugin() { Name = plugin.Name, Version = plugin.Version, IsLocal = useLocalPlugins,Hash = hash };77 private static Plugin CreatePlugin(IPluginDescription plugin, byte[] hash) { 78 return new Plugin() { Name = plugin.Name, Version = plugin.Version, Hash = hash }; 80 79 } 81 80 82 public static Plugin CreatePlugin(IPluginDescription plugin , bool useLocalPlugins) {83 return new Plugin() { Name = plugin.Name, Version = plugin.Version , IsLocal = useLocalPlugins};81 public static Plugin CreatePlugin(IPluginDescription plugin) { 82 return new Plugin() { Name = plugin.Name, Version = plugin.Version }; 84 83 } 85 84
Note: See TracChangeset
for help on using the changeset viewer.