flux.job.event module

class flux.job.event.EventLogEvent(event)

Bases: object

wrapper class for a single KVS EventLog entry

context
name
timestamp
class flux.job.event.JobEventWatchFuture(future_handle)

Bases: flux.future.Future

A future returned from job.event_watch_async(). Adds get_event() method to return an EventLogEntry event

cancel()

Cancel a streaming job.event_watch_async() future

get_event(autoreset=True)

Return the next event from a JobEventWatchFuture, or None if the event stream has terminated.

The future is auto-reset unless autoreset=False, so a subsequent call to get_event() will try to fetch the next event and thus may block.

exception flux.job.event.JobException(event)

Bases: Exception

Represents an 'exception' event occurring to a job.

Instances expose a few public attributes.

Variables:
  • timestamp -- the timestamp of the 'exception' event.
  • type -- A string identifying the type of job exception.
  • note -- Brief human-readable explanation of the exception.
  • severity -- the severity of the exception. Exceptions with a severity of 0 are fatal to the job; any other severity is non-fatal.
flux.job.event.event_wait(flux_handle, jobid, name, eventlog='eventlog', raiseJobException=True)

Wait for a job eventlog entry 'name'

Wait synchronously for an eventlog entry named "name" and return the entry to caller, raises OSError with ENODATA if event never occurred

See also

21/Job States and Events
Documentation for the events in the main eventlog
Parameters:
  • flux_handle (Flux) -- handle for Flux broker from flux.Flux()
  • jobid -- the job ID on which to wait for eventlog events
  • name -- The event name for which to wait
  • eventlog -- eventlog path in job kvs directory (default: eventlog)
  • raiseJobException -- if True, watch for job exception events and raise a JobException if one is seen before event 'name' (default=True)
Returns:

an EventLogEntry object, or raises OSError if eventlog ended before matching event was found

Return type:

EventLogEntry

flux.job.event.event_watch(flux_handle, jobid, eventlog='eventlog')

Python generator to watch all events for a job

Synchronously watch events a job eventlog via a simple generator.

Example

>>> for event in job.event_watch(flux_handle, jobid):
...     # do something with event

See also

21/Job States and Events
Documentation for the events in the main eventlog
Parameters:
  • flux_handle (Flux) -- handle for Flux broker from flux.Flux()
  • jobid -- the job ID on which to watch events
  • eventlog -- eventlog path in job kvs directory (default: eventlog)
flux.job.event.event_watch_async(flux_handle, jobid, eventlog='eventlog')

Asynchronously get eventlog updates for a job

Asynchronously watch the events of a job eventlog.

Returns a JobEventWatchFuture. Call .get_event() from the then callback to get the currently returned event from the Future object.

See also

21/Job States and Events
Documentation for the events in the main eventlog
Parameters:
  • flux_handle (Flux) -- handle for Flux broker from flux.Flux()
  • jobid -- the job ID on which to watch events
  • eventlog -- eventlog path in job kvs directory (default: eventlog)
Returns:

a JobEventWatchFuture object

Return type:

JobEventWatchFuture