Skip to main content

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); sweep abandoned in-flight fires per kind group; enumerate due rows of the routed kinds; per-row CAS-claim + reschedule; invoke the handler registered for that row's kind; drift / missed-fire accounting; per-row failure isolation. Takes the store(s), a DispatchRoutes table, and the NATS client as parameters, with no domain knowledge.
  • Per-kind routing, and an unrouted kind is inert. The pump's kind -> handler table is matched EXACTLY -- no wildcard, no default handler, no fall-through -- and it also scopes the due-row scan (a SQL predicate, not a Python filter) and the reaper sweep. A row whose kind has no handler is refused with an unrouted_kind failure metric and an ERROR event, and is deliberately not claimed, so the occurrence survives until its handler is registered. Silent misdelivery is the failure this prevents: a row absorbed by another kind's dispatcher does that dispatcher's work and records it as a success.
  • Per-kind reap thresholds. dispatch_reap_after_seconds_by_kind overrides DEFAULT_DISPATCH_REAP_AFTER_SECONDS per kind, so a kind whose work legitimately runs for hours is not reaped on the 15-minute baseline. Kinds sharing a threshold sweep in one query. Note the age is measured from dispatch start, not last activity, so the threshold alone only moves the false-reap cliff -- pair it with progress-conditioned renewal in the executor.
  • A distinct lock key per pump. JobConfig.tick_lock_key defaults to DEFAULT_TICK_LOCK_KEY; consumers running more than one pump in a process MUST vary it, or the pumps serialise against each other for no reason.
  • 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.

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.26.0.tar.gz (66.0 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.26.0-py3-none-any.whl (50.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for 3tears_scheduled_jobs-0.26.0.tar.gz
Algorithm Hash digest
SHA256 0591f435d9984b9262ee53de571b04aef7f9dd407bd1b9f83328b17d4d6fc030
MD5 a649a34d234c7412a559446d12dabfbd
BLAKE2b-256 b32630a73a6ec4f02055d688efcd993e9a29e2eb4646a31f1956eda34c3dd939

See more details on using hashes here.

Provenance

The following attestation bundles were made for 3tears_scheduled_jobs-0.26.0.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.26.0-py3-none-any.whl.

File metadata

File hashes

Hashes for 3tears_scheduled_jobs-0.26.0-py3-none-any.whl
Algorithm Hash digest
SHA256 88fe1fa6367de01952cbc996e740be74e56fa4d7ad2655066ae7d3755bab095d
MD5 c6d2d81265ec84d16f3aec8697326b41
BLAKE2b-256 7063eafcde686887dadcfd9e7b3c8d287620dbbc2613421086a169ed4526d1c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for 3tears_scheduled_jobs-0.26.0-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.

Release history Release notifications | RSS feed

0.41.4

2 files

0.41.3

2 files

0.41.2

2 files

0.41.1

2 files

0.41.0

2 files

0.40.0

2 files

0.39.0

2 files

0.38.0

2 files

0.37.0

2 files

0.36.0

2 files

0.35.1

2 files

0.35.0

2 files

0.34.0

2 files

0.33.0

2 files

0.32.1

2 files

0.32.0

2 files

0.31.0

2 files

0.30.1

2 files

0.30.0

2 files

0.29.0

2 files

0.28.0

2 files

0.27.0

2 files

0.26.1

2 files

This release

0.26.0 This release

2 files

0.25.0

2 files

0.24.7

2 files

0.24.6

2 files

0.24.5

2 files

0.24.4

2 files

0.24.3

2 files

0.24.2

2 files

0.24.1

2 files

0.24.0

2 files

0.23.11

2 files

0.23.10

2 files

0.23.9

2 files

0.23.8

2 files

0.23.7

2 files

0.23.6

2 files

0.23.5

2 files

0.23.3

2 files

0.23.2

2 files

0.23.1

2 files

0.23.0

2 files

0.22.5

2 files

0.22.4

2 files

0.22.3

2 files

0.22.2

2 files

0.22.1

2 files

0.22.0

2 files

0.21.0

2 files

0.20.0

2 files

0.19.4

2 files

0.19.3

2 files

0.19.2

2 files

0.19.1

2 files

0.19.0

2 files

0.18.0

2 files

0.17.9

2 files

0.17.8

2 files

0.17.7

2 files

0.17.6

2 files

0.17.5

2 files

0.17.4

2 files

0.17.3

2 files

0.17.2

2 files

0.17.1

2 files

0.17.0

2 files

0.16.1

2 files

0.16.0

2 files

0.15.0

2 files

0.14.1

2 files

0.14.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