Changes between Version 5 and Version 6 of net.sf.basedb.opengrid/using


Ignore:
Timestamp:
Jan 16, 2017, 11:08:21 AM (7 years ago)
Author:
Nicklas Nordborg
Comment:

Added example of JobCompletionHandler implementation

Legend:

Unmodified
Added
Removed
Modified
  • net.sf.basedb.opengrid/using

    v5 v6  
    212212Do not update the `Job` item since this may interfere with the updates to the job made by the Open Grid extension. The method may return a string to set the status message of the job, or throw an exception to set the job status to ERROR.
    213213
     214{{{
     215public class MyAnalysisCompletionHandler
     216   implements JobCompletionHandler
     217{
     218               
     219   public MyAnalysisCompletionHandler()
     220   {}
     221       
     222   @Override
     223   public String jobCompleted(SessionControl sc, OpenGridSession session, Job job, JobStatus status)
     224   {
     225      String jobName = status.getName();
     226      String logfile = session.getJobFileAsString(jobName, "logfile", "UTF-8");
     227 
     228      DbControl dc = sc.newDbControl();
     229      try
     230      {
     231         String msg = parseLogfile(dc, logfile);
     232         dc.commit();
     233         return msg;
     234      }
     235      finally
     236      {
     237         if (dc != null) dc.close();
     238      }
     239   }
     240}
     241}}}
     242
    214243== Aborting jobs ==
    215244