Job execution utilities
Project description
Informatics Matters Data Manager Job Utilities
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
Disabling logging
You can disable the event and cost logging by defining the following environment variables (any value will do, the presence of the variable is enough to disable the corresponding facility):
DMLOG_EVENT_DISABLE DMLOG_COST_DISABLE
Get in touch
Report bugs, suggest features or view the source code on GitHub.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file im_data_manager_job_utilities-1.3.0-py2.py3-none-any.whl.
File metadata
- Download URL: im_data_manager_job_utilities-1.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ace3c01f66d18bda5b710958c5820592114586a91aceb0de1557fd23c4a98161
|
|
| MD5 |
ea990307c2bd737cff24ff37cd12273c
|
|
| BLAKE2b-256 |
0455c2030b48dbc2184c15ffc706993f2208274b6d7dc10e7e93382389420db2
|
Provenance
The following attestation bundles were made for im_data_manager_job_utilities-1.3.0-py2.py3-none-any.whl:
Publisher:
publish.yaml on InformaticsMatters/squonk2-data-manager-job-utilities
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
im_data_manager_job_utilities-1.3.0-py2.py3-none-any.whl -
Subject digest:
ace3c01f66d18bda5b710958c5820592114586a91aceb0de1557fd23c4a98161 - Sigstore transparency entry: 1066317414
- Sigstore integration time:
-
Permalink:
InformaticsMatters/squonk2-data-manager-job-utilities@417e0c736082adb381a312724802004cf767ba39 -
Branch / Tag:
refs/tags/1.3.0 - Owner: https://github.com/InformaticsMatters
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@417e0c736082adb381a312724802004cf767ba39 -
Trigger Event:
push
-
Statement type: