Changeset 1374


Ignore:
Timestamp:
03/20/09 12:12:05 (12 years ago)
Author:
msteinbi
Message:

splited ProcessJobResult into two methods (StoreFinishedJobResult, ProcessSnapshot) (#531)

Location:
trunk/sources
Files:
3 edited

Legend:

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

    r1369 r1374  
    4040    ResponseJob SendJob(Guid clientId);
    4141    [OperationContract]
    42     ResponseResultReceived ProcessJobResult(Guid clientId,
     42    ResponseResultReceived StoreFinishedJobResult(Guid clientId,
    4343      long jobId,
    4444      byte[] result,
    4545      double percentage,
    46       Exception exception, 
    47       bool finished);
     46      Exception exception);
     47    [OperationContract]
     48    ResponseResultReceived ProcessSnapshot(Guid clientId,
     49      long jobId,
     50      byte[] result,
     51      double percentage,
     52      Exception exception);
    4853    [OperationContract]
    4954    Response Logout(Guid clientId);
  • trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs

    r1369 r1374  
    246246    }
    247247
    248     /// <summary>
    249     /// the client can send job results during calculating
    250     /// and will send a final job result when he finished calculating
    251     /// these job results will be stored in the database
    252     /// </summary>
    253     /// <param name="clientId"></param>
    254     /// <param name="jobId"></param>
    255     /// <param name="result"></param>
    256     /// <param name="exception"></param>
    257     /// <param name="finished"></param>
    258     /// <returns></returns>
    259     public ResponseResultReceived ProcessJobResult(Guid clientId,
    260       long jobId,
    261       byte[] result,
     248    private ResponseResultReceived ProcessJobResult(Guid clientId,
     249      long jobId,
     250      byte[] result,
    262251      double percentage,
    263       Exception exception, 
     252      Exception exception,
    264253      bool finished) {
     254
    265255      ResponseResultReceived response = new ResponseResultReceived();
    266256      ClientInfo client =
    267257        clientAdapter.GetById(clientId);
    268258
    269       Job job = 
     259      Job job =
    270260        jobAdapter.GetById(jobId);
    271261
    272       if (job.Client == null)    {
     262      if (job.Client == null) {
    273263        response.Success = false;
    274264        response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_IS_NOT_BEEING_CALCULATED;
     
    288278        response.Success = true;
    289279        response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOBRESULT_RECEIVED;
    290         return response;       
     280        return response;
    291281      }
    292282      if (job.State != State.calculating) {
     
    306296
    307297        List<JobResult> jobResults = new List<JobResult>(jobResultAdapter.GetResultsOf(job));
    308         foreach (JobResult currentResult in jobResults) 
     298        foreach (JobResult currentResult in jobResults)
    309299          jobResultAdapter.Delete(currentResult);
    310300      }
     
    330320    }
    331321
     322
     323    /// <summary>
     324    /// the client can send job results during calculating
     325    /// and will send a final job result when he finished calculating
     326    /// these job results will be stored in the database
     327    /// </summary>
     328    /// <param name="clientId"></param>
     329    /// <param name="jobId"></param>
     330    /// <param name="result"></param>
     331    /// <param name="exception"></param>
     332    /// <param name="finished"></param>
     333    /// <returns></returns>
     334    public ResponseResultReceived StoreFinishedJobResult(Guid clientId,
     335      long jobId,
     336      byte[] result,
     337      double percentage,
     338      Exception exception) {
     339
     340      return ProcessJobResult(clientId, jobId, result, percentage, exception, true);
     341    }
     342
     343
     344    public ResponseResultReceived ProcessSnapshot(Guid clientId, long jobId, byte[] result, double percentage, Exception exception) {
     345      return ProcessJobResult(clientId, jobId, result, percentage, exception, false);
     346    }
     347
    332348    /// <summary>
    333349    /// when a client logs out the state will be set
  • trunk/sources/HeuristicLab.Hive.Server.Core/ClientFacade.cs

    r1369 r1374  
    4848    }
    4949
    50     public ResponseResultReceived ProcessJobResult(Guid clientId,
     50    public ResponseResultReceived StoreFinishedJobResult(Guid clientId,
    5151      long jobId,
    5252      byte[] result,
    5353      double percentage,
    54       Exception exception,
    55       bool finished) {
    56       return clientCommunicator.ProcessJobResult(clientId, jobId, result, percentage, exception, finished);
     54      Exception exception) {
     55      return clientCommunicator.StoreFinishedJobResult(clientId, jobId, result, percentage, exception);
    5756    }
    5857
     
    6968    }
    7069
     70    public ResponseResultReceived ProcessSnapshot(Guid clientId, long jobId, byte[] result, double percentage, Exception exception) {
     71      throw new NotImplementedException();
     72    }
     73
    7174    #endregion
    7275  }
Note: See TracChangeset for help on using the changeset viewer.