Tracking batch processing tasks and logs on a cluster
Project description
ELOGS
Streamlined batch processing jobs.
Elogs wraps batch jobs tasks, intercepting errors and logging them to S3 preventing the job to fail.
Usage
import os
from pathlib import Path
from elogs import Elogs, ElogsTask
# load credentials as env vars
aws_env = Path.home() / 'Private/configs/aws.env'
load_dotenv(aws_env)
app_id = "userx_test_app"
elogs = Elogs(app_id=app_id)
@elogs
def process(x, y):
return x + y
# decorating a function with an elogs instance transforms it in a function
# that will accept 1 single argument, which should be a ElogsTask, containing
# the task_id and original args/kwargs
tasks = [ElogsTask(f"{x}-{y}-{z}", x, y)
for x in range(5)
for y in range(5)]
# to track the app progress in the dashboard use the context
with elogs.start(tasks) as filtered_tasks: # removes done tasks
for task in filtered_tasks:
_ = process(task)
Dashboard
Once installed the elogs package, you can run the monitoring dashboard with:
elogs-dashboard
this supports optional arguments --aws-env /path/to/aws.env and -p/--port 18080
to specify credentials and custom port number (defaults to 18080)
If credentials are not specified they will be searched in the env vars and if not present an error will be raised.
To automatically start the dashboard as system service to run constantly in background, you can follow this example:
Create the file /etc/systemd/system/elogs-dashboard.service (adapt for your user and environment)
[Unit]
Description=Elogs Dashboard Service
After=network.target
[Service]
ExecStart=/home/dzanaga/miniconda3/envs/eo/bin/elogs-dashboard --aws-env /home/dzanaga/Private/configs/aws.env
Restart=always
Environment="PATH=/home/dzanaga/miniconda3/envs/eo/bin:/home/dzanaga/miniconda3/condabin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/lib/maven/bin:/opt/puppetlabs/bin:/usr/local/bin:/home/dzanaga/.local/bin/go/bin:/home/dzanaga/.local/share/coursier/bin:/usr/local/sbin:/usr/sbin:/usr/lib/maven/bin:/usr/lib/maven/bin:/usr/local/bin:/home/dzanaga/.local/bin/go/bin:/home/dzanaga/.local/share/coursier/bin:/home/dzanaga/.local/bin:/home/dzanaga/bin"
[Install]
WantedBy=multi-user.target
and then run:
sudo systemctl daemon-reload
sudo systemctl start elogs-dashboard
sudo systemctl enable elogs-dashboard
to check the dashboard server status:
sudo systemctl status elogs-dashboard
Project details
Release history Release notifications | RSS feed
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 elogs-0.3.0-py3-none-any.whl.
File metadata
- Download URL: elogs-0.3.0-py3-none-any.whl
- Upload date:
- Size: 2.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cea9ab21fc2073c2742da911d3ccff5cf5d0295a30a20f99cf90e8c4f5b363c
|
|
| MD5 |
3ed3ead3ccf02663dfa5a34652f92914
|
|
| BLAKE2b-256 |
e94358966da0d1ab30c929ea277bf5d8e22fd262374a6de5a0ada3a96b6bc17e
|