Skip to main content

z4j-taskiqscheduler

PyPI version Python License

The taskiq-scheduler adapter for z4j.

Surfaces taskiq-scheduler periodic jobs on the dashboard's Schedules page as list/read inventory. Delete is advertised only for a custom source that overrides taskiq's unsupported delete_schedule default.

Compatibility

  • TaskIQ 0.11+ and <1
  • Python 3.11+

Full per-adapter matrix at https://z4j.dev/reference/compatibility/.

What it ships

Capability Notes
List schedules jobs returned by the configured taskiq-scheduler source
Read by registered name
Delete advertised only when the configured source implements it; label-defined schedules require a code change and redeploy
Boot inventory full snapshot at agent connect; existing schedules show up without editing

taskiq-scheduler schedules are typically defined declaratively (label source, JSON file, or label decorators), so create / update are intentionally out of scope, those need a deploy round-trip. taskiq also has no enable/disable toggle or trigger-now primitive, so the dashboard hides those actions for this adapter.

Install

pip install z4j-taskiq z4j-taskiqscheduler
import asyncio
import logging
import os

from taskiq import TaskiqEvents, TaskiqScheduler
from taskiq.schedule_sources import LabelScheduleSource
from z4j_bare import install_agent
from z4j_taskiq import TaskiqEngineAdapter, attach_to_broker
from z4j_taskiqscheduler import TaskiqSchedulerAdapter

source = LabelScheduleSource(broker)
scheduler = TaskiqScheduler(broker=broker, sources=[source])
engine = TaskiqEngineAdapter(broker=broker)
attach_to_broker(broker, adapter=engine)
_z4j_installed = False
logger = logging.getLogger(__name__)


@broker.on_event(TaskiqEvents.CLIENT_STARTUP)
async def install_z4j_after_scheduler_sources(_state) -> None:
    global _z4j_installed
    if _z4j_installed:
        return
    owner_loop = asyncio.get_running_loop()
    try:
        scheduler_adapter = TaskiqSchedulerAdapter(
            source=source,
            source_loop=owner_loop,
        )
        install_agent(
            engines=[engine],
            schedulers=[scheduler_adapter],
            brain_url="https://brain.example.com",
            token="z4j_agent_...",
            project_id="my-project",
            hmac_secret=os.environ["Z4J_HMAC_SECRET"],
        )
    except Exception as exc:
        logger.error(
            "z4j TaskIQ scheduler install failed (%s)",
            type(exc).__name__,
        )
        return
    _z4j_installed = True

Run this module with TaskIQ's scheduler CLI. It starts each configured source before calling broker startup, so CLIENT_STARTUP installs z4j on the broker's real owner loop after this LabelScheduleSource is live. The guard makes a repeated callback reuse the same adapter and agent. The CLI owns broker startup and shutdown; do not call either lifecycle method from this module.

For a custom async schedule source, always pass that same verified loop as source_loop. z4j marshals get_schedules and supported delete_schedule calls to it once, without retrying an ambiguous delete. Only the exact stock LabelScheduleSource, whose read is an in-memory registry snapshot, supports an unbound direct read; custom sources fail closed until an owner is supplied.

Pairs with

Reliability

  • Inventory failures skip the snapshot rather than publishing an authoritative empty schedule set.
  • Custom source reads and deletes stay on their explicit owner event loop; cancellation is forwarded and z4j does not retry the operation.
  • The adapter does not rewrite schedule definitions. Delete is advertised and delegated only when a custom source overrides taskiq's failing default; the standard label source remains read-only.

Documentation

Full docs at z4j.dev/schedulers/taskiq-scheduler/.

License

Apache-2.0, see LICENSE.

Links

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

z4j_taskiqscheduler-1.9.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

z4j_taskiqscheduler-1.9.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file z4j_taskiqscheduler-1.9.0.tar.gz.

File metadata

  • Download URL: z4j_taskiqscheduler-1.9.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for z4j_taskiqscheduler-1.9.0.tar.gz
Algorithm Hash digest
SHA256 410efe875fb0feb1437d350619946d4821a2aca8279495c882d0d0d279d68118
MD5 fab66b53adb67e0f14e7f17397f0d07a
BLAKE2b-256 d3dd750ef673a8f26e92c4339093b90f7d2b9595a0b3ca1edd897f1bc542dfda

See more details on using hashes here.

File details

Details for the file z4j_taskiqscheduler-1.9.0-py3-none-any.whl.

File metadata

File hashes

Hashes for z4j_taskiqscheduler-1.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70d2db88504d7efe4fbc6fb884e17ecff23f259a0247d861d147e5d62e9c6ba5
MD5 56e63de747ed1675bfef293f40bf79cc
BLAKE2b-256 d3dafe1159a09f92ad0087754d7b4d8418f1a222a8a20887a2abeff95c4be35a

See more details on using hashes here.

Release history Release notifications | RSS feed

1.10.0

2 files

1.9.1

2 files

This release

1.9.0 This release

2 files

1.8.0

2 files

1.7.0

2 files

1.6.7

2 files

1.6.0

2 files

1.5.0

2 files

1.4.0

2 files

1.3.0

2 files

1.0.1

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page