oarpy package¶
Subpackages¶
Submodules¶
oarpy.oarjob module¶
-
class
oarpy.oarjob.Job(jobid)¶ Bases:
objectManage existing jobs but does not create new jobs
-
command¶
-
definition¶
-
exists¶
-
exit_code¶ Returns: - None: interrupted by user
- ==0: success
- !=0: error
-
fixed_stats(**kwds)¶
-
has_error¶
-
interrupt()¶ Stop a running, waiting or holding job
-
is_finished¶
-
is_intermediate¶
-
is_running¶
-
is_terminated¶
-
is_waiting¶
-
jobid¶
-
log_base¶
-
log_directory¶
-
name¶
-
needsresume¶
-
project¶
-
remove_logs()¶
-
resource¶
-
resume()¶ Resume suspended job or schedule job for execution
-
runtime¶ Effective execution time, excluding queue time
-
stats¶
-
status¶
-
stderr¶
-
stderr_file¶
-
stdout¶
-
stdout_file¶
-
stop()¶ Stop a running, waiting or holding job
-
suspend()¶ Remove job from schedule or suspend running job (currently not permitted)
-
time_enqueued¶ Time this job was enqueue (not scheduled for execution)
-
time_scheduled¶ Time this job was scheduled, excluding queue and runtime
-
time_to_start¶ Time until the job starts
-
wait(states=('Terminated', 'Error'), timeout=None, refresh=1, silent=False)¶ Parameters: - states (str or tuple) – state or states we are waiting for
- timeout (int or None) – if not none, second before the timeout.
- refresh (int) – time (in seconds) between two observations of the job state
- silent – if False then write to stdout advancement (‘.’)
-
working_directory¶
-
-
class
oarpy.oarjob.JobFactory(command=None, resource=None, name=None, project=None, working_directory=None, log_directory=None, log_base=None, **resource_parameters)¶ Bases:
objectDefine and submit new jobs
-
cli_arguments¶
-
cli_string¶
-
log_base¶
-
name¶
-
submit(hold=False)¶
-
-
oarpy.oarjob.search(name=None, project=None, owner=None, state=None, start=None, end=None, **properties)¶ Parameters: - name (str) –
- project (str) –
- owner (str) –
- start (datetime) –
- end (datetime) –
- state (str) –
Return list: list of jobs
-
oarpy.oarjob.submit(hold=False, **parameters)¶
oarpy.oarresource module¶
-
class
oarpy.oarresource.Resource(host=None, nodes=None, cpu=None, core=None, gpu=False, walltime=None, mem_core_mb=None, **properties)¶ Bases:
object-
cli_arguments¶
-
cli_string¶
-
cores¶
-
classmethod
from_cli(cmd, properties=None)¶
-
memory¶
-
walltime¶
-
-
oarpy.oarresource.str2walltime(s)¶
-
oarpy.oarresource.walltime2str(tdelta)¶
oarpy.oarshell module¶
-
oarpy.oarshell.cli_args2str(*cli_arguments)¶
-
oarpy.oarshell.cli_getarg(cli_arguments, flag)¶
-
oarpy.oarshell.cli_str2args(cmd)¶
-
oarpy.oarshell.execute(*args)¶
-
oarpy.oarshell.executejson(cmd, *args)¶ Parameters: cmd (str) – Return tuple: out(dict), err(str or None), exitcode(int)
-
oarpy.oarshell.installed(*args)¶
-
oarpy.oarshell.jobdel(jobid, signal=None)¶
-
oarpy.oarshell.jobhold(jobid)¶
-
oarpy.oarshell.jobresume(jobid)¶
-
oarpy.oarshell.jobstats(jobid)¶ Parameters: jobid (int) – Return tuple: out(str or None), err(str or None), exitcode(int)
-
oarpy.oarshell.jobstatus(jobid)¶ Parameters: jobid (int) –
Return str or None: - None: means job is not registered
- Hold: not scheduled (needs to be resumed)
- Waiting: scheduled for execution
- Suspended: running process is suspended
- (needs to be resumed)
- Launching: process is starting
- Running: process is running
- Resuming: resuming after hold or suspended
- Finishing: process is stopping
- Terminated: process finished successfully
- Error: process finished successfully
-
oarpy.oarshell.oarinstalled()¶
-
oarpy.oarshell.oarjobstat(jobid, *args)¶ oarstat for a single job
Parameters: jobid (int) – Return tuple: out(str or dict or None), err(str or None), exitcode(int)
-
oarpy.oarshell.oarstat(*args)¶ Return tuple: out(dict), err(str or None), exitcode(int)
-
oarpy.oarshell.oarsub(*args)¶ Return tuple: out(str or None), err(str or None), exitcode(int)
oarpy.timeutils module¶
-
oarpy.timeutils.add(dt, **kwargs)¶ Parameters: dt (datetime) – Return datetime:
-
oarpy.timeutils.astimezone(dt, tz)¶
-
oarpy.timeutils.fromtimestamp(stamp, tz=tzlocal())¶ Parameters: - stamp (int) – seconds since UNIX epoch
- tz (tzinfo) – local by default (Optional)
Return datetime: tz-aware
-
oarpy.timeutils.now(tz=tzlocal())¶ Parameters: tz (tzinfo) – local by default Return datetime: tz-aware
-
oarpy.timeutils.totimestamp(dt)¶ Parameters: dt (datetime) – assume local tz when tz-unaware Return int: seconds since UNIX epoch