q0
Decorator-based cron job scheduling for Google Cloud Run + Cloud Scheduler.
Usage
# app.py
from q0 import Q0
app = Q0(
prefix="q0-demo-",
project_id="my-project",
project_number="123456789",
region="europe-west1",
)
@app.cron("*/5 * * * *")
def hello():
print("hello from cron job")
@app.cron("0 0 1 * *")
def monthly_cleanup():
print("monthly cleanup")
@app.cron("0 9 * * 1", timeout="3600s")
def weekly_report():
print("weekly report sent")
if __name__ == "__main__":
app.cli()
CLI
# run a job locally
python app.py run hello
# sync job definitions to Cloud Scheduler
python app.py sync
sync creates, updates, or deletes Cloud Scheduler jobs to match the decorated functions. Each job triggers the Cloud Run Job with a container override that calls run <func_name>. Tasks default to a 10-minute (600s) timeout; set timeout on an individual @app.cron decorator to override it.
Deployment
Deploy as a Cloud Run Job and sync schedules:
gcloud run jobs deploy q0-$(SERVICE_NAME) \
--image $(IMAGE_TAG) \
--region $(GCP_REGION) \
--project $(GCP_PROJECT_ID) \
--command python,-m,$(SERVICE_NAME).app
gcloud run jobs execute q0-$(SERVICE_NAME) \
--region $(GCP_REGION) \
--project $(GCP_PROJECT_ID) \
--args sync \
--wait
The --command is set on the job, not in the Dockerfile, so the same image can be shared with a web server or other Cloud Run services. Cloud Scheduler invokes individual functions via container arg overrides (run <func_name>).
Metadata
Release files for q0-jobs 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| q0_jobs-0.1.0.tar.gz | 158.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| q0_jobs-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 162.0 kB
Release files / q0_jobs-0.1.0.tar.gz
| Download URL | q0_jobs-0.1.0.tar.gz |
|---|---|
| Size | 158.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
18c0eed86e5ec5387b369f49c7e0cfe5ddecdde5f2a059a140de48bb3d271b78
|
|
BLAKE2b-256 checksum How to use checksums |
2222f822b26cafe985acb075287f70f189a7445ada5e8ea864b300d238116e8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.7
|
Release files / q0_jobs-0.1.0-py3-none-any.whl
| Download URL | q0_jobs-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9f68211b2964d093394f9b0f0a3eef9b151e428f96286a0ba7db1721ef6c203
|
|
BLAKE2b-256 checksum How to use checksums |
d78f6a1c90c2ed44fa05d2ed5cf779230d33fd1c7a5b89b4129a227ee93d5276
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.7
|