scheduleplus
A scheduler built on cron syntax with workday/holiday check feature
| Atributes | Allowed values | Allowed special characters | Required |
|---|---|---|---|
| Minutes | 0-59 | * , - / | Yes |
| Hours | 0-23 | * , - / | Yes |
| Days | 1-31 | * , - / L | Yes |
| Months | 1-12, JAN-DEC | * , - / | Yes |
| Weekdays | 0-6, MON-SUN | * , - / F L | Yes |
| Holiday(* | 0, 1 | * | No |
Holiday*
0 = checking if workday, 1 = checking if holiday, * = any day
Installation
pip install scheduleplus
Usage
Running a function on schedule
This runs the function every 5 minutes.
from scheduleplus.schedule import Scheduler
def work(data):
print(f"Working {data}...")
schedule = Scheduler()
schedule.cron("*/5 * * * *").do_function(work, "test")
while True:
schedule.run_function_jobs()
time.sleep(1)
Running a callback
This runs the callback with a dictonary every 5 minutes.
from scheduleplus.schedule import Scheduler
def work(data):
print(f"Working {data}...")
schedule = Scheduler()
schedule.cron("*/5 * * * *").do_callback({"message": "cool"})
while True:
schedule.run_callback_jobs(work)
time.sleep(1)
List jobs
schedule = Scheduler()
schedule.cron("*/5 * * * *").do_function(work, "test")
schedule.cron("1 1 1 1 1").do_callback({"message": "cool"})
schedule.list_jobs()
Result
Job id Cron Next run time Time left Function Callback message
-------- ------------- --------------------- --------------------- --------------- ---------------------
1 */5 * * * * 2022-11-04 13:50:00 0:00:29 work('test')
2 1 1 1 1 1 2030-01-01 01:01:00 2614 days, 11:11:29 {'message': 'cool'}
Metadata
Release files for scheduleplus 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| scheduleplus-0.1.2.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scheduleplus-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.6 kB
Release files / scheduleplus-0.1.2.tar.gz
| Download URL | scheduleplus-0.1.2.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a4a14462b61533bd35f159c97646c9a21ae381762ebc07f8aefdada8acb8ac3
|
|
BLAKE2b-256 checksum How to use checksums |
62f297099d2bc256c3a90a827337d33446c83b5e5f15537253847cb6204d7dcb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Release files / scheduleplus-0.1.2-py3-none-any.whl
| Download URL | scheduleplus-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8746639b6329d5279feacf9b8a2fdd4be4b93d86fdb1c55946ac06d413291fb3
|
|
BLAKE2b-256 checksum How to use checksums |
e63212baf7edcffe51ec9d2ac9f56d8a8891e110d3d6c6572443cf77086441c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|