Minimal job monitor for multi-threaded Python applications
Project description
Description
minjob is a simple, purely Python library which allows to monitor Python threads and processes. It restarts the processes it monitors when a fatal exception occurs and can smoothly terminate them.
This small library provides a simple way for dealing with fatal exceptions when running simple multi-thread/multi-process applications with high availability requirements such as market trading bots.
By default the library will print the logs of the failed jobs at
{HOME}/.minjob.log
.
Installation and Usage
Install the library within your favorite virtual environment or locally using:
pip install minjob
A simple usage of the library for adding a monitored process and thread goes like this:
from minjob.jobs import JobManager
def my_thread_func():
do_some_work()
def my_process_func():
do_other_work()
manager = JobManager(name="MyManager")
manager.add_process("MyProcess", target=my_process_func, daemonize=True)
manager.add_thread("MyThread", target=my_thread_func, daemonize=True)
# start all monitored jobs
manager.start_all()
# stop all jobs
manager.stop_all()
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 Distribution
Built Distribution
File details
Details for the file minjob-0.1.0.tar.gz
.
File metadata
- Download URL: minjob-0.1.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d9eef95e94ee7ca709e3719fd9ab7e83bae894cb8a2aa97298b3db3504d98ad |
|
MD5 | bf8295f108d3bb651bd0f44b23e066fc |
|
BLAKE2b-256 | 4231a68bc0dc6a334e0a978b4cdbf0bb7568f650595feac6c48c8584971f1ed2 |
File details
Details for the file minjob-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: minjob-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 726259f59746cb4ac3d97b2870764030d8760fc69f0bc8da47895997a6bf4e35 |
|
MD5 | eb4689d31db6ee0bd38a607437ddf6f3 |
|
BLAKE2b-256 | 1163dce0c5eb8648e5848eec365cc6db1ac18c6bc56c74449931453d65a1537a |