Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/17/11 11:26:48 (13 years ago)
Author:
ascheibe
Message:

#1233

  • make UsedCores more reliable
  • some cosmetic fixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/SlaveJob.cs

    r6203 r6216  
    3434    }
    3535
    36     public void CalculateJob(Guid jobId) {
     36    public void PrepareJob(Guid jobId) {
     37      JobId = jobId;
    3738      Job job = wcfService.GetJob(jobId);
    3839      if (job == null) throw new JobNotFoundException(jobId);
    3940      coresNeeded = job.CoresNeeded;
    4041      SlaveStatusInfo.IncrementUsedCores(coresNeeded);
     42    }
     43
     44    public void CalculateJob() {
     45      Job job = wcfService.GetJob(JobId);
     46      if (job == null) throw new JobNotFoundException(JobId);
    4147
    4248      JobData jobData = wcfService.GetJobData(job.Id);
    43       if (jobData == null) throw new JobDataNotFoundException(jobId);
     49      if (jobData == null) throw new JobDataNotFoundException(JobId);
    4450      SlaveStatusInfo.IncrementJobsFetched();
    4551      job = wcfService.UpdateJobState(job.Id, JobState.Calculating, null);
    46       if (job == null) throw new JobNotFoundException(jobId);
     52      if (job == null) throw new JobNotFoundException(JobId);
    4753      StartJobInAppDomain(job, jobData);
    4854    }
     
    6672            SlaveStatusInfo.IncrementJobsAborted();
    6773
    68             clientCom.LogMessage("Sending the stopped job with id: " + job.Id);
     74            clientCom.LogMessage(string.Format("Sending the stopped job with id: {0}", job.Id));
    6975            wcfService.UpdateJobData(job, sJob, ConfigManager.Instance.GetClientInfo().Id, JobState.Aborted);
    7076          }
    7177          catch (Exception e) {
    72             clientCom.LogMessage("Transmitting to server failed. Storing the paused job with id: " + job.Id + " to hdd (" + e.ToString() + ")");
     78            clientCom.LogMessage(string.Format("Transmitting the stopped job with id {0} to server failed. Exception is: {1}", job.Id, e.ToString()));
    7379          }
    7480          finally {
     
    101107          }
    102108          catch (Exception e) {
    103             clientCom.LogMessage("Transmitting to server failed. Storing the paused job with id: " + job.Id + " to hdd (" + e.ToString() + ")");
     109            clientCom.LogMessage(string.Format("Transmitting the paused job with id {0} to server failed. Exception is: {1}", job.Id, e.ToString()));
    104110          }
    105111          finally {
     
    138144    public void SendFinishedJob() {
    139145      try {
    140         clientCom.LogMessage("Getting the finished job with id: " + JobId);
     146        clientCom.LogMessage(string.Format("Getting the finished job with id: {0} ", JobId));
    141147        if (executor == null) {
    142148          clientCom.LogMessage(string.Format("SendFinishedJob: Can't pause job with id {0} with uninitialized executor", JobId));
     
    159165        try {
    160166          JobData sJob = executor.GetFinishedJob();
    161           clientCom.LogMessage("Sending the finished job with id: " + JobId);
     167          clientCom.LogMessage(string.Format("Sending the finished job with id: {0}", JobId));
    162168          wcfService.UpdateJobData(job, sJob, ConfigManager.Instance.GetClientInfo().Id, JobState.Finished);
    163169        }
    164170        catch (Exception e) {
    165           clientCom.LogMessage("Transmitting to server failed. Storing the finished job with id: " + JobId + " to hdd (" + e.ToString() + ")");
     171          clientCom.LogMessage(string.Format("Transmitting the job with id {0} to server failed. Exception is: {1}", job.Id, e.ToString()));
    166172        }
    167173        finally {
     
    171177      }
    172178      catch (Exception e) {
    173         clientCom.LogMessage("SendFinishedJob: The following exception has been thrown: " + e.ToString());
     179        clientCom.LogMessage(string.Format("SendFinishedJob: The following exception has been thrown: {0}", e.ToString()));
    174180      }
    175181    }
     
    181187      JobId = job.Id;
    182188
    183       clientCom.LogMessage("Received new job with id " + job.Id);
     189      clientCom.LogMessage(string.Format("Received new job with id {0}", job.Id));
    184190      clientCom.StatusChanged(ConfigManager.Instance.GetStatusForClientConsole());
    185191
     
    190196      try {
    191197        PluginCache.Instance.PreparePlugins(job, out configFileName);
    192         clientCom.LogMessage("Plugins fetched for job " + job.Id);
     198        clientCom.LogMessage(string.Format("Plugins fetched for job {0}", job.Id));
    193199        pluginsPrepared = true;
    194200      }
     
    214220          executor.CoresNeeded = job.CoresNeeded;
    215221          executor.MemoryNeeded = job.MemoryNeeded;
    216           clientCom.LogMessage("Starting Executor for job " + job.Id);
     222          clientCom.LogMessage(string.Format("Starting Executor for job {0}", job.Id));
    217223
    218224          executor.Start(jobData.Data);
     
    222228        }
    223229        catch (Exception exception) {
    224           clientCom.LogMessage("Creating the Appdomain and loading the job failed for job " + job.Id);
    225           clientCom.LogMessage("Error thrown is: " + exception.ToString());
     230          clientCom.LogMessage(string.Format("Creating the Appdomain and loading the job failed for job {0}", job.Id));
     231          clientCom.LogMessage(string.Format("Error thrown is: {0}", exception.ToString()));
    226232
    227233          if (executor != null && executor.CurrentException != string.Empty) {
     
    243249    /// <param name="JobId">the GUID of the job</param>   
    244250    public void KillAppDomain() {
    245       clientCom.LogMessage("Shutting down Appdomain for Job " + JobId);
     251      clientCom.LogMessage(string.Format("Shutting down Appdomain for Job {0}", JobId));
    246252
    247253      try {
     
    280286      }
    281287      catch (Exception ex) {
    282         clientCom.LogMessage("Exception when unloading the appdomain: " + ex.ToString());
     288        clientCom.LogMessage(string.Format("Exception when unloading the appdomain: {0}", ex.ToString()));
    283289      }
    284290      finally {
     
    291297
    292298    private void AppDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) {
    293       clientCom.LogMessage("Exception in AppDomain: " + e.ExceptionObject.ToString());
     299      clientCom.LogMessage(string.Format("Exception in AppDomain: ", e.ExceptionObject.ToString()));
    294300      KillAppDomain();
    295301    }
Note: See TracChangeset for help on using the changeset viewer.