pyslurmutils.client.job_io.base_io.Future#

class pyslurmutils.client.job_io.base_io.Future(job_id, client=None)[source]#

Bases: object

Mimic concurrent.futures API

Parameters:

job_id (int) –

cancel()[source]#

Cancel the future if possible. The SLURM job is not affected.

Returns True if the future was cancelled, False otherwise. A future cannot be cancelled if it is running or has already completed.

Return type:

bool

cancel_job()[source]#

Cancel the SLURM job

Return type:

None

cancelled()[source]#

Return True if the future was cancelled.

Return type:

Optional[bool]

cleanup_job()[source]#

Cleanup job artifacts

Return type:

None

property client#
done()[source]#

Return True if the future was cancelled or finished executing.

Return type:

Optional[bool]

exception(timeout=None)[source]#

Waits for the result indefinitely by default.

Raises:

CancelledError: If the future was cancelled. TimeoutError: If the future didn’t finish executing before the given

timeout.

Parameters:

timeout (Optional[Number]) –

Return type:

Optional[Exception]

job_status()[source]#
Return type:

None

result(timeout=None)[source]#

Waits for the result indefinitely by default.

Raises:

CancelledError: If the future was cancelled. TimeoutError: If the future didn’t finish executing before the given

timeout.

Exception: the exception raised by the job

Parameters:

timeout (Optional[Number]) –

Return type:

Any

running()[source]#

Return True if the future is currently executing.

Return type:

Optional[bool]

wait(timeout=None)[source]#
Parameters:

timeout (Optional[Number]) –

Return type:

bool