Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6111


Ignore:
Timestamp:
05/03/11 17:14:02 (14 years ago)
Author:
cneumuel
Message:

#1233

  • improved the way jobs are downloaded by ExperimentManager and HiveEngine
Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
2 added
8 edited

Legend:

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

    r6033 r6111  
    2727using System.Threading;
    2828using HeuristicLab.Clients.Hive.ExperimentManager;
    29 using HeuristicLab.Clients.Hive.Jobs;
    3029using HeuristicLab.Common;
    3130using HeuristicLab.Core;
     31using HeuristicLab.Hive;
    3232using HeuristicLab.PluginInfrastructure;
    3333
     
    373373    }
    374374
    375     public static OptimizerJob LoadOptimizerJob(Guid jobId) {
     375    public static ItemJob LoadItemJob(Guid jobId) {
    376376      JobData jobData = ServiceLocator.Instance.CallHiveService(s => s.GetJobData(jobId));
    377377      try {
    378         return PersistenceUtil.Deserialize<OptimizerJob>(jobData.Data);
     378        return PersistenceUtil.Deserialize<ItemJob>(jobData.Data);
    379379      }
    380380      catch {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJob.cs

    r6033 r6111  
    344344      }
    345345    }
     346
     347    public virtual void IntegrateChild(ItemJob job, Guid childJobId) { }
    346348  }
    347349
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/JobResultPoller.cs

    r6006 r6111  
    2626
    2727namespace HeuristicLab.Clients.Hive {
    28   internal class JobResultPoller {
     28  public class JobResultPoller {
    2929    private bool stopRequested { get; set; }
    3030    private AutoResetEvent waitHandle;
    3131    private Thread thread;
    3232
    33     private IEnumerable<HiveJob> hiveJobs;
    34     public IEnumerable<HiveJob> HiveJobs {
    35       get { return hiveJobs; }
    36       set { hiveJobs = value; }
     33    private Guid hiveExperimentId;
     34    public Guid HiveExperimentId {
     35      get { return hiveExperimentId; }
     36      set { hiveExperimentId = value; }
    3737    }
    3838
     
    5454    }
    5555
    56     public JobResultPoller(IEnumerable<HiveJob> hiveJobs, TimeSpan interval) {
     56    public JobResultPoller(Guid hiveExperimentId, TimeSpan interval) {
    5757      this.isPolling = false;
    58       this.hiveJobs = hiveJobs;
     58      this.hiveExperimentId = hiveExperimentId;
    5959      this.interval = interval;
    6060    }
     
    7575    }
    7676
    77     public void RunPolling() {
     77    private void RunPolling() {
    7878      try {
    7979        waitHandle = new AutoResetEvent(false);
     
    9494    }
    9595
    96     private void FetchJobResults() {
    97       ServiceLocator.Instance.CallHiveService(service => {
     96    public IEnumerable<LightweightJob> FetchJobResults() {
     97      return ServiceLocator.Instance.CallHiveService(service => {
    9898        var responses = new List<LightweightJob>();
    99         foreach (HiveJob hiveJob in HiveJobs) {
    100           responses.AddRange(service.GetLightweightChildJobs(hiveJob.Job.Id, true, true));
    101         }
     99        responses.AddRange(service.GetLightweightExperimentJobs(hiveExperimentId));
    102100        OnJobResultsReceived(responses);
     101        return responses;
    103102      });
    104103    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/OptimizerHiveJob.cs

    r6033 r6111  
    2626using HeuristicLab.Collections;
    2727using HeuristicLab.Common;
     28using HeuristicLab.Hive;
    2829using HeuristicLab.Optimization;
    2930using HeuristicLab.PluginInfrastructure;
     
    169170    ///   add the runs from the optimizerJob to the batchrun and replace the Optimizer
    170171    /// </summary>
    171     public void UpdateChildOptimizer(OptimizerJob optimizerJob, Guid childJobId) {
     172    public override void IntegrateChild(ItemJob job, Guid childJobId) {
     173      var optimizerJob = (OptimizerJob)job;
    172174      syncJobsWithOptimizers = false; // don't sync with optimizers during this method
    173175
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HeuristicLab.Clients.Hive-3.4.csproj

    r6033 r6111  
    120120    <Compile Include="Exceptions\JobResultPollingException.cs" />
    121121    <Compile Include="Exceptions\OptimizerNotFoundException.cs" />
     122    <Compile Include="ExperimentManager\JobDownloader.cs" />
    122123    <Compile Include="ExperimentManager\ExperimentManagerClient.cs" />
    123124    <Compile Include="ExperimentManager\HiveJobDownloader.cs" />
     
    130131    <Compile Include="Exceptions\ResourceNotFoundException.cs" />
    131132    <Compile Include="IServiceLocator.cs" />
     133    <Compile Include="Jobs\EngineJob.cs" />
    132134    <Compile Include="Jobs\OptimizerJob.cs" />
    133135    <Compile Include="HeuristicLabClientsHivePlugin.cs" />
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/Jobs/OptimizerJob.cs

    r6033 r6111  
    131131      Item.NameChanged += new EventHandler(optimizer_NameChanged);
    132132      Item.NameChanging += new EventHandler<CancelEventArgs<string>>(optimizer_NameChanging);
     133      Item.ExecutionStateChanged += new EventHandler(optimizer_ExecutionStateChanged);
     134      Item.ExecutionTimeChanged += new EventHandler(optimizer_ExecutionTimeChanged);
     135      Item.Started += new EventHandler(optimizer_Started);
    133136    }
    134137
     
    140143      Item.NameChanged -= new EventHandler(optimizer_NameChanged);
    141144      Item.NameChanging -= new EventHandler<CancelEventArgs<string>>(optimizer_NameChanging);
     145      Item.ExecutionStateChanged -= new EventHandler(optimizer_ExecutionStateChanged);
     146      Item.ExecutionTimeChanged -= new EventHandler(optimizer_ExecutionTimeChanged);
     147      Item.Started -= new EventHandler(optimizer_Started);     
    142148      base.DeregisterItemEvents();
    143149    }
     
    159165    }
    160166
     167    protected virtual void optimizer_Started(object sender, EventArgs e) {
     168      OnJobStarted();
     169    }
     170
    161171    protected virtual void optimizer_Stopped(object sender, EventArgs e) {
    162172      OnJobStopped();
     
    165175    protected virtual void optimizer_Paused(object sender, EventArgs e) {
    166176      OnJobPaused();
     177    }
     178
     179    protected virtual void optimizer_ExecutionTimeChanged(object sender, EventArgs e) {
     180      OnExecutionTimeChanged();
     181    }
     182
     183    protected virtual void optimizer_ExecutionStateChanged(object sender, EventArgs e) {
     184      OnExecutionStateChanged();
    167185    }
    168186    #endregion
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/HeuristicLab.HiveEngine-3.4.csproj

    r6039 r6111  
    150150  </ItemGroup>
    151151  <ItemGroup>
    152     <Compile Include="EngineJob.cs" />
    153152    <Compile Include="HeuristicLabHiveEnginePlugin.cs" />
    154153    <Compile Include="Exceptions\ScopeMergeException.cs" />
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/HiveEngine.cs

    r6039 r6111  
    226226      object locker = new object();
    227227      IDictionary<Guid, int> jobIndices = new Dictionary<Guid, int>();
    228       var hiveExperiment = new HiveExperiment();;
     228      var hiveExperiment = new HiveExperiment();
    229229
    230230      try {
     
    240240        hiveExperiment.ResourceNames = this.ResourceNames;
    241241        hiveExperiment.Id = ServiceLocator.Instance.CallHiveService(s => s.AddHiveExperiment(hiveExperiment));
    242         hiveExperiments.Add(new RefreshableHiveExperiment(hiveExperiment));
     242        var refreshableHiveExperiment = new RefreshableHiveExperiment(hiveExperiment);
     243        hiveExperiments.Add(refreshableHiveExperiment);
    243244
    244245        // create upload-tasks
     
    283284        }, cancellationToken, TaskCreationOptions.PreferFairness);
    284285        processUploadedJobsTask.Start();
     286
     287        refreshableHiveExperiment.RefreshAutomatically = true;
     288       
     289        while (!refreshableHiveExperiment.AllJobsFinished()) {
     290          Thread.Sleep(1000);
     291          // update time
     292          // handle cancellation
     293        }
     294
     295
    285296
    286297        // poll job-statuses and create tasks for those which are finished
Note: See TracChangeset for help on using the changeset viewer.