Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12686 for stable


Ignore:
Timestamp:
07/08/15 14:16:13 (9 years ago)
Author:
ascheibe
Message:

#2409 merged r12616, r12621, r12644, r12673 into stable

Location:
stable
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Clients.Hive/3.3/HiveTasks/EngineHiveTask.cs

    r12009 r12686  
    4747
    4848    public override TaskData GetAsTaskData(bool withoutChildOptimizers, out List<IPluginDescription> plugins) {
    49       plugins = new List<IPluginDescription>();
    50       if (this.itemTask == null)
     49      if (ItemTask == null) {
     50        plugins = new List<IPluginDescription>();
    5151        return null;
     52      }
    5253
    5354      TaskData jobData = new TaskData();
     
    6061      jobData.Data = PersistenceUtil.Serialize(ItemTask, out usedTypes);
    6162
    62       PluginUtil.CollectDeclaringPlugins(plugins, usedTypes);
     63      plugins = PluginUtil.GetPluginsForTask(usedTypes, ItemTask);
    6364      return jobData;
    6465    }
  • stable/HeuristicLab.Clients.Hive/3.3/HiveTasks/HiveTask.cs

    r12009 r12686  
    295295    /// </param>
    296296    public virtual TaskData GetAsTaskData(bool withoutChildOptimizers, out List<IPluginDescription> plugins) {
    297       plugins = new List<IPluginDescription>();
    298       if (this.itemTask == null)
     297      if (ItemTask == null) {
     298        plugins = new List<IPluginDescription>();
    299299        return null;
     300      }
    300301
    301302      IEnumerable<Type> usedTypes;
    302       byte[] taskByteArray = PersistenceUtil.Serialize(this.ItemTask, out usedTypes);
     303      byte[] taskByteArray = PersistenceUtil.Serialize(ItemTask, out usedTypes);
    303304      TaskData taskData = new TaskData() { TaskId = task.Id, Data = taskByteArray };
    304       PluginUtil.CollectDeclaringPlugins(plugins, usedTypes);
     305      plugins = PluginUtil.GetPluginsForTask(usedTypes, ItemTask);
    305306      return taskData;
    306307    }
  • stable/HeuristicLab.Clients.Hive/3.3/HiveTasks/OptimizerHiveTask.cs

    r12221 r12686  
    347347    /// </param>
    348348    public override TaskData GetAsTaskData(bool withoutChildOptimizers, out List<IPluginDescription> plugins) {
    349       plugins = new List<IPluginDescription>();
    350       if (this.itemTask == null) // || this.jobItem.Optimizer == null
     349      if (ItemTask == null) {
     350        plugins = new List<IPluginDescription>();
    351351        return null;
     352      }
    352353
    353354      IEnumerable<Type> usedTypes;
    354355      byte[] jobByteArray;
    355       if (withoutChildOptimizers && this.ItemTask.Item is Optimization.Experiment) {
    356         OptimizerTask clonedJob = (OptimizerTask)this.ItemTask.Clone(); // use a cloned task, so that the childHiveJob don't get confused
     356      if (withoutChildOptimizers && ItemTask.Item is Optimization.Experiment) {
     357        OptimizerTask clonedJob = (OptimizerTask)ItemTask.Clone(); // use a cloned task, so that the childHiveJob don't get confused
    357358        clonedJob.OptimizerAsExperiment.Optimizers.Clear();
    358359        jobByteArray = PersistenceUtil.Serialize(clonedJob, out usedTypes);
    359       } else if (withoutChildOptimizers && this.ItemTask.Item is Optimization.BatchRun) {
    360         OptimizerTask clonedJob = (OptimizerTask)this.ItemTask.Clone();
     360      } else if (withoutChildOptimizers && ItemTask.Item is Optimization.BatchRun) {
     361        OptimizerTask clonedJob = (OptimizerTask)ItemTask.Clone();
    361362        clonedJob.OptimizerAsBatchRun.Optimizer = null;
    362363        jobByteArray = PersistenceUtil.Serialize(clonedJob, out usedTypes);
    363       } else if (this.ItemTask.Item is IAlgorithm) {
    364         ((IAlgorithm)this.ItemTask.Item).StoreAlgorithmInEachRun = false; // avoid storing the algorithm in runs to reduce size
    365         jobByteArray = PersistenceUtil.Serialize(this.ItemTask, out usedTypes);
     364      } else if (ItemTask.Item is IAlgorithm) {
     365        ((IAlgorithm)ItemTask.Item).StoreAlgorithmInEachRun = false; // avoid storing the algorithm in runs to reduce size
     366        jobByteArray = PersistenceUtil.Serialize(ItemTask, out usedTypes);
    366367      } else {
    367         jobByteArray = PersistenceUtil.Serialize(this.ItemTask, out usedTypes);
     368        jobByteArray = PersistenceUtil.Serialize(ItemTask, out usedTypes);
    368369      }
    369370
    370371      TaskData jobData = new TaskData() { TaskId = task.Id, Data = jobByteArray };
    371       PluginUtil.CollectDeclaringPlugins(plugins, usedTypes);
     372      plugins = PluginUtil.GetPluginsForTask(usedTypes, ItemTask);
    372373      return jobData;
    373374    }
  • stable/HeuristicLab.Clients.Hive/3.3/Util/PluginUtil.cs

    r12009 r12686  
    2626using System.Security.Cryptography;
    2727using System.ServiceModel;
     28using HeuristicLab.Core;
    2829using HeuristicLab.PluginInfrastructure;
    2930
     
    3940    /// <param name="neededPlugins">List of plugins which need to be uploaded</param>
    4041    /// <returns></returns>
    41     public static List<Guid> GetPluginDependencies(IHiveService service, List<Plugin> onlinePlugins, List<Plugin> alreadyUploadedPlugins, IEnumerable<IPluginDescription> neededPlugins) {
     42    public static List<Guid> GetPluginDependencies(IHiveService service, List<Plugin> onlinePlugins, List<Plugin> alreadyUploadedPlugins,
     43                                                   IEnumerable<IPluginDescription> neededPlugins) {
    4244      var pluginIds = new List<Guid>();
    4345      Dictionary<IPluginDescription, byte[]> checksumsNeededPlugins = CalcChecksumsForPlugins(neededPlugins);
     
    6163              alreadyUploadedPlugins.Add(p);
    6264              pluginIds.Add(p.Id);
    63             }
    64             catch (FaultException<PluginAlreadyExistsFault> fault) {
     65            } catch (FaultException<PluginAlreadyExistsFault> fault) {
    6566              onlinePlugins.Add(service.GetPlugin(fault.Detail.Id));
    6667            }
     
    7980    }
    8081
    81     public static Plugin CreatePlugin(IPluginDescription plugin) {
    82       return new Plugin() { Name = plugin.Name, Version = plugin.Version };
    83     }
    84 
    8582    public static List<PluginData> CreatePluginDatas(IPluginDescription plugin) {
    8683      List<PluginData> pluginDatas = new List<PluginData>();
     
    9693    }
    9794
    98     public static void CollectDeclaringPlugins(List<IPluginDescription> plugins, IEnumerable<Type> usedTypes) {
     95    public static List<IPluginDescription> GetPluginsForTask(IEnumerable<Type> usedTypes, object task) {
     96      if (usedTypes.Any(x => typeof(IProgrammableItem).IsAssignableFrom(x))) {
     97        //when a programmable item is used all plugins that are currently loaded need to be sent to Hive
     98        return ApplicationManager.Manager.Plugins.ToList();
     99      } else {
     100        return CollectDeclaringPlugins(usedTypes);
     101      }
     102    }
     103
     104    private static List<IPluginDescription> CollectDeclaringPlugins(IEnumerable<Type> usedTypes) {
     105      List<IPluginDescription> plugins = new List<IPluginDescription>();
    99106      foreach (Type type in usedTypes) {
    100107        var plugin = ApplicationManager.Manager.GetDeclaringPlugin(type);
     
    104111        }
    105112      }
     113      return plugins;
    106114    }
    107115
    108     public static void CollectPluginDependencies(List<IPluginDescription> plugins, IPluginDescription plugin) {
     116    private static void CollectPluginDependencies(List<IPluginDescription> plugins, IPluginDescription plugin) {
    109117      if (plugin == null) return;
    110118      foreach (var dependency in plugin.Dependencies) {
  • stable/HeuristicLab.Core/3.3/HeuristicLab.Core-3.3.csproj

    r11935 r12686  
    166166    <Compile Include="Interfaces\IFixedValueParameter.cs" />
    167167    <Compile Include="Interfaces\IOperatorGraphOperator.cs" />
     168    <Compile Include="Interfaces\IProgrammableItem.cs" />
    168169    <Compile Include="Interfaces\IStatefulItem.cs" />
    169170    <Compile Include="OperatorExecutionException.cs" />
  • stable/HeuristicLab.ExtLibs

  • stable/HeuristicLab.ExtLibs/HeuristicLab.MathJax/1.1/HeuristicLab.MathJax-1.1/Plugin.cs.frame

    r12009 r12686  
    3636      base.OnLoad();
    3737      if (!Directory.EnumerateFiles(AppDomain.CurrentDomain.BaseDirectory, "mathjax.js", SearchOption.TopDirectoryOnly).Any()) {
    38         ZipFile.ExtractToDirectory("mathjax.zip", AppDomain.CurrentDomain.BaseDirectory);
     38        ZipFile.ExtractToDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "mathjax.zip"), AppDomain.CurrentDomain.BaseDirectory);
    3939      }
    4040    }
  • stable/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperator.cs

    r12009 r12686  
    4242  [Item("ProgrammableOperator", "An operator that can be programmed for arbitrary needs.")]
    4343  [StorableClass]
    44   public class ProgrammableOperator : Operator, IParameterizedNamedItem, IStorableContent {
     44  public class ProgrammableOperator : Operator, IParameterizedNamedItem, IStorableContent, IProgrammableItem {
    4545
    4646    #region Fields & Properties
     
    280280            assemblies.Add(a, false);
    281281          }
    282         }
    283         catch (NotSupportedException) {
     282        } catch (NotSupportedException) {
    284283          // NotSupportedException is thrown while accessing
    285284          // the Location property of the anonymously hosted
  • stable/HeuristicLab.Problems.Programmable/3.3/MultiObjectiveProgrammableProblem.cs

    r12009 r12686  
    3333  [Creatable("Problems")]
    3434  [StorableClass]
    35   public sealed class MultiObjectiveProgrammableProblem : MultiObjectiveBasicProblem<IEncoding> {
     35  public sealed class MultiObjectiveProgrammableProblem : MultiObjectiveBasicProblem<IEncoding>, IProgrammableItem {
    3636    public static new Image StaticItemImage {
    3737      get { return VSImageLibrary.Script; }
  • stable/HeuristicLab.Problems.Programmable/3.3/SingleObjectiveProgrammableProblem.cs

    r12009 r12686  
    3535  [Creatable("Problems")]
    3636  [StorableClass]
    37   public sealed class SingleObjectiveProgrammableProblem : SingleObjectiveBasicProblem<IEncoding> {
     37  public sealed class SingleObjectiveProgrammableProblem : SingleObjectiveBasicProblem<IEncoding>, IProgrammableItem {
    3838    public static new Image StaticItemImage {
    3939      get { return VSImageLibrary.Script; }
  • stable/HeuristicLab.Scripting/3.3/Script.cs

    r12009 r12686  
    3737namespace HeuristicLab.Scripting {
    3838  [StorableClass]
    39   public class Script : NamedItem {
     39  public class Script : NamedItem, IProgrammableItem {
    4040    protected virtual string CodeTemplate {
    4141      get { return string.Empty; }
Note: See TracChangeset for help on using the changeset viewer.