Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/31/11 18:15:15 (14 years ago)
Author:
cneumuel
Message:

#1233

  • single sign on with HL
  • local plugins are uploaded if not available online (user can force the useage of local plugins)
  • changed plugin and plugindata db-schema
  • plugin dao tests
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  
    2929using HeuristicLab.Services.Hive.Common;
    3030using HeuristicLab.Services.Hive.Common.ServiceContracts;
     31using HeuristicLab.Services.Hive.Common.DataTransfer;
     32using HeuristicLab.Clients.Hive.Jobs;
     33using HeuristicLab.Clients.Common;
     34using HeuristicLab.Optimization;
    3135
    3236namespace HeuristicLab.Clients.Hive {
    3337  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;
    3740
    3841  /// <summary>
     
    111114    }
    112115
     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   
    113128    public HiveExperimentClient() : base(itemName, itemDescription) {
    114129      // TODO //this.ResourceIds = HeuristicLab.Hive.Experiment.Properties.Settings.Default.ResourceIds;
    115       this.ResourceIds = "MyGroup";
     130      this.ResourceIds = "HEAL";
    116131      this.log = new Log();
    117132      InitTimer();
     
    151166    }
    152167
    153     public void SetExperiment(Optimization.Experiment experiment) {
     168    public void SetExperiment(Experiment experiment) {
    154169      this.HiveJob = new HiveJob(experiment);
    155170      Prepare();
     
    171186    /// Returns the experiment from the root HiveJob
    172187    /// </summary>
    173     public Optimization.Experiment GetExperiment() {
     188    public Experiment GetExperiment() {
    174189      if (this.HiveJob != null) {
    175190        return HiveJob.OptimizerJob.OptimizerAsExperiment;
     
    179194
    180195    #region IExecutable Members
    181     private Core.ExecutionState executionState;
     196    private ExecutionState executionState;
    182197    public ExecutionState ExecutionState {
    183198      get { return executionState; }
     
    231246          int jobCount = 0;
    232247
     248          this.progress.Status = "Uploading plugins...";
     249          this.PluginsNeededIds = GetPluginsNeededIds(this.useLocalPlugins);
     250
    233251          this.progress.Status = "Uploading jobs...";
    234252          UploadJobWithChildren(service.Obj, this.HiveJob, null, groups, ref jobCount, totalJobCount);
     
    251269        IsProgressing = false;
    252270      }
     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;
    253307    }
    254308
     
    273327        jobData = hiveJob.GetAsJobData(false);
    274328      }
     329
     330      hiveJob.Job.PluginsNeededIds = this.PluginsNeededIds;
    275331
    276332      this.progress.Status = string.Format("Uploading job {0} of {1} ({2} kb)", jobCount, totalJobCount, jobData.Data.Count() / 1024);
     
    618674      }
    619675    }
     676   
    620677  }
    621678}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveExperimentManagerClient.cs

    r5055 r5402  
    137137    }
    138138
    139     void hiveExperiments_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<Collections.IndexedItem<HiveExperimentClient>> e) {
     139    void hiveExperiments_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<HiveExperimentClient>> e) {
    140140      if (!currentlyUpdating) {
    141141        using (Disposable<IHiveService> service = ServiceLocator.Instance.GetService()) {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobClient.cs

    r5363 r5402  
    107107    public HiveJob() {
    108108      this.Job = new Job() {
    109         JobState = JobState.Waiting,
     109        JobState = JobState.Offline,
    110110        DateCreated = DateTime.Now,
    111111        CoresNeeded = 1,
     
    191191        if (OptimizerJob.Optimizer is Optimization.Experiment) {
    192192          Optimization.Experiment experiment = OptimizerJob.OptimizerAsExperiment;
    193           experiment.Optimizers.ItemsAdded += new Collections.CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsAdded);
    194           experiment.Optimizers.ItemsReplaced += new Collections.CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsReplaced);
    195           experiment.Optimizers.ItemsRemoved += new Collections.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);
    196196          experiment.Optimizers.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_CollectionReset);
    197197        } else if (OptimizerJob.Optimizer is Optimization.BatchRun) {
     
    208208        if (OptimizerJob.Optimizer is Optimization.Experiment) {
    209209          Optimization.Experiment experiment = OptimizerJob.OptimizerAsExperiment;
    210           experiment.Optimizers.ItemsAdded -= new Collections.CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsAdded);
    211           experiment.Optimizers.ItemsReplaced -= new Collections.CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsReplaced);
    212           experiment.Optimizers.ItemsRemoved -= new Collections.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);
    213213          experiment.Optimizers.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_CollectionReset);
    214214        } else if (OptimizerJob.Optimizer is Optimization.BatchRun) {
     
    222222    }
    223223
    224     void batchRun_OptimizerChanged(object sender, EventArgs e) {
     224    private void batchRun_OptimizerChanged(object sender, EventArgs e) {
    225225      if (syncJobsWithOptimizers) {
    226226        this.childHiveJobs.Clear();
     
    229229    }
    230230
    231     void batchRun_RepetitionsChanged(object sender, EventArgs e) {
     231    private void batchRun_RepetitionsChanged(object sender, EventArgs e) {
    232232      if (syncJobsWithOptimizers) {
    233233        UpdateChildHiveJobs();
     
    235235    }
    236236
    237     void OptimizerJob_ToStringChanged(object sender, EventArgs e) {
     237    private void OptimizerJob_ToStringChanged(object sender, EventArgs e) {
    238238      this.OnToStringChanged();
    239239    }
     
    267267      }
    268268    }
    269     void Optimizers_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) {
     269    private void Optimizers_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) {
    270270      if (syncJobsWithOptimizers && this.OptimizerJob.ComputeInParallel) {
    271271        foreach (var item in e.Items) {
     
    275275    }
    276276
    277     void OptimizerJob_ComputeInParallelChanged(object sender, EventArgs e) {
     277    private void OptimizerJob_ComputeInParallelChanged(object sender, EventArgs e) {
    278278      if (OptimizerJob != null && syncJobsWithOptimizers) {
    279279        if (OptimizerJob.ComputeInParallel) {
     
    445445      }
    446446
    447       UpdateRequiredPlugins();
    448 
    449447      JobData jobData = new JobData() {
    450448        JobId = job.Id,
     
    453451
    454452      return jobData;
    455     }
    456 
    457     /// <summary>
    458     /// find out which which plugins are needed for the given object
    459     /// </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;
    485453    }
    486454
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HeuristicLab.Clients.Hive-3.4.csproj

    r5264 r5402  
    3737  <PropertyGroup>
    3838    <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>
    3971  </PropertyGroup>
    4072  <ItemGroup>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/app.config

    r5264 r5402  
    1515            </bindings>
    1616        <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">
    1818              <identity>
    1919                <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.