flux.job.list module

class flux.job.list.JobList(flux_handle, attrs=['all'], filters=[], ids=[], user=None, max_entries=1000, since=0.0, name=None, queue=None)

Bases: object

User friendly class for querying lists of jobs from Flux

By default a JobList will query the last max_entries jobs for all users. Other filter parameters can be passed to the constructor or the set_user() and add_filter() methods.

Flux_handle

A Flux handle obtained from flux.Flux()

Attrs

Optional list of job attributes to fetch. (default is all attrs)

Filters

List of strings defining the results or states to filter. E.g., [ "pending", "running" ].

Ids

List of jobids to return. Other filters are ignored if ids is not empty.

User

Username or userid for which to fetch jobs. Default is all users.

Max_entries

Maximum number of jobs to return

Since

Limit jobs to those that have been active since a given timestamp.

Name

Limit jobs to those with a specific name.

Queue

Limit jobs to those submitted to a specific queue.

RESULTS = {'canceled': flux.constants.FLUX_JOB_RESULT_CANCELED, 'completed': flux.constants.FLUX_JOB_RESULT_COMPLETED, 'failed': flux.constants.FLUX_JOB_RESULT_FAILED, 'timeout': flux.constants.FLUX_JOB_RESULT_TIMEOUT}
STATES = {'active': flux.constants.FLUX_JOB_STATE_ACTIVE, 'cleanup': flux.constants.FLUX_JOB_STATE_CLEANUP, 'depend': flux.constants.FLUX_JOB_STATE_DEPEND, 'inactive': flux.constants.FLUX_JOB_STATE_INACTIVE, 'pending': flux.constants.FLUX_JOB_STATE_PENDING, 'priority': flux.constants.FLUX_JOB_STATE_PRIORITY, 'run': flux.constants.FLUX_JOB_STATE_RUN, 'running': flux.constants.FLUX_JOB_STATE_RUNNING, 'sched': flux.constants.FLUX_JOB_STATE_SCHED}
add_filter(fname)

Append a state or result filter to JobList query

fetch_jobs()

Initiate the JobList query to the Flux job-info module

JobList.fetch_jobs() returns a JobListRPC or JobListIdsFuture, either of which will be fulfilled when the job data is available.

Once the Future has been fulfilled, a list of JobInfo objects can be obtained via JobList.jobs(). If JobList.errors is non-empty, then it will contain a list of errors returned via the query.

jobs()

Synchronously fetch a list of JobInfo objects from JobList query

If the Future object returned by JobList.fetch_jobs has not yet been fulfilled (e.g. is_ready() returns False), then this call may block. Otherwise, returns a list of JobInfo objects for all jobs returned from the underlying job listing RPC.

set_user(user)

Only return jobs for user (may be a username or userid)

class flux.job.list.JobListIdRPC(*args, **kwargs)

Bases: RPC

get_job()
get_jobinfo()

Returns a JobInfo object for the job.

Return type

JobInfo

class flux.job.list.JobListIdsFuture

Bases: WaitAllFuture

Simulate interface of JobListRPC for listing multiple jobids

get_jobinfos()

get all successful results as list of JobInfo objects

Any errors are appended to self.errors.

get_jobs()

get all successful results, appending errors into self.errors

class flux.job.list.JobListRPC(flux_handle, topic, payload=None, nodeid=flux.constants.FLUX_NODEID_ANY, flags=0)

Bases: RPC

get_jobinfos()

Yields a JobInfo object for each job in its current state.

Return type

JobInfo

get_jobs()

Returns all jobs in the RPC.

flux.job.list.get_job(flux_handle, jobid)

Get job information dictionary based on a jobid

This is a courtesy, blocking function for users looking for details about a job after submission. The dictionary includes the job identifier, userid that submit it, urgency, priority, t_submit, t_depend, (and others when finished), state, name, ntasks, ncores, duration, nnodes, result, runtime, returncode, waitstatus, nodelist, and exception type, severity, and note.

flux.job.list.job_list(flux_handle, max_entries=1000, attrs=['all'], userid=1005, states=0, results=0, since=0.0, name=None, queue=None)
flux.job.list.job_list_id(flux_handle, jobid, attrs=['all'])

Query job information for a single jobid.

Sends an RPC to the job-list module to query information about the provided jobid. Use the get_job() or get_jobinfo() method on the returned JobListIdRPC to obtain the job data as a dict or a JobInfo object.

Return type

JobListIdRPC

flux.job.list.job_list_inactive(flux_handle, since=0.0, max_entries=1000, attrs=['all'], name=None, queue=None)

Same as flux.job.list.job_list, but lists only inactive jobs.