Informatics Matters Data Manager Job Utilities
==============================================
.. image:: https://badge.fury.io/py/im-data-manager-job-utilities.svg
:target: https://badge.fury.io/py/im-data-manager-job-utilities
:alt: PyPI package (latest)
.. image:: https://github.com/InformaticsMatters/squonk2-data-manager-job-utilities/actions/workflows/build.yaml/badge.svg
:target: https://github.com/InformaticsMatters/squonk2-data-manager-job-utilities/actions/workflows/build.yaml
:alt: Build
.. image:: https://github.com/InformaticsMatters/squonk2-data-manager-job-utilities/actions/workflows/publish.yaml/badge.svg
:target: https://github.com/InformaticsMatters/squonk2-data-manager-job-utilities/actions/workflows/publish.yaml
:alt: Publish
A Python 2/3 package that simplifies the generation of *events* and *cost*
lines written to a **Squonk2 Job** stdout stream.
The following utilities are available: -
- ``DmLog.emit_event()``
- ``DmLog.emit_cost()``
A number of miscellaneous utilities are also included. These have been
extracted form the squonk2 virtual-screening ``utils.py`` module and moved
here into ``utils.py``.
Installation (Python)
=====================
The Job utilities are published on `PyPI`_ and can be installed from
there::
pip install im-data-manager-job-utilities
Once installed you can use the available classes::
>>> from dm_job_utilities.dm_log import DmLog
>>> DmLog.emit_event('Hello World!')
2022-02-03T16:39:27+00:00 # INFO -EVENT- Hello World!
>>> from decimal import Decimal
>>> DmLog.emit_cost(Decimal('5.7'))
2022-02-03T16:40:16+00:00 # INFO -COST- 5.7 1
Costs are *total* by default but can be issued as an incremental value::
>>> DmLog.emit_cost(Decimal('0.5'), incremental=True)
2022-02-03T16:40:16+00:00 # INFO -COST- +0.5 2
The final value on each cost line is a unique sequence number. This value
is typically an integer that increments with each line. It is required and
is used by the Data Manager to avoid duplicating costs.
The Data Manager uses the `python-dateutil`_ package to parse
dates and times from the generated log lines. The package is extremely
tolerant of many formats but if you are in control of the
string, the preferred format would be to use a classic UTC ISO string like
``%Y-%m-%dT%H:%M:%S%z`` so that the date and time is written as::
2022-03-20T10:49:41+00:00
.. _PyPI: https://pypi.org/project/im-data-manager-job-utilities
.. _python-dateutil: https://pypi.org/project/python-dateutil
Get in touch
============
- Report bugs, suggest features or view the source code `on GitHub`_.
.. _on GitHub: https://github.com/informaticsmatters/squonk2-data-manager-job-utilities
Raw data
{
"_id": null,
"home_page": "https://github.com/informaticsmatters/squonk2-data-manager-job-utilities",
"name": "im-data-manager-job-utilities",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "logging",
"author": "Alan Christie",
"author_email": "achristie@informaticsmatters.com",
"download_url": null,
"platform": "any",
"description": "Informatics Matters Data Manager Job Utilities\n==============================================\n\n.. image:: https://badge.fury.io/py/im-data-manager-job-utilities.svg\n :target: https://badge.fury.io/py/im-data-manager-job-utilities\n :alt: PyPI package (latest)\n\n.. image:: https://github.com/InformaticsMatters/squonk2-data-manager-job-utilities/actions/workflows/build.yaml/badge.svg\n :target: https://github.com/InformaticsMatters/squonk2-data-manager-job-utilities/actions/workflows/build.yaml\n :alt: Build\n\n.. image:: https://github.com/InformaticsMatters/squonk2-data-manager-job-utilities/actions/workflows/publish.yaml/badge.svg\n :target: https://github.com/InformaticsMatters/squonk2-data-manager-job-utilities/actions/workflows/publish.yaml\n :alt: Publish\n\nA Python 2/3 package that simplifies the generation of *events* and *cost*\nlines written to a **Squonk2 Job** stdout stream.\n\nThe following utilities are available: -\n\n- ``DmLog.emit_event()``\n- ``DmLog.emit_cost()``\n\nA number of miscellaneous utilities are also included. These have been\nextracted form the squonk2 virtual-screening ``utils.py`` module and moved\nhere into ``utils.py``.\n\nInstallation (Python)\n=====================\n\nThe Job utilities are published on `PyPI`_ and can be installed from\nthere::\n\n pip install im-data-manager-job-utilities\n\nOnce installed you can use the available classes::\n\n >>> from dm_job_utilities.dm_log import DmLog\n >>> DmLog.emit_event('Hello World!')\n 2022-02-03T16:39:27+00:00 # INFO -EVENT- Hello World!\n >>> from decimal import Decimal\n >>> DmLog.emit_cost(Decimal('5.7'))\n 2022-02-03T16:40:16+00:00 # INFO -COST- 5.7 1\n\n\nCosts are *total* by default but can be issued as an incremental value::\n\n >>> DmLog.emit_cost(Decimal('0.5'), incremental=True)\n 2022-02-03T16:40:16+00:00 # INFO -COST- +0.5 2\n\n\nThe final value on each cost line is a unique sequence number. This value\nis typically an integer that increments with each line. It is required and\nis used by the Data Manager to avoid duplicating costs.\n\nThe Data Manager uses the `python-dateutil`_ package to parse\ndates and times from the generated log lines. The package is extremely\ntolerant of many formats but if you are in control of the\nstring, the preferred format would be to use a classic UTC ISO string like\n``%Y-%m-%dT%H:%M:%S%z`` so that the date and time is written as::\n\n 2022-03-20T10:49:41+00:00\n\n.. _PyPI: https://pypi.org/project/im-data-manager-job-utilities\n.. _python-dateutil: https://pypi.org/project/python-dateutil\n\nGet in touch\n============\n\n- Report bugs, suggest features or view the source code `on GitHub`_.\n\n.. _on GitHub: https://github.com/informaticsmatters/squonk2-data-manager-job-utilities\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Job execution utilities",
"version": "1.2.0",
"project_urls": {
"Homepage": "https://github.com/informaticsmatters/squonk2-data-manager-job-utilities"
},
"split_keywords": [
"logging"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d642d711358ccad57b27392fb5275545ee2935d3a1d27e8d2aa36b91650d54b8",
"md5": "0f16d12d4533140f5c5cb27b0e556cfa",
"sha256": "c319b2932866c8f7466214766183dc0f9034499c02641bf5a7343e67ba82bb13"
},
"downloads": -1,
"filename": "im_data_manager_job_utilities-1.2.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "0f16d12d4533140f5c5cb27b0e556cfa",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 7584,
"upload_time": "2024-03-20T12:44:37",
"upload_time_iso_8601": "2024-03-20T12:44:37.348343Z",
"url": "https://files.pythonhosted.org/packages/d6/42/d711358ccad57b27392fb5275545ee2935d3a1d27e8d2aa36b91650d54b8/im_data_manager_job_utilities-1.2.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-20 12:44:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "informaticsmatters",
"github_project": "squonk2-data-manager-job-utilities",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "pytz",
"specs": [
[
"==",
"2024.1"
]
]
},
{
"name": "six",
"specs": [
[
"==",
"1.16.0"
]
]
},
{
"name": "wrapt",
"specs": [
[
"==",
"1.16.0"
]
]
}
],
"lcname": "im-data-manager-job-utilities"
}