Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6198


Ignore:
Timestamp:
05/15/11 12:02:12 (12 years ago)
Author:
cneumuel
Message:

#1233

  • small fixes for HiveEngine
Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
8 edited

Legend:

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

    r6178 r6198  
    107107        calculatingTextBox.Text = "0";
    108108        finishedTextBox.Text = "0";
     109        logView.Content = null;
    109110      } else {
    110111        nameTextBox.Text = Content.HiveExperiment.Name;
     
    117118        calculatingTextBox.Text = Content.HiveExperiment.CalculatingCount.ToString();
    118119        finishedTextBox.Text = Content.HiveExperiment.FinishedCount.ToString();
     120        logView.Content = Content.Log;
    119121      }
    120122      Content_HiveExperimentChanged(this, EventArgs.Empty);
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/ConcurrentJobDownloader.cs

    r6178 r6198  
    2020    }
    2121
    22     public void DownloadJob(Guid jobId, Action<Guid, T, Exception> onFinishedAction) {
    23       Task<JobData>.Factory.StartNew((x) => DownloadJob(x), jobId)
     22    public void DownloadJob(Job job, Action<Job, T, Exception> onFinishedAction) {
     23      Task<JobData>.Factory.StartNew((x) => DownloadJob(x), job.Id)
    2424                                     .ContinueWith((x) => DeserializeJob(x.Result))
    25                                      .ContinueWith((x) => OnJobFinished(jobId, x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously);
     25                                     .ContinueWith((x) => OnJobFinished(job, x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously);
    2626    }
    2727
    28     private void OnJobFinished(Guid jobId, Task<T> task, Action<Guid, T, Exception> onFinishedAction) {
    29       onFinishedAction(jobId, task.Result, task.Exception);
     28    private void OnJobFinished(Job job, Task<T> task, Action<Job, T, Exception> onFinishedAction) {
     29      onFinishedAction(job, task.Result, task.Exception);
    3030    }
    3131
     
    4646    protected T DeserializeJob(JobData jobData) {
    4747      try {
     48        if (abort || jobData == null) return null;
    4849        Job job = ServiceLocator.Instance.CallHiveService(s => s.GetJob(jobData.JobId));
    49         if (abort || job == null || jobData == null) return null;
     50        if (job == null) return null;
    5051        var deserializedJob = PersistenceUtil.Deserialize<T>(jobData.Data);
    5152        jobData.Data = null; // reduce memory consumption.
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/EngineHiveJob.cs

    r6178 r6198  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Linq;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
     
    6263      }
    6364
     65      // add type objects from object graph to work around ticket #1527
     66      var typeObjects = ItemJob.GetObjectGraphObjects().OfType<Type>();
     67      usedTypes = new List<Type>(usedTypes).Union(typeObjects);
     68
    6469      PluginUtil.CollectDeclaringPlugins(plugins, usedTypes);
    65 
     70     
    6671      return jobData;
    6772    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJob.cs

    r6178 r6198  
    6565          job = value;
    6666          RegisterJobEvents();
    67           itemJobDownloaded = false;
     67          IsFinishedJobDownloaded = false;
    6868          OnJobChanged();
    6969          OnToStringChanged();
     
    8787          RegisterItemJobEvents();
    8888          OnJobItemChanged();
    89           itemJobDownloaded = true;
     89          IsFinishedJobDownloaded = true;
    9090        }
    9191      }
     
    9494    // job downloaded since last status change
    9595    [Storable]
    96     private bool itemJobDownloaded = false;
    97     public bool ItemJobDownloaded {
    98       get { return itemJobDownloaded; }
    99     }
     96    private bool isFinishedJobDownloaded = false;
     97    public bool IsFinishedJobDownloaded {
     98      get { return isFinishedJobDownloaded; }
     99      set {
     100        if (value != isFinishedJobDownloaded) {
     101          this.isFinishedJobDownloaded = value;
     102          OnIsFinishedJobDownloadedChanged();
     103        }
     104      }
     105    }
     106
     107    public bool IsDownloading { get; set; }
    100108
    101109    [Storable]
     
    147155      this.childHiveJobs = cloner.Clone(original.childHiveJobs);
    148156      this.syncJobsWithOptimizers = original.syncJobsWithOptimizers;
    149       this.itemJobDownloaded = original.itemJobDownloaded;
     157      this.isFinishedJobDownloaded = original.isFinishedJobDownloaded;
    150158    }
    151159    public override IDeepCloneable Clone(Cloner cloner) {
     
    210218        job.StateLog = new List<StateLog>(lightweightJob.StateLog);
    211219        job.Command = lightweightJob.Command;
    212         job.LastJobDataUpdate = lightweightJob.LastJobDataUpdate;
    213220
    214221        OnJobStateChanged();
     
    262269    }
    263270
    264     public event EventHandler IsFinishedOptimizerDownloadedChanged;
    265     private void OnIsFinishedOptimizerDownloadedChanged() {
    266       var handler = IsFinishedOptimizerDownloadedChanged;
     271    public event EventHandler IsFinishedJobDownloadedChanged;
     272    private void OnIsFinishedJobDownloadedChanged() {
     273      var handler = IsFinishedJobDownloadedChanged;
    267274      if (handler != null) handler(this, EventArgs.Empty);
    268275    }
     
    280287    private void job_PropertyChanged(object sender, PropertyChangedEventArgs e) {
    281288      if (e.PropertyName == "State") {
    282         itemJobDownloaded = false;
     289        IsFinishedJobDownloaded = false;
    283290      }
    284291    }
     
    402409
    403410    public virtual void IntegrateChild(ItemJob job, Guid childJobId) { }
     411
    404412  }
    405413
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobDownloader.cs

    r6178 r6198  
    5959    public void StartAsync() {
    6060      foreach (Guid jobId in jobIds) {
    61         jobDownloader.DownloadJob(jobId,
    62           (id, itemJob, exception) => {
     61        Job job = ServiceLocator.Instance.CallHiveService(s => s.GetJob(jobId));
     62
     63        jobDownloader.DownloadJob(job,
     64          (localJob, itemJob, exception) => {
    6365            if (exception != null) {
    6466              throw new ConcurrentJobDownloaderException("Downloading job failed", exception);
    6567            }
    66             Job job = ServiceLocator.Instance.CallHiveService(s => s.GetJob(id));
    67             if (job != null && itemJob != null) {
     68            if (localJob != null && itemJob != null) {
    6869              HiveJob hiveJob;
    6970              if (itemJob is OptimizerJob) {
     
    7273                hiveJob = new HiveJob(itemJob, true);
    7374              }
    74               hiveJob.Job = job;
    75               this.results.Add(id, hiveJob);
     75              hiveJob.Job = localJob;
     76              this.results.Add(localJob.Id, hiveJob);
    7677            }
    7778          });
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/RefreshableHiveExperiment.cs

    r6178 r6198  
    9595    }
    9696
     97    [Storable]
     98    private ILog log;
     99    public ILog Log {
     100      get { return log; }
     101      set { log = value; }
     102    }
     103   
     104
    97105    #region Constructors and Cloning
    98106    public RefreshableHiveExperiment() {
     
    100108      this.refreshAutomatically = true;
    101109      this.HiveExperiment = new HiveExperiment();
     110      this.log = new Log();
    102111    }
    103112    public RefreshableHiveExperiment(HiveExperiment hiveExperiment) {
     
    105114      this.refreshAutomatically = true;
    106115      this.HiveExperiment = hiveExperiment;
     116      this.log = new Log();
    107117    }
    108118    protected RefreshableHiveExperiment(RefreshableHiveExperiment original, Cloner cloner) {
     
    112122      this.IncludeJobs = original.IncludeJobs;
    113123      this.IsControllable = original.IsControllable;
     124      this.Log = cloner.Clone(original.Log);
    114125    }
    115126    public IDeepCloneable Clone(Cloner cloner) {
     
    167178    private void jobResultPoller_JobResultReceived(object sender, EventArgs<IEnumerable<LightweightJob>> e) {
    168179      foreach (LightweightJob lightweightJob in e.Value) {
    169         HiveJob hj = GetHiveJobById(lightweightJob.Id);
    170         if (hj != null) {
    171           DateTime lastJobDataUpdate = hj.Job.LastJobDataUpdate;
    172           hj.UpdateFromLightweightJob(lightweightJob);
    173 
     180        HiveJob hiveJob = GetHiveJobById(lightweightJob.Id);
     181        if (hiveJob != null) {
    174182          // lastJobDataUpdate equals DateTime.MinValue right after it was uploaded. When the first results are polled, this value is updated
    175           if (lastJobDataUpdate != DateTime.MinValue && lastJobDataUpdate < hj.Job.LastJobDataUpdate) {
    176             jobDownloader.DownloadJob(hj.Job.Id, (id, itemJob, exception) => {
     183          if (hiveJob.Job.State == JobState.Offline && lightweightJob.State != JobState.Finished && lightweightJob.State != JobState.Failed && lightweightJob.State != JobState.Aborted) {
     184            hiveJob.Job.LastJobDataUpdate = lightweightJob.LastJobDataUpdate;
     185          }
     186
     187          hiveJob.UpdateFromLightweightJob(lightweightJob);
     188
     189          if (!hiveJob.IsFinishedJobDownloaded && !hiveJob.IsDownloading && hiveJob.Job.LastJobDataUpdate < lightweightJob.LastJobDataUpdate) {
     190            log.LogMessage(string.Format("Downloading job {0}", lightweightJob.Id));
     191            hiveJob.IsDownloading = true;
     192            jobDownloader.DownloadJob(hiveJob.Job, (localJob, itemJob, exception) => {
     193              log.LogMessage(string.Format("Finished downloading job {0}", localJob.Id));
     194              HiveJob localHiveJob = GetHiveJobById(localJob.Id);
     195
    177196              if (exception != null) {
     197                log.LogException(exception);
     198                localHiveJob.IsDownloading = false;
    178199                throw new ConcurrentJobDownloaderException("Downloading job failed.", exception);
    179200              }
     
    183204              } else {
    184205                // if the job is paused, download but don't integrate into parent optimizer (to avoid Prepare)
    185                 if (hj.Job.State == JobState.Paused) {
    186                   hj.ItemJob = itemJob;
     206
     207
     208                if (localJob.State == JobState.Paused) {
     209                  localHiveJob.ItemJob = itemJob;
    187210                } else {
    188                   if (lightweightJob.ParentJobId.HasValue) {
    189                     HiveJob parentHiveJob = GetHiveJobById(lightweightJob.ParentJobId.Value);
    190                     parentHiveJob.IntegrateChild(itemJob, hj.Job.Id);
     211                  if (localJob.ParentJobId.HasValue) {
     212                    HiveJob parentHiveJob = GetHiveJobById(localJob.ParentJobId.Value);
     213                    parentHiveJob.IntegrateChild(itemJob, localJob.Id);
    191214                  } else {
    192                     hj.ItemJob = itemJob;
     215                    localHiveJob.ItemJob = itemJob;
    193216                  }
    194217                }
     218                localHiveJob.IsDownloading = false;
     219                localHiveJob.Job.LastJobDataUpdate = localJob.LastJobDataUpdate;
    195220              }
    196221            });
     
    227252                                                   || j.Job.State == JobState.Aborted
    228253                                                   || j.Job.State == JobState.Failed)
    229                                                    && j.ItemJobDownloaded);
     254                                                   && j.IsFinishedJobDownloaded);
    230255    }
    231256
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine.Test/app_services.config

    r6167 r6198  
    3636    <bindings>
    3737      <wsHttpBinding>
    38         <binding name="WSHttpBinding_IUpdate" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="200000000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
     38        <binding name="WSHttpBinding_IUpdate" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="200000000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
    3939          <readerQuotas maxDepth="32" maxStringContentLength="32000" maxArrayLength="200000000" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    4040          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
     
    4444          </security>
    4545        </binding>
    46         <binding name="WSHttpBinding_IAdmin" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="200000000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
     46        <binding name="WSHttpBinding_IAdmin" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="200000000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
    4747          <readerQuotas maxDepth="32" maxStringContentLength="32000" maxArrayLength="200000000" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    4848          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
     
    5252          </security>
    5353        </binding>
    54         <binding name="wsHttpBinding_Hive" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
    55           <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
     54        <binding name="wsHttpBinding_IHiveService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
     55          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    5656          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
    5757          <security mode="Message">
     
    7373        </identity>
    7474      </endpoint>
    75       <endpoint address="http://services.heuristiclab.com/Hive-3.4/HiveService.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_Hive" contract="HeuristicLab.Clients.Hive.IHiveService" name="wsHttpBinding_IHiveService">
     75      <endpoint address="http://services.heuristiclab.com/Hive-3.4/HiveService.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_IHiveService" contract="HeuristicLab.Clients.Hive.IHiveService" name="wsHttpBinding_IHiveService">
    7676        <identity>
    7777          <certificate encodedValue="AwAAAAEAAAAUAAAAwK1+2oAmcy/mI2P2QjyiJRh0y60gAAAAAQAAACoCAAAwggImMIIBj6ADAgECAhAIkseQ2EEhgU720qJA61gqMA0GCSqGSIb3DQEBBAUAMCQxIjAgBgNVBAMTGXNlcnZpY2VzLmhldXJpc3RpY2xhYi5jb20wHhcNMTAwNTExMTExNDAyWhcNMzkxMjMxMjM1OTU5WjAkMSIwIAYDVQQDExlzZXJ2aWNlcy5oZXVyaXN0aWNsYWIuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq26Bwmwc7k+4W30qLQ2j+FInEL5BuH6opDY6CSlrtt3xQS/anrhvpbf3QghLDVINzcHkzbPmm/SguG4F85QLB6xO+tJaOvRo0iEK5g3c307vMIru7FJwk/OhplEQ5J1hbDgL3zOJlrWlgtqRVxCtVdF3XroI9BctOt1NkeKv9ewIDAQABo1kwVzBVBgNVHQEETjBMgBCjbgdYd4j5JgUuJ1Wo/GxroSYwJDEiMCAGA1UEAxMZc2VydmljZXMuaGV1cmlzdGljbGFiLmNvbYIQCJLHkNhBIYFO9tKiQOtYKjANBgkqhkiG9w0BAQQFAAOBgQAb/2xk2uQad68shSPl/uixWgvFI8WkxOTBopOLaLtDxwCeZ3mWVHdV9VnixHtThubnEBXAhYOCQSIXWtQuXFWO+gH3YyjTRJY5kTmXyuvBRTn3/so5SrQ7Rdlm9hf6E5YVX3tCjAy7ybUyaDUkQfmH5vmvgvpMzRfsJ1qhnUpJiQ==" />
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/HiveEngine.cs

    r6178 r6198  
    261261          Thread.Sleep(500);
    262262          this.ExecutionTimeOnHive = TimeSpan.FromMilliseconds(hiveExperiments.Sum(x => x.HiveExperiment.ExecutionTime.TotalMilliseconds));
     263          cancellationToken.ThrowIfCancellationRequested();
    263264        }
    264265        LogMessage(string.Format("{0} finished (TotalExecutionTime: {1}).", refreshableHiveExperiment.ToString(), refreshableHiveExperiment.HiveExperiment.ExecutionTime));
Note: See TracChangeset for help on using the changeset viewer.