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.14.0.tar.gz (47.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.14.0-py3-none-any.whl (41.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: 3tears_scheduled_jobs-0.14.0.tar.gz
  • Upload date:
  • Size: 47.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for 3tears_scheduled_jobs-0.14.0.tar.gz
Algorithm Hash digest
SHA256 5f7f8fa43a470e60b7480ca565ee836002ed0394d627173bc2d2118a2af45a9c
MD5 1caa3ba09eeeb4ddd156eb8bb8e34873
BLAKE2b-256 7f5cbcc90d07994bab9759c7a12aca6f8abe5b9830101edf22e1b7034a980e8d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: 3tears_scheduled_jobs-0.14.0-py3-none-any.whl
  • Upload date:
  • Size: 41.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for 3tears_scheduled_jobs-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9660f16ff10c318dda18702e61760549115a14095c50834ff4cbb412dd97a88
MD5 732bc180f79decf65a3b74bf069f40f7
BLAKE2b-256 2ceb9f58e9ecad21888dbd25301b4061b22d24c04606eaa8016a4da94a3d5c80

See more details on using hashes here.

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