z4j-hueyperiodic
The native Huey periodic adapter for z4j, with dashboard management
of periodic schedules. Dashboard management needs the z4j server, z4j-core, z4j-bare
and this adapter from the same release, plus the producer setup below.
Compatibility
Huey 2.4+ (Huey 2 and 3); Python 3.11+.
Installation and producer setup
Install z4j-hueyperiodic and z4j-bare from the same release wave, plus the native
scheduler and broker/store dependencies used by your application. The example
assumes your task code, writable application-state directory and agent credentials
already exist. Use the project UUID from agent registration.
import os
from myapp.tasks import huey # Import all decorated tasks first; use utc=True.
from z4j_bare import NativeScheduleControl, install_agent
from z4j_hueyperiodic import HueyPeriodicAdapter
adapter = HueyPeriodicAdapter(
huey=huey,
control=NativeScheduleControl("/var/lib/myapp/huey-schedules.sqlite3"),
)
agent = install_agent(
engines=[], schedulers=[adapter],
brain_url=os.environ["Z4J_BRAIN_URL"], token=os.environ["Z4J_TOKEN"],
hmac_secret=os.environ["Z4J_HMAC_SECRET"], project_id=os.environ["Z4J_PROJECT_ID"],
)
try:
huey.create_consumer(periodic=True).run()
finally:
agent.stop()
Construct the adapter in the actual periodic consumer process, before starting
that consumer. An agent in a separate web process cannot change the consumer's
in-memory registry. Without control, discovery and manual runs remain available
but dashboard definition changes are disabled.
Dashboard controls
The connected producer supports inventory, create, edit, pause, resume, delete and Run now. A write is complete only after z4j accepts a snapshot confirming the native source. The dashboard uses the current connection's advertised capabilities; an unavailable producer cannot accept new edits. Repeating an operation ID does not submit it twice. A timeout or uncertain outcome requires inspection before submitting a new request.
A pause prevents future scheduling. Work already queued or running can finish. Run now submits an additional execution without resuming a paused schedule. Native scheduling keeps the upstream scheduler's timing and delivery semantics; it does not acquire z4j-scheduler's catch-up, overlap or exactly-once guarantees. Queue task history requires the corresponding engine adapter in the workers.
Code definitions and durable overrides
NativeScheduleControl stores dashboard changes in a private SQLite file in
the producer's application state directory. Keep that file on a durable local
volume, back it up with the application, and reuse the same path after restart.
Use a separate file for each application and scheduler owner. Do not put it on
an ephemeral container filesystem or a network filesystem.
Code supplies the initial definitions. Each saved change overrides the fields it submits: pause and resume submit only the enabled flag, while the dashboard edit form submits every editable field (task, schedule type, expression, timezone, queue, arguments and enabled flag), so later code changes to those fields stay hidden. Removing a code definition removes its projection; reintroducing the same source identity restores any saved override. Deletion is a durable tombstone, so restarting the application does not recreate it. Dashboard-created schedules survive with the same file. No Python files are rewritten. New schedules can invoke only tasks already registered in the host application; deploying new task code remains an application operation.
The producer reads committed controls locally and keeps scheduling during a z4j server outage. If that local state cannot be read or validated, periodic dispatch is withheld and the error is logged. Normal task processing continues. Install control before starting periodic dispatch. Keep one periodic producer per application, as required by its native scheduler. There is currently no separate dashboard action to remove an override and restore the code default.
Supported definitions and limits
- Supported definitions use Huey's
crontab(...)validator, with five numeric cron fields, UTC and the application's configured Huey queue. - Custom Python datetime predicates are not serializable cron definitions; managed startup rejects them before replacing the producer hook.
- Registered ordinary Huey tasks can also receive dashboard-created periodic schedules.
- Cron uses Huey's weekday convention, Sunday=0 or 7. Periodic dispatch is minute-granular.
Links
- Documentation
- Changelog
- Security policy; report vulnerabilities to security@z4j.com
- Apache-2.0 license
Metadata
Release files for z4j-hueyperiodic 1.13.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 | |
|---|---|---|---|
| z4j_hueyperiodic-1.13.0.tar.gz | 18.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| z4j_hueyperiodic-1.13.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.0 kB
Release files / z4j_hueyperiodic-1.13.0.tar.gz
| Download URL | z4j_hueyperiodic-1.13.0.tar.gz |
|---|---|
| Size | 18.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
202ff563695277d787efcc449911e3bc418979270600f050fec3ba9a8680d087
|
|
BLAKE2b-256 checksum How to use checksums |
2b5b7b0e81800344cea6f91b77f8015e43367712734ccb973eee1a7d43331c21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / z4j_hueyperiodic-1.13.0-py3-none-any.whl
| Download URL | z4j_hueyperiodic-1.13.0-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42ce7a2325fcc9286e5e15cb4b0baf1a89ea99b3933262e07ba4a1aa62972466
|
|
BLAKE2b-256 checksum How to use checksums |
8fe8d33b1762bef3d3047d71b2b7488464d37fdc09e51261c02b74dd570bab78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|