Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/21/09 16:22:25 (16 years ago)
Author:
msteinbi
Message:

Implementing Lifecycle Management (#453)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.Core/JobManager.cs

    r1149 r1160  
    5050
    5151    public void ResetJobsDependingOnResults(Job job) {
    52       List<JobResult> allJobResults = new List<JobResult>(jobResultAdapter.GetAll());
     52      List<JobResult> allJobResults = new List<JobResult>(jobResultAdapter.GetResultsOf(job));
    5353      JobResult lastJobResult = null;
    5454      foreach (JobResult jR in allJobResults) {
    55         if (jR.Job != null && jR.Job.Id == job.Id) {
    56           if (lastJobResult != null) {
    57             // if lastJobResult was before the current jobResult the lastJobResult must be updated
    58             if ((jR.timestamp.Subtract(lastJobResult.timestamp)).Seconds > 0)
    59               lastJobResult = jR;
    60           }
    61         }
     55        // if lastJobResult was before the current jobResult the lastJobResult must be updated
     56        if (lastJobResult == null ||         
     57            (jR.timestamp > lastJobResult.timestamp))
     58          lastJobResult = jR;
    6259      }
    6360      if (lastJobResult != null) {
    64         job.Client = null;
    6561        job.Percentage = lastJobResult.Percentage;
    66         job.State = State.offline;
    6762        job.SerializedJob = lastJobResult.Result;
    6863      } else {
    69         job.Client = null;
    7064        job.Percentage = 0;
    71         job.State = State.offline;
    7265      }
     66
     67      job.Client = null;
     68      job.State = State.offline;
     69
    7370      jobAdapter.Update(job);
    7471    }
Note: See TracChangeset for help on using the changeset viewer.