When the Data Manager execute Jobs it monitors the Pod’s stdout stream for “events”. An event is simply a line that matches a recognised format. Each line that’s found it extracted and recorded as an Event against the Job instance record.
To generate events from Python Job code you can use the
im-data-manager-job-utilities package on PyPI.
# Import the DM logging package
from dm_job_utilities.dm_log import DmLog
# Write an event line
The DataManager events support levels, with the default (if unspecified) being
INFO. You can create an ERROR event for example by setting the
level argument: -
DmLog.emit_event('Hello World!', level=logging.WARNING)
The Data Manager does not consider any level to be more or less important than another, this is a trait of the application layer (the UI). i.e. an ERROR does not mean the DM considers the Job to have failed. The DM simply creates an event with a level matching the user’s request.
To create an event you simply need to write a line to
stdout that satisfies the following pattern: -
<iso8601 datetime> # <level name> -EVENT- <message>