progress-updater
Writing the progress of a task to a backend!
Installation
Install it using pip
pip install progress-updater
Basic usage
from progress_updater import ProgressUpdater
from progress_updater.backends.mongo import MongoSettings
settings = MongoSettings(
mongo_connection="mongodb://user:pass@mongo:27017",
mongo_db="db",
mongo_collection="logs",
)
updater = ProgressUpdater(task_name="My Task", settings=settings)
with updater(block_name="First part"):
# doing things
updater.notify("doing first block...")
# doing more things
with updater(block_name="Second part"):
# doing things
updater.notify("doing second block...")
# doing more things
updater.raise_latest_exception() # if exists
The output is:
- Task: My task
- Entering First part
doing first block...
Time spent: 0h0m
Successfully completed
- Entering Second part
doing second block...
Time spent: 0h0m
Successfully completed
Backends
The available backends to store logs are Mongo, Redis and SQL. Please read the docs for further information.
Setting your backend with environment variables
You can set your backend by defining env vars.
The PU__ prefix indicates that it belongs to ProgressUpdater.
# SQL
PU__SQL_DSN='postgresql+psycopg2://user:pass@postgres:5432/db'
PU__SQL_TABLE='logs'
...
# Redis
PU__REDIS_HOST='redis'
PU__REDIS_DB='1'
PU__REDIS_PASSWORD='pass'
...
# Mongo
PU__MONGO_CONNECTION='mongodb://user:pass@mongo:27017'
PU__MONGO_DB='db'
PU__MONGO_COLLECTION='logs'
...
And then when creating a ProgressUpdater object, the backend will be
automatically configured.
from progress_updater import ProgressUpdater
with ProgressUpdater(task_name="My Task") as updater:
pass
Documentation
Please visit this link for documentation.
Metadata
Release files for progress-updater 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| progress_updater-0.1.9.tar.gz | 9.1 kB | Without provenance | Details for progress_updater-0.1.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| progress_updater-0.1.9-py3-none-any.whl | Python 3 | none | any | Details for progress_updater-0.1.9-py3-none-any.whl |
Total release size: 21.4 kB
Release files / progress_updater-0.1.9.tar.gz
| Download URL | progress_updater-0.1.9.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bea3bb989e078defc07085b0d9920d1fbcbf8d53a6904071dbb0db335162fb84
|
|
BLAKE2b-256 checksum How to use checksums |
33059b46925c3e7f76885edcadfe285c8a007bcc1fcd17c3f686d4ee7dc4cb53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.10.2 Linux/5.10.104-linuxkit
|
Release files / progress_updater-0.1.9-py3-none-any.whl
| Download URL | progress_updater-0.1.9-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ee5bdcd4703df0061371f944de80fdf38fc33484aa9087240b689ca7ef910895
|
|
BLAKE2b-256 checksum How to use checksums |
b824a7385236bb47608cb21954a8515cbd83be8a4c421e15ead014f5951ef889
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.10.2 Linux/5.10.104-linuxkit
|
Security for progress-updater 0.1.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.