salt.runners.jobs

A convenience system to manage jobs, both active and already run

salt.runners.jobs.active(outputter=None, display_progress=False)

Return a report on all actively running jobs from a job id centric perspective

CLI Example:

salt-run jobs.active
salt.runners.jobs.last_run(ext_source=None, outputter=None, metadata=None, function=None, target=None, display_progress=False)

List all detectable jobs and associated functions

New in version Beryllium.

CLI Example:

salt-run jobs.last_run

salt-run jobs.last_run target=nodename

salt-run jobs.last_run function='cmd.run'

salt-run jobs.last_run metadata="{'foo': 'bar'}"
salt.runners.jobs.list_job(jid, ext_source=None, outputter=None)

List a specific job given by its jid

CLI Example:

salt-run jobs.list_job 20130916125524463507
salt.runners.jobs.list_jobs(ext_source=None, outputter=None, search_metadata=None, search_function=None, search_target=None, start_time=None, end_time=None, display_progress=False)

List all detectable jobs and associated functions

ext_source
The external job cache to use. Default: None.
search_metadata
Search the metadata of a job for the provided string of dictionary. Default: 'None'.
search_function
Search the function of a job for the provided string. Default: 'None'.
search_target
Search the target of a job for the provided minion name. Default: 'None'.
start_time
Search for jobs where the start time of the job is greater than or equal to the provided time stamp. Any timestamp supported by the Dateutil (required) module can be used. Default: 'None'.
end_time
Search for jobs where the start time of the job is less than or equal to the provided time stamp. Any timestamp supported by the Dateutil (required) module can be used. Default: 'None'.

CLI Example:

salt-run jobs.list_jobs
salt-run jobs.list_jobs search_function='test.*' search_target='localhost' search_metadata='{"bar": "foo"}'
salt-run jobs.list_jobs start_time='2015, Mar 16 19:00' end_time='2015, Mar 18 22:00'
salt.runners.jobs.lookup_jid(jid, ext_source=None, returned=True, missing=False, outputter=None, display_progress=False)

Return the printout from a previously executed job

jid
The jid to look up.
ext_source
The external job cache to use. Default: None.
returned

When set to True, adds the minions that did return from the command. Default: True.

New in version Beryllium.

missing
When set to True, adds the minions that did NOT return from the command. Default: False.
display_progress

Displays progress events when set to True. Default: False.

New in version 2015.5.0.

CLI Example:

salt-run jobs.lookup_jid 20130916125524463507
salt-run jobs.lookup_jid 20130916125524463507 outputter=highstate
salt.runners.jobs.print_job(jid, ext_source=None, outputter=None)

Print a specific job's detail given by it's jid, including the return data.

CLI Example:

salt-run jobs.print_job 20130916125524463507