A lightweight task scheduler
Project description
dmi-scheduler
A lightweight task scheduler in Python.
Installation
pip3 install dmi-scheduler
PostgreSQL is used to keep track of jobs. As such, you need to have a
PostgreSQL database that the scheduler can interact with. Database
tables will be created automatically if they don't exist yet. You can
pass the database connection parameters to the Scheduler()
constructor with the dbname
, dbhost
, dbuser
, dbpassword
and
dbport
keyword arguments.
Example
import time
from dmi_scheduler.scheduler import Scheduler
scheduler = Scheduler(config="scheduler.yml")
for i in range(0, 100):
scheduler.queue.add_job("log_number.py")
while scheduler.has_jobs():
time.sleep(1)
scheduler.end()
print("Done! Results can be found in the log file.")
log_number.py
:
from random import choice
from dmi_scheduler.worker import BasicWorker
class SomeWorker(BasicWorker):
max_workers = 3
def work(self):
self.log.info("Here is a random number: %i" % choice(range(0,1000)))
License
This scraper was developed by the Digital Methods Initiative, and is distributed under the MIT license. See LICENSE for details.
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 dmi-scheduler-0.6.0.tar.gz
.
File metadata
- Download URL: dmi-scheduler-0.6.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3340f1a23554bf526372ff50d796c74a8de896afca1faba2cb2588d0fd6c41b |
|
MD5 | d1cf9c97b71fe437e9141667b95cd7e7 |
|
BLAKE2b-256 | 26265d0b921b45efa37fcbf2819d21a28a3d2a212ddda8daae89574ca99fbb2a |
File details
Details for the file dmi_scheduler-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: dmi_scheduler-0.6.0-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98fb2d8482a14559a837a637bf0c54aeb151cc4b65aa8e70d842406a6a09b123 |
|
MD5 | 4bd94b672ef4e85f0a7a42676695b41a |
|
BLAKE2b-256 | 709cbff4f641ac4972eaf8313915d89b1fd83672a184861ad37eb2bc4c479b4d |