Progress Updater
Project description
progress-updater
Writing the progress of a task to a backend!
Installation
Install it using pip
pip install progress-progress_updater
Basic usage
from progress_updater import ProgressUpdater
# create an progress_updater object
updater = ProgressUpdater(task_name="My Task")
with updater(block_name="First part") as updater:
# 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()
Backends
There are three backends available to save our logs.
- Mongo. See documentation.
- Redis. See documentation.
- SQL. See documentation.
Settings
There are some possible ways to pass settings to the updater. This is the priority.
- Passing settings as parameters when creating a
ProgressUpdater
object.
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",
)
with ProgressUpdater(task_name="My Task", settings=settings) as updater:
...
- Environment variables.
The
PU__
prefix indicates that it belongs toProgressUpdater
.
export PU__SQL_DSN=postgresql+psycopg2://user:pass@postgres:5432/db
export PU__SQL_TABLE=logs
Documentation
Please visit this link for documentation.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
progress_updater-0.1.2.tar.gz
(7.7 kB
view hashes)
Built Distribution
Close
Hashes for progress_updater-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51b1ad08648ff8a97dc846752a9fe47cb04328f521a6934aeda15884c177de86 |
|
MD5 | a46fda5bfed85210dc33ccce6aa004fc |
|
BLAKE2b-256 | e30e73f2a021340016a68a84a536baef86e67c663f85927774bcd76830e098e2 |