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.
Python
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
DmLog.emit_event('Hello World!')
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: -
import logging
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.
Non-Python
To create an event you simply need to write a line to stdout
that satisfies the following pattern: -
<iso8601 datetime> # <level name> -EVENT- <message>
- The
datetime
must be a form recognised by the python-dateutil package - The level name should be the name of the recognised Python logging levels