示例#1
0
文件: local.py 项目: ewiger/plato
 def execute(self, job):
     super(LocalRunner, self).execute(job)
     result = JobResult(has_failed=True, details=job.info.copy())        
     if job.info['queue'] == 'default':
         report_filename = self.get_report_filepath(job)
         with open(report_filename, 'w+') as report:
             report.write('Submitting job [%d] with report file: %s \n' % \
                          (job.id, report_filename))
         logger.debug('Submitting job [%d] with report file: %s' % \
                      (job.id, report_filename))
         pidfile_path = self.get_pidfile_path(job.id)
         result.details['local_pidfile_path'] = pidfile_path
         result.details['local_queue'] = job.info['queue']
         try:                
             result.details['local_id'] = ProcessUtil.exec_process(
                 job.info['command'],
                 report_filename,
                 pidfile_path)                
             result.has_failed = False
         except Exception as exception:
             result.error = str(exception)                
             logger.warn(result.error)                        
     else:
         result.error = 'Job info has unknown queue.'
         logger.warn(result.error)
     return result
示例#2
0
文件: lsf.py 项目: ewiger/plato
 def execute(self, job):
     super(LsfRunner, self).execute(job)
     result = JobResult(has_failed=True, details=job.info.copy())
     stderr = StringIO()
     if job.info["queue"] == "default":
         report = self.get_report_filepath(job)
         result.output = bsub("-o", report, _in=job.info["command"], _err=stderr).strip()
         result.error = stderr.getvalue().strip()
         logger.debug("bsub output: %s" % result.output)
         logger.debug("bsub error: %s" % result.error)
         match = submit_expr.search(result.output)
         if match:
             result.has_failed = False
             result.details["lsf_id"] = match.group(1)
             result.details["lsf_queue"] = match.group(2)
     else:
         result.error = "Job info has unknown queue."
         logger.warn(result.error)
     return result