Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2111


Ignore:
Timestamp:
06/25/09 18:28:38 (15 years ago)
Author:
gkronber
Message:

Implemented discrimination of snapshots vs. end results in HiveEngine and Job. #545 (Engine which can be executed in the Hive)

Location:
trunk/sources/HeuristicLab.Hive.Engine/3.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Engine/3.2/HiveEngine.cs

    r2105 r2111  
    4343    private const int SNAPSHOT_POLLING_INTERVAL_MS = 1000;
    4444    private const int RESULT_POLLING_INTERVAL_MS = 10000;
     45    private const int MAX_SNAPSHOT_RETRIES = 20;
    4546    private Guid jobId;
    4647    private Job job;
     
    117118              HiveLogger.Debug("HiveEngine: Results-polling - Got result!");
    118119              restoredJob = (Job)PersistenceManager.RestoreFromGZip(response.Obj.SerializedJobResultData);
    119               HiveLogger.Debug("HiveEngine: Results-polling - IsSnapshotResult: " + restoredJob.Engine.Canceled);
     120              HiveLogger.Debug("HiveEngine: Results-polling - IsSnapshotResult: " + (restoredJob.Progress<1.0));
    120121            }
    121122          }
    122         } while (restoredJob == null || restoredJob.Engine.Canceled);
     123        } while (restoredJob == null || (restoredJob.Progress < 1.0));
    123124
    124125        job = restoredJob;
     
    133134    public void RequestSnapshot() {
    134135      IExecutionEngineFacade executionEngineFacade = ServiceLocator.CreateExecutionEngineFacade(HiveServerUrl);
    135 
     136      int retryCount = 0;
    136137      ResponseObject<SerializedJobResult> response;
    137138      lock (locker) {
     
    151152            response = executionEngineFacade.GetLastSerializedResult(jobId, true);
    152153            HiveLogger.Debug("HiveEngine: Abort - Server: " + response.StatusMessage + " success: " + response.Success);
     154            retryCount++;
    153155            // loop while
    154156            // 1. problem with communication with server
    155157            // 2. job result not yet ready
    156158          } while (
     159            (retryCount < MAX_SNAPSHOT_RETRIES) && (
    157160            !response.Success ||
    158             response.StatusMessage == ApplicationConstants.RESPONSE_JOB_RESULT_NOT_YET_HERE);
     161            response.StatusMessage == ApplicationConstants.RESPONSE_JOB_RESULT_NOT_YET_HERE)
     162            );
    159163        }
    160164      }
     
    180184    public void Abort() {
    181185      abortRequested = true;
    182       RequestSnapshot();
     186      // RequestSnapshot();
    183187      IExecutionEngineFacade executionEngineFacade = ServiceLocator.CreateExecutionEngineFacade(HiveServerUrl);
    184188      executionEngineFacade.AbortJob(jobId);
     
    195199
    196200    private HeuristicLab.Hive.Contracts.BusinessObjects.SerializedJob CreateJobObj() {
    197       HeuristicLab.Hive.Contracts.BusinessObjects.Job jobObj = 
     201      HeuristicLab.Hive.Contracts.BusinessObjects.Job jobObj =
    198202        new HeuristicLab.Hive.Contracts.BusinessObjects.Job();
    199203
  • trunk/sources/HeuristicLab.Hive.Engine/3.2/Job.cs

    r2089 r2111  
    5555
    5656    void engine_Finished(object sender, EventArgs e) {
     57      if (Engine.Canceled) this.progress = 0.0;
     58      else this.progress = 1.0;
    5759      if (JobStopped != null)
    5860        JobStopped(this, new EventArgs());
     
    6971    }
    7072
     73    private double progress;
    7174    public double Progress {
    7275      get {
    7376        DoubleData progress = Engine.GlobalScope.GetVariableValue<DoubleData>("Progress", false,
    7477          false);
    75         return progress == null ? 0.0 : progress.Data;
     78        return progress == null ? this.progress : progress.Data;
    7679      }
    7780      set { throw new NotSupportedException(); }
     
    105108      XmlAttribute idAttr = document.CreateAttribute("JobId");
    106109      idAttr.Value = XmlConvert.ToString(JobId);
     110      XmlAttribute progressAttr = document.CreateAttribute("Progress");
     111      progressAttr.Value = XmlConvert.ToString(progress);
    107112      node.Attributes.Append(idAttr);
     113      node.Attributes.Append(progressAttr);
    108114      node.AppendChild(PersistenceManager.Persist("Engine", Engine, document, persistedObjects));
    109115      return node;
     
    112118      base.Populate(node, restoredObjects);
    113119      JobId = XmlConvert.ToInt64(node.Attributes["JobId"].Value);
     120      progress = XmlConvert.ToDouble(node.Attributes["Progress"].Value);
    114121      DeregisterEvents();
    115122      engine = (SequentialEngine.SequentialEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects);
Note: See TracChangeset for help on using the changeset viewer.