Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/12/11 13:43:05 (13 years ago)
Author:
cneumuel
Message:

#1233

  • changed relationship between Job and HiveExperiment. There is no more HiveExperiment.RootJobId, instead there is Job.HiveExperimentId.
  • One HiveExperiment can now have multiple Experiments.
  • TreeView supports multiple root nodes
  • HiveEngine creates a HiveExperiment for each set of jobs, so jobs cannot be without an parent experiment anymore (no more loose jobs)
  • updated ExperimentManager binaries
Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources

    • Property svn:ignore
      •  

        old new  
        44PrecompiledWeb
        55CreateEventLogSources
         6WindowsFormsTestProject
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/ExperimentManagerClient.cs

    r6000 r6006  
    145145
    146146    public static void StartExperiment(Action<Exception> exceptionCallback, HiveExperiment hiveExperiment) {
    147       ExperimentManagerClient.StoreAsync(exceptionCallback, hiveExperiment);
     147      ExperimentManagerClient.StoreAsync(
     148        new Action<Exception>((Exception ex) => {
     149          hiveExperiment.ExecutionState = ExecutionState.Prepared;
     150          exceptionCallback(ex);
     151        }), hiveExperiment);
    148152      hiveExperiment.ExecutionState = ExecutionState.Started;
    149153    }
     
    151155    public static void PauseExperiment(HiveExperiment hiveExperiment) {
    152156      ServiceLocator.Instance.CallHiveService(service => {
    153         foreach (HiveJob job in hiveExperiment.HiveJob.GetAllHiveJobs()) {
     157        foreach (HiveJob job in hiveExperiment.GetAllHiveJobs()) {
    154158          if (job.Job.State != JobState.Finished && job.Job.State != JobState.Aborted && job.Job.State != JobState.Failed)
    155159            service.PauseJob(job.Job.Id);
     
    161165    public static void StopExperiment(HiveExperiment hiveExperiment) {
    162166      ServiceLocator.Instance.CallHiveService(service => {
    163         foreach (HiveJob job in hiveExperiment.HiveJob.GetAllHiveJobs()) {
     167        foreach (HiveJob job in hiveExperiment.GetAllHiveJobs()) {
    164168          if (job.Job.State != JobState.Finished && job.Job.State != JobState.Aborted && job.Job.State != JobState.Failed)
    165169            service.StopJob(job.Job.Id);
     
    185189          }
    186190
    187           hiveExperiment.HiveJob.SetIndexInParentOptimizerList(null);
    188 
    189           int totalJobCount = hiveExperiment.HiveJob.GetAllHiveJobs().Count();
     191          foreach (HiveJob hiveJob in hiveExperiment.HiveJobs) {
     192            hiveJob.SetIndexInParentOptimizerList(null);
     193          }
     194
     195          // upload HiveExperiment
     196          hiveExperiment.Progress.Status = "Uploading HiveExperiment...";
     197          hiveExperiment.Id = service.AddHiveExperiment(hiveExperiment);
     198
     199          int totalJobCount = hiveExperiment.GetAllHiveJobs().Count();
    190200          int jobCount = 0;
    191201
     202          // upload plugins
    192203          hiveExperiment.Progress.Status = "Uploading plugins...";
    193204          this.OnlinePlugins = service.GetPlugins();
     
    196207          this.alreadyUploadedPlugins.Add(configFilePlugin);
    197208
     209          // upload jobs
    198210          hiveExperiment.Progress.Status = "Uploading jobs...";
    199           UploadJobWithChildren(hiveExperiment.Progress, service, hiveExperiment.HiveJob, null, resourceIds, ref jobCount, totalJobCount, configFilePlugin.Id, hiveExperiment.UseLocalPlugins);
    200           hiveExperiment.RootJobId = hiveExperiment.HiveJob.Job.Id;
    201 
    202           // insert or update HiveExperiment
    203           hiveExperiment.Progress.Status = "Uploading HiveExperiment...";
    204           hiveExperiment.Id = service.AddHiveExperiment(hiveExperiment);
     211
     212          foreach (HiveJob hiveJob in hiveExperiment.HiveJobs) {
     213            UploadJobWithChildren(hiveExperiment.Progress, service, hiveJob, null, resourceIds, ref jobCount, totalJobCount, configFilePlugin.Id, hiveExperiment.UseLocalPlugins, hiveExperiment.Id);
     214          }
     215
    205216          if (hiveExperiment.RefreshAutomatically) hiveExperiment.StartResultPolling();
    206217        });
     
    239250    /// <param name="parentHiveJob">shall be null if its the root job</param>
    240251    /// <param name="groups"></param>
    241     private void UploadJobWithChildren(IProgress progress, IHiveService service, HiveJob hiveJob, HiveJob parentHiveJob, IEnumerable<Guid> groups, ref int jobCount, int totalJobCount, Guid configPluginId, bool useLocalPlugins) {
     252    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) {
    242253      jobCount++;
    243254      progress.Status = string.Format("Serializing job {0} of {1}", jobCount, totalJobCount);
     
    259270      hiveJob.Job.PluginsNeededIds = PluginUtil.GetPluginDependencies(service, this.onlinePlugins, this.alreadyUploadedPlugins, plugins, useLocalPlugins);
    260271      hiveJob.Job.PluginsNeededIds.Add(configPluginId);
     272      hiveJob.Job.HiveExperimentId = hiveExperimentId;
    261273
    262274      progress.Status = string.Format("Uploading job {0} of {1} ({2} kb)", jobCount, totalJobCount, jobData.Data.Count() / 1024);
     
    270282
    271283      foreach (HiveJob child in hiveJob.ChildHiveJobs) {
    272         UploadJobWithChildren(progress, service, child, hiveJob, groups, ref jobCount, totalJobCount, configPluginId, useLocalPlugins);
     284        UploadJobWithChildren(progress, service, child, hiveJob, groups, ref jobCount, totalJobCount, configPluginId, useLocalPlugins, hiveExperimentId);
    273285      }
    274286    }
     
    276288
    277289    #region Download Experiment
    278     public static void LoadExperiment (HiveExperiment hiveExperiment) {
     290    public static void LoadExperiment(HiveExperiment hiveExperiment) {
    279291      hiveExperiment.Progress = new Progress();
    280292      try {
     
    286298        // fetch all Job objects to create the full tree of tree of HiveJob objects
    287299        hiveExperiment.Progress.Status = "Downloading list of jobs...";
    288         allJobs = ServiceLocator.Instance.CallHiveService(s => s.GetLightweightChildJobs(hiveExperiment.RootJobId, true, true));
     300        allJobs = ServiceLocator.Instance.CallHiveService(s => s.GetLightweightExperimentJobs(hiveExperiment.Id));
    289301        totalJobCount = allJobs.Count();
    290302
     
    299311        IDictionary<Guid, HiveJob> allHiveJobs = downloader.Results;
    300312
    301         hiveExperiment.HiveJob = allHiveJobs[hiveExperiment.RootJobId];
    302 
    303         if (hiveExperiment.HiveJob.Job.DateFinished.HasValue && hiveExperiment.HiveJob.Job.DateCreated.HasValue) {
    304           hiveExperiment.ExecutionTime = hiveExperiment.HiveJob.Job.DateFinished.Value - hiveExperiment.HiveJob.Job.DateCreated.Value;
     313        hiveExperiment.HiveJobs = new ItemCollection<HiveJob>(allHiveJobs.Values.Where(x => !x.Job.ParentJobId.HasValue));
     314        //hiveExperiment.HiveJobs = allHiveJobs[hiveExperiment.RootJobId];
     315
     316        if (hiveExperiment.IsFinished()) {
     317          //hiveExperiment.ExecutionTime = hiveExperiment.HiveJobs.Max(.Job.DateFinished.Value - hiveExperiment.HiveJobs.Job.DateCreated.Value;
    305318          //hiveExperiment.lastUpdateTime = hiveExperiment.HiveJob.Job.DateFinished.Value;
    306319          hiveExperiment.ExecutionState = Core.ExecutionState.Stopped;
    307320          //OnStopped(); // todo: stop timer
    308321        } else {
    309           hiveExperiment.ExecutionTime = hiveExperiment.HiveJob.Job.DateCreated.HasValue ? DateTime.Now - hiveExperiment.HiveJob.Job.DateCreated.Value : TimeSpan.Zero;
     322          //hiveExperiment.ExecutionTime = hiveExperiment.HiveJobs.Job.DateCreated.HasValue ? DateTime.Now - hiveExperiment.HiveJobs.Job.DateCreated.Value : TimeSpan.Zero;
    310323          //hiveExperiment.lastUpdateTime = DateTime.Now;
    311324          hiveExperiment.ExecutionState = Core.ExecutionState.Started;
    312325          //OnStarted(); // todo: start timer
    313326        }
     327        hiveExperiment.UpdateTotalExecutionTime();
    314328
    315329        // build child-job tree
    316         BuildHiveJobTree(hiveExperiment.HiveJob, allJobs, allHiveJobs);
     330        foreach (HiveJob hiveJob in hiveExperiment.HiveJobs) {
     331          BuildHiveJobTree(hiveJob, allJobs, allHiveJobs);
     332        }
    317333        hiveExperiment.UpdateTotalExecutionTime();
    318334
    319335        if (hiveExperiment.ExecutionState != ExecutionState.Stopped) {
    320336          hiveExperiment.RefreshAutomatically = true;
    321         }       
     337        }
    322338      }
    323339      finally {
Note: See TracChangeset for help on using the changeset viewer.