Source code for buildtest.scheduler.job

import time


[docs] class Job: """This is a base class for holding job level data and common methods for used for batch job submission.""" def __init__(self, jobID): self.jobid = jobID self._state = None self._outfile = None self._errfile = None self._exitcode = None self._jobdata = None # used to store the job elapsed time self.elapsedtime = 0 # used for job pending time self.pendtime = 0 # time when job was submitted self.submittime = time.time() # time when job was started self.starttime = None
[docs] def state(self): """Return job state""" return self._state
[docs] def get(self): """Return Job ID as string type""" return str(self.jobid)
[docs] def is_pending(self): """Check if job is in pending state""" raise NotImplementedError
[docs] def is_running(self): """Check if job is in running state""" raise NotImplementedError
[docs] def is_suspended(self): """Check if job is in suspended state""" raise NotImplementedError
[docs] def cancel(self): """Cancel job""" raise NotImplementedError
[docs] def poll(self): """Poll job and update job state.""" raise NotImplementedError
[docs] def get_output_and_error_files(self): """Get output and error of job""" raise NotImplementedError
[docs] def output_file(self): """Return output file of job""" return self._outfile
[docs] def error_file(self): """Return error file of job""" return self._errfile
[docs] def exitcode(self): """Return exit code of job""" return self._exitcode
[docs] def retrieve_jobdata(self): raise NotImplementedError
[docs] def jobdata(self): return self._jobdata