flux.job.event module¶
-
class
flux.job.event.
EventLogEvent
(event)¶ Bases:
dict
wrapper class for a single KVS EventLog entry
-
property
context
¶
-
property
context_string
¶
-
property
name
¶
-
property
timestamp
¶
-
property
-
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
(stop=False)¶ Cancel a streaming job.event_watch_async() future
If stop=True, then deactivate the multi-response future so no further callbacks are called.
-
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
-
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 Version 1
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 EventLogEvent object, or raises OSError if eventlog ended before matching event was found
- Return type
-
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 Version 1
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 Version 1
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