flux.job.wait module

class flux.job.wait.JobResultFuture(future_handle, prefixes=None, pimpl_t=None)

Bases: Future

Future fulfilled with a job "result"

Supports methods to return the result as either a raw dict or flux.job.info.JobInfo object.

get_dict(*args, **kwargs)
get_info(*args, **kwargs)
class flux.job.wait.JobWaitFuture(future_handle, prefixes=None, pimpl_t=None)

Bases: Future

get_status()

Return the result of a job wait request.

This method blocks until the response is received, then decodes the result to obtain the job status.

Returns

job status, a tuple of: Job ID (int), success (bool), and an error (string) if success=False

Return type

JobWaitResult

class flux.job.wait.JobWaitResult(jobid, success, errstr)

Bases: tuple

errstr

Alias for field number 2

jobid

Alias for field number 0

success

Alias for field number 1

flux.job.wait.result(flux_handle, jobid, flags=0)

Wait for a job to reach its terminal state and return job result

This function waits for job completion by watching the eventlog. Because this function must process the eventlog, it is a little more heavyweight than flux.job.wait.wait(). However, it may be used for non-waitable jobs, jobs that have already completed, and works multiple times on the same jobid.

This function will wait until the job result is available and returns a flux.job.info.JobInfo object filled with the available information.

Note: The JobInfo object returned from this method is only capable of computing a small subset of job information, including, but possibly not limited to:

  • id

  • t_submit, t_run, t_cleanup

  • returncode

  • waitstatus

  • runtime

  • result

  • result_id

Parameters
Returns

A limited JobInfo object which can be used to fetch the final job result, returncode, etc.

Return type

JobInfo

flux.job.wait.result_async(flux_handle, jobid, flags=0)

Wait for a job to reach its terminal state and return job result

This function waits for job completion by watching the eventlog. Because this function must process the eventlog, it is a little more heavyweight than flux.job.wait.wait_async(). However, it may be used for non-waitable jobs, jobs that have already completed, and works multiple times on the same jobid.

Once the eventlog terminal state is reached, the returned Future is fulfilled with a set of information gleaned from the processed events, including whether the job started running (in case it was canceled before starting), any exception state, and the final exit code and wait(2) status.

Parameters
Returns

A Future fulfilled with the job result.

Return type

JobResultFuture

flux.job.wait.wait(flux_handle, jobid=_flux._core.lib.FLUX_JOBID_ANY)

Wait for a job to complete

Submit a request to wait for job completion, blocking until a response is received, then return the job status.

Only jobs submitted with waitable=True can be waited for.

Parameters
  • flux_handle (Flux) -- handle for Flux broker from flux.Flux()

  • jobid -- the job ID to wait for (default is any waitable job)

Returns

job status, a tuple of: Job ID (int), success (bool), and an error (string) if success=False

Return type

JobWaitResult

flux.job.wait.wait_async(flux_handle, jobid=_flux._core.lib.FLUX_JOBID_ANY)

Wait for a job to complete, asynchronously

Submit a request to wait for job completion. This method returns immediately with a Flux Future, which can be used to process the result later.

Only jobs submitted with waitable=True can be waited for.

Parameters
  • flux_handle (Flux) -- handle for Flux broker from flux.Flux()

  • jobid -- the job ID to wait for (default is any waitable job)

Returns

a Flux Future object for obtaining the job result

Return type

JobWaitFuture