arq-cron
Requires arq 0.26+, Python 3.11+. See the compatibility matrix for the full pin string.
Install
Section titled “Install”pip install z4j-arqcronWhy read-only
Section titled “Why read-only”arq's cron jobs are declared in WorkerSettings.cron_jobs:
from arq.cron import cron
async def weekly_roundup(ctx): ...
class WorkerSettings: cron_jobs = [cron(weekly_roundup, weekday="mon", hour=9)]This is code. To add a cron job, you deploy new code. You construct ArqCronAdapter(cron_jobs=WorkerSettings.cron_jobs, project_id=...) with the same iterable the worker uses, and z4j lists that copy; it cannot add new ones at runtime.
What's shown
Section titled “What's shown”- The job's
name(falling back to the coroutine's__name__), used as both the schedule name and the task name. - A five-field cron expression rebuilt from the job's minute, hour, day, month and weekday constraints. A
secondconstraint is not shown, the timezone always reads UTC, and every job reads as enabled.
Caveats
Section titled “Caveats”- Changes to
cron_jobsrequire a worker restart; z4j re-syncs on next connect. - arq doesn't expose a runtime pause. If you need pause, wrap your function body in a feature-flag check.
Migrating to z4j-scheduler
Section titled “Migrating to z4j-scheduler”If you move scheduling to z4j-scheduler,
z4j-scheduler import --from arq --arq-settings pkg.worker:WorkerSettings --project <slug>
reads cron_jobs from the same class the worker runs, and
z4j-scheduler export --to arq renders the entries back as a Python module you
review and apply.
Paired with
Section titled “Paired with”arq.