.. mep-jobcontrol-callback-python documentation master file, created by
sphinx-quickstart on Wed Apr 26 17:02:02 2017.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
mep-jobcontrol-callback-python: PROBA-V MEP Python JobControl client
====================================================================
This Python client uses the REST service of the `PROBA-V MEP `_
JobControl framework, allowing Python jobs to push information about jobruns, jobrun actions and
log files to the PROBA-V MEP JobControl framework.
Installation
============
The package is available in the public PROBA-V MEP PyPi repository and can be easily installed using pip::
$ pip install jobcontrol-callback
When you are using a `PROBA-V MEP Virtual Machine (VM) `_,
the package is already pre-installed for you.
Usage
=====
Example registration of jobrun:
>>> from jobcontrol import callback
>>> cbc = callback.CallbackClient()
>>> jobrun = cbc.register_jobrun('application_1492674955132_0214', 'daemsd')
Example registration of jobrun action:
>>> jobrun_action = cbc.register_jobrun_action(jobrun.id_, 'pre-processing')
When adding the JobControlHandler to the log handlers, logging will be pushed to the JobControl
framework, making it available through the JobControl dashboard.
>>> import logging
>>> from jobcontrol import loghandler
>>> logger = logging.getLogger(__name__)
>>> logger.addHandler(loghandler.jobcontrolhandler.JobControlHandler(jobrun.id_, jobrun_action.id_))
>>> logger.log('Started processing tile X10Y20')
API
===
.. automodule:: jobcontrol.callback
:members:
.. automodule:: jobcontrol.loghandler.jobcontrolhandler
:members:
.. toctree::
:maxdepth: 2
:caption: Contents:
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`