Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/01/11 15:51:11 (14 years ago)
Author:
cneumuel
Message:

#1233

  • changed the workflow of aquireing a new job from server.
    • if a job is available for calculation, the slave receives the jobId already with the heartbeats. The job is then exclusively assigned to this slave.
  • extended the metainfo for a slave by OperatingSystem and CpuArchitecture
  • enhanced the way plugin-dependencies are discovered by using the types used by XmlGenerator. Now only mimimum amount of plugins are transferred.
  • selection of waiting jobs now consideres assigned slave-group
  • more unit tests for service
  • added unit tests for experiment manager
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobClient.cs

    r5402 r5404  
    3232using HeuristicLab.PluginInfrastructure;
    3333using HeuristicLab.Services.Hive.Common.DataTransfer;
     34using HeuristicLab.PluginInfrastructure.Manager;
    3435
    3536namespace HeuristicLab.Clients.Hive {
     
    425426    ///   if true the Child-Optimizers will not be serialized (if the job contains an Experiment)
    426427    /// </param>
    427     public JobData GetAsJobData(bool withoutChildOptimizers) {
     428    public JobData GetAsJobData(bool withoutChildOptimizers, out List<IPluginDescription> plugins) {
     429      plugins = new List<IPluginDescription>();
    428430      if (this.optimizerJob == null || this.optimizerJob.Optimizer == null)
    429431        return null;
    430432
     433      IEnumerable<Type> usedTypes;
    431434      byte[] jobByteArray;
    432435      if (withoutChildOptimizers && this.OptimizerJob.Optimizer is Optimization.Experiment) {
    433436        OptimizerJob clonedJob = (OptimizerJob)this.OptimizerJob.Clone(); // use a cloned job, so that the childHiveJob don't get confused
    434437        clonedJob.OptimizerAsExperiment.Optimizers.Clear();
    435         jobByteArray = PersistenceUtil.Serialize(clonedJob);
     438        jobByteArray = PersistenceUtil.Serialize(clonedJob, out usedTypes);
    436439      } else if (withoutChildOptimizers && this.OptimizerJob.Optimizer is Optimization.BatchRun) {
    437440        OptimizerJob clonedJob = (OptimizerJob)this.OptimizerJob.Clone();
    438441        clonedJob.OptimizerAsBatchRun.Optimizer = null;
    439         jobByteArray = PersistenceUtil.Serialize(clonedJob);
     442        jobByteArray = PersistenceUtil.Serialize(clonedJob, out usedTypes);
    440443      } else if (this.OptimizerJob.Optimizer is IAlgorithm) {
    441444        ((IAlgorithm)this.OptimizerJob.Optimizer).StoreAlgorithmInEachRun = false; // avoid storing the algorithm in runs to reduce size
    442         jobByteArray = PersistenceUtil.Serialize(this.OptimizerJob);
     445        jobByteArray = PersistenceUtil.Serialize(this.OptimizerJob, out usedTypes);
    443446      } else {
    444         jobByteArray = PersistenceUtil.Serialize(this.OptimizerJob);
     447        jobByteArray = PersistenceUtil.Serialize(this.OptimizerJob, out usedTypes);
    445448      }
    446449
     
    450453      };
    451454
     455      CollectDeclaringPlugins(plugins, usedTypes);
     456
    452457      return jobData;
     458    }
     459
     460    private void CollectDeclaringPlugins(List<IPluginDescription> plugins, IEnumerable<Type> usedTypes) {
     461      foreach (Type type in usedTypes) {
     462        var plugin = ApplicationManager.Manager.GetDeclaringPlugin(type);
     463        if (plugin != null && !plugins.Contains(plugin)) {
     464          plugins.Add(plugin);
     465          CollectPluginDependencies(plugins, plugin);
     466        }
     467      }
     468    }
     469
     470    private void CollectPluginDependencies(List<IPluginDescription> plugins, IPluginDescription plugin) {
     471      if (plugin == null) return;
     472      foreach (var dependency in plugin.Dependencies) {
     473        if (!plugins.Contains(dependency)) {
     474          plugins.Add(dependency);
     475          CollectPluginDependencies(plugins, dependency);
     476        }
     477      }
    453478    }
    454479
Note: See TracChangeset for help on using the changeset viewer.