cron_lite
A very light library to run python functions like cron jobs do. (support cron expressions with timezone, decorator style, spawn running and graceful exit. Runs in python service like Apscheduler, no effect of system config)
Example
from cron_lite import cron_task, start_all, stop_all, set_time_zone
import time
set_time_zone("Asia/Shanghai")
@cron_task("* * * * * 0/2")
def event1():
print("event1", time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())))
time.sleep(3)
print("event1 done", time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())))
@cron_task("* * * * * 0/15")
def event2():
print("event2", time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())))
time.sleep(10)
print("event2 done", time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())))
th = start_all(spawn=True) # use bare `start_all()` to run forever as a service
print("start")
time.sleep(60)
print("stop")
stop_all(th)
print("done")
Metadata
Release files for cron-lite 1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cron-lite-1.1.tar.gz | 2.8 kB | Without provenance | Details for cron-lite-1.1.tar.gz |
Release files / cron-lite-1.1.tar.gz
| Download URL | cron-lite-1.1.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f3306c0e67ef96665770a4433b57bf85904eb4524d166d71691b724490954002
|
|
BLAKE2b-256 checksum How to use checksums |
dd884958fd7ed033d9be9d888fd127c3bbee5cce879b04e4765bd61947386754
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.6
|
Security for cron-lite 1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.