Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1170 for trunk


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

Implementing Lifecycle Management (#453)

Location:
trunk/sources
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Contracts/ApplicationConstants.cs

    r1133 r1170  
    8181    public static string RESPONSE_JOB_JOB_REMOVED = "Job.JobRemoved";
    8282    public static string RESPONSE_JOB_JOBSTATE_MUST_BE_OFFLINE = "Job.JobStateMustBeOffline";
     83    public static string RESPONSE_JOB_JOB_RESULT_SENT = "Job.JobResultSent";
    8384  }
    8485}
  • trunk/sources/HeuristicLab.Hive.Contracts/HiveServerMessages.resx

    r1133 r1170  
    235235    <value>This client is not registered to calculate this job</value>
    236236  </data>
     237  <data name="Job.JobResultSent" xml:space="preserve">
     238    <value>Job Result sent successfully</value>
     239  </data>
    237240</root>
  • trunk/sources/HeuristicLab.Hive.Contracts/Interfaces/IJobManager.cs

    r967 r1170  
    3939    [OperationContract]
    4040    Response RemoveJob(long jobId);
     41    [OperationContract]
     42    ResponseObject<JobResult> GetLasJobResultOf(long jobId);
    4143  }
    4244}
  • trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs

    r1166 r1170  
    236236        job2Calculate.Client.State = State.calculating;
    237237
     238        job2Calculate.DateCalculated = DateTime.Now;
    238239        response.Job = job2Calculate;
    239240        jobAdapter.Update(job2Calculate);
     
    317318      jobResult.Percentage = percentage;
    318319      jobResult.Exception = exception;
     320      jobResult.DateFinished = DateTime.Now;
    319321
    320322      jobResultAdapter.Update(jobResult);
  • trunk/sources/HeuristicLab.Hive.Server.Core/JobManager.cs

    r1160 r1170  
    4949    }
    5050
    51     public void ResetJobsDependingOnResults(Job job) {
     51    private JobResult GetLastJobResult(Job job) {
    5252      List<JobResult> allJobResults = new List<JobResult>(jobResultAdapter.GetResultsOf(job));
    5353      JobResult lastJobResult = null;
    5454      foreach (JobResult jR in allJobResults) {
    5555        // if lastJobResult was before the current jobResult the lastJobResult must be updated
    56         if (lastJobResult == null ||         
     56        if (lastJobResult == null ||
    5757            (jR.timestamp > lastJobResult.timestamp))
    5858          lastJobResult = jR;
    5959      }
     60      return lastJobResult;
     61    }
     62
     63    public void ResetJobsDependingOnResults(Job job) {
     64      JobResult lastJobResult = GetLastJobResult(job);
    6065      if (lastJobResult != null) {
    6166        job.Percentage = lastJobResult.Percentage;
     
    127132        }
    128133
     134        job.DateCreated = DateTime.Now;
    129135        jobAdapter.Update(job);
    130136        response.Success = true;
     
    160166    }
    161167
     168    public ResponseObject<JobResult> GetLasJobResultOf(long jobId) {
     169      ResponseObject<JobResult> response = new ResponseObject<JobResult>();
     170      response.Success = true;
     171      response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_RESULT_SENT;
     172      response.Obj = GetLastJobResult(jobAdapter.GetById(jobId));
     173
     174      return response;
     175    }
     176
    162177    #endregion
    163178  }
Note: See TracChangeset for help on using the changeset viewer.