bout_runners.submitter.abstract_submitter

Contains the abstract submitter class.

Classes

AbstractSubmitter(processor_split)

The abstract base class of the submitters.

class bout_runners.submitter.abstract_submitter.AbstractSubmitter(processor_split: Optional[bout_runners.submitter.processor_split.ProcessorSplit] = None)[source]

The abstract base class of the submitters.

Attributes
_logged_complete_statusbool

Whether the complete status has been logged

_statusdict of str

Status of the submission

processor_splitProcessorSplit

Object containing the processor split

job_idNone or str

Return the process id.

return_codeNone or int

Return the return code.

std_outNone or str

Return the standard output.

std_errNone or str

Return the standard error.

Methods

_catch_error()

Log the error.

_wait_for_std_out_and_std_err()

Wait until the process completes if a process has been started.

_reset_status()

Reset the status dict

submit_command(command)

Submit a command

completed()

Return the completed status

raise_error()

Raise and error from the subprocess in a clean way

write_python_script(path, function, args, kwargs)

Write python function to file

reset()

Reset the submitter

wait_until_completed(raise_error)

Wait until the process has completed

errored(raise_error)

Return True if the process errored

Declare common variables.

Parameters
processor_splitProcessorSplit or None

Object containing the processor split If None, default values will be used

Attributes
job_id

Return the process id.

return_code

Return the return code.

std_err

Return the standard error.

std_out

Return the standard output.

Methods

completed()

Return the completed status.

errored([raise_error])

Return True if the process errored.

raise_error()

Raise and error from the subprocess in a clean way.

reset()

Reset the submitter.

submit_command(command)

Submit a command.

wait_until_completed([raise_error])

Wait until the process has completed.

write_python_script(path, function[, args, …])

Write python function to file.

abstract completed() → bool[source]

Return the completed status.

errored(raise_error: bool = False) → bool[source]

Return True if the process errored.

Parameters
raise_errorbool

Whether or not to raise errors

Returns
bool

True if the process returned a non-zero code

property job_id

Return the process id.

Returns
self._status[“job_id”]int or None

The process id if a process has been called, else None

abstract raise_error() → None[source]

Raise and error from the subprocess in a clean way.

reset() → None[source]

Reset the submitter.

property return_code

Return the return code.

property std_err

Return the standard error.

Returns
self._status[“std_err”]str or None

The standard error None if the process has not completed

property std_out

Return the standard output.

Returns
self._status[“std_out”]str or None

The standard output None if the process has not completed

abstract submit_command(command: str) → Any[source]

Submit a command.

Parameters
commandstr

Command to submit

wait_until_completed(raise_error: bool = True) → None[source]

Wait until the process has completed.

Parameters
raise_errorbool

Whether or not to raise errors

static write_python_script(path: pathlib.Path, function: Callable, args: Optional[Tuple[Any, ]] = None, kwargs: Optional[Dict[str, Any]] = None) → None[source]

Write python function to file.

Parameters
pathPath

Absolute path to store the python file which holds the function and its arguments

functionfunction

The function to call

argstuple

The positional arguments

kwargsdict

The keyword arguments