Skip to main content

Generic, payload-agnostic, multipod-safe scheduled-jobs core -- cross-pod-locked tick engine, reschedule math, store protocols, and a default kind+payload store

Project description

3tears-scheduled-jobs

A generic, payload-agnostic, multipod-safe scheduled-jobs core. Every agent/skill/webhook/conversation-specific concept is stripped out, leaving only the scheduling machinery.

What it gives you:

  • scheduled_tick_job(...) -- one cross-pod-locked tick pump. Acquire the nats_distributed_lock at a caller-supplied key; on LockHeld skip silently; on KvError degrade open (the per-row optimistic-CAS is the real guard); enumerate due rows; per-row CAS-claim + reschedule; invoke an injected dispatch callback; drift / missed-fire accounting; per-row failure isolation. Takes the store(s), the dispatch callback, and the NATS client as parameters, with no domain knowledge.
  • compute_next_fire_at(...) -- the pure reschedule math for every schedule type (daily_at, every_n_hours, random_within_window, one_shot_at, cron, relative_delay, interval) and both missed-fire policies (coalesce, catch_up). The cron branch imports APScheduler lazily, so non-cron consumers pay nothing.
  • ScheduleStore / FireStore Protocols -- the exact surface the tick engine calls. The engine depends only on these, so a typed consumer collection can implement them.
  • A default store -- ScheduledJobEntity / JobFireEntity + collections + scheduled_jobs / job_fires table factories + a v001 migration, keyed on an opaque kind (TEXT) + payload (JSONB). A simple consumer can use it as-is with no table of its own.
  • Generic config / events / metrics -- a JobConfig protocol, the tick / fire / drift event-name constants, and cardinality-bounded Prometheus instruments.

The engine is pure-async, one tick per call with no internal polling. Drive cadence with whatever scheduler you like (an APScheduler IntervalTrigger, a while True: await asyncio.sleep(...), and so on). The engine does not own the scheduler.

Project details


Download files

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

Source Distribution

3tears_scheduled_jobs-0.19.1.tar.gz (52.2 kB view details)

Uploaded Source

Built Distribution

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

3tears_scheduled_jobs-0.19.1-py3-none-any.whl (45.0 kB view details)

Uploaded Python 3

File details

Details for the file 3tears_scheduled_jobs-0.19.1.tar.gz.

File metadata

  • Download URL: 3tears_scheduled_jobs-0.19.1.tar.gz
  • Upload date:
  • Size: 52.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for 3tears_scheduled_jobs-0.19.1.tar.gz
Algorithm Hash digest
SHA256 5c6970e4a9a4ec164acd476ff19446f9bbb08baf3175fe46c5202b9844bc7110
MD5 9397572c813fcc9ac1b51c208ca3afb8
BLAKE2b-256 5e9267b83667b580e4cd63b5bcb7ea72ed64877bc6136295d71416166cb36b35

See more details on using hashes here.

Provenance

The following attestation bundles were made for 3tears_scheduled_jobs-0.19.1.tar.gz:

Publisher: release.yml on pacepace/3tears

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file 3tears_scheduled_jobs-0.19.1-py3-none-any.whl.

File metadata

File hashes

Hashes for 3tears_scheduled_jobs-0.19.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a1d6b9eaab9e0b7d0fb458d4893cfbbcfd58e8a08b6ad61b62364edb72ef6a27
MD5 bd78d4df8fc1ff85514bd6c35c8d6425
BLAKE2b-256 eb0d8f55a0c09601e007b17cfd1a2baa4ed93bb5df6fa7ec1761b9e4626c9e34

See more details on using hashes here.

Provenance

The following attestation bundles were made for 3tears_scheduled_jobs-0.19.1-py3-none-any.whl:

Publisher: release.yml on pacepace/3tears

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page