Jobify¶
Jobify is a powerful asynchronous job scheduling and management framework for Python. It allows you to define and schedule background jobs with an intuitive decorator-based API, similar to modern web frameworks like FastAPI.
Key Features¶
- Async First: Built on top of
asyncio. - Flexible Scheduling: Run jobs immediately, after a delay, at a specific time, or via Cron expressions.
- Persistence: Built-in SQLite storage ensures scheduled jobs survive application restarts.
- Modular: Organize tasks using
JobRouters (similar to FastAPI routers). - Resilient: Middleware support for automatic retries, timeouts, and error handling.
- Concurrency: Support for
asyncio,ThreadPoolExecutor, andProcessPoolExecutor.
Comparison¶
You might have seen other libraries like APScheduler, Celery, or Taskiq.
Below is a comparison of features to help you decide if Jobify fits your needs.
| Feature name | Jobify | Taskiq | APScheduler (v3) | Celery |
|---|---|---|---|---|
| Event-driven Scheduling | ✅ (Low-level timer) | ❌ (Polling/Loop) | ❌ (Interval) | ❌ (Polling/Loop) |
| Async Native (asyncio) | ✅ | ✅ | ❌ (Sync mostly) | ❌ |
| Context Injection | ✅ | ✅ | ❌ | ❌ |
| FastAPI-style Routing | ✅ | ❌ | ❌ | ❌ |
| Middleware Support | ✅ | ✅ | ❌ (Events only) | ❌ (Signals) |
| Job Cancellation | ✅ | ❌ | ✅ | ✅ |
| Cron Scheduling | ✅ | ✅ | ✅ | ✅ |
| Misfire Policy | ✅ | ❌ | ✅ | ❌ |
| Run Modes (Thread/Process) | ✅ | ✅ | ✅ | ✅ |
| Rich Typing Support | ✅ | ✅ | ❌ | ❌ |
| Zero-config Persistence | ✅ (SQLite default) | ❌ (Needs Broker) | ✅ | ❌ (Needs Broker) |
| Broker-backend execution | ❌ (soon) | ✅ | ❌ | ✅ |
Why Jobify?¶
Unlike many other frameworks that use a while True loop to continuously check the current time against scheduled tasks (polling), Jobify uses the low-level asyncio.loop.call_at API.
- Efficiency: The scheduler does not consume CPU cycles if there are no tasks to process.
- Precision: Tasks are triggered precisely by the internal timer of the event loop, ensuring sub-millisecond accuracy and avoiding the "jitter" that can be associated with sleep intervals.
- Native: It works in harmony with OS-level event notification systems (epoll/kqueue).
Quick Start¶
Installation¶
Basic Usage¶
Here is a simple example showing how to define a task and schedule it.