Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c7f3342
docs: add Procrastinate integration design spec
snopoke May 25, 2026
bb91a4b
docs: add Procrastinate integration implementation plan
snopoke May 25, 2026
96f857e
feat(procrastinate): add optional dependency and module skeletons
snopoke May 25, 2026
9321ed4
feat(procrastinate): worker-side task wrapper with sync/async support
snopoke May 25, 2026
ad65f65
feat(procrastinate): defer-time task creation with id injection
snopoke May 25, 2026
06a8176
fix(procrastinate): invalidate cache after update; clarify defer wrap…
snopoke May 25, 2026
8a1b778
feat(procrastinate): @track decorator with bare and parameterized forms
snopoke May 25, 2026
bc60bc1
feat(procrastinate): current_task() accessor via ContextVar
snopoke May 25, 2026
c85f9aa
feat(procrastinate): record_task_args stores defer kwargs in task data
snopoke May 25, 2026
c0c9f1a
feat(procrastinate): verify pass_context=True works with task wrapper
snopoke May 25, 2026
1a206ba
feat(procrastinate): ProcrastinateSystemIntegration with auto-track
snopoke May 25, 2026
c408b7a
feat(procrastinate): auto-wrap tasks registered after system init
snopoke May 25, 2026
6f1f356
test(procrastinate): integration tests against real Postgres
snopoke May 25, 2026
3ebacc2
docs(procrastinate): add Procrastinate section to README
snopoke May 25, 2026
aed4969
fix(procrastinate): skip built-in tasks; document known limitations
snopoke May 25, 2026
024cc9c
refactor: extract shared helpers between celery and procrastinate
snopoke May 26, 2026
a8fe0fa
refactor: drop get_task_fn parameter from shared safe_get_task
snopoke May 26, 2026
2c52537
refactor: share task cache instance between celery and procrastinate
snopoke May 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,60 @@ taskbadger.init(
$ export TASKBADGER_API_KEY=***
$ taskbadger run "nightly-backup" -- ./backup.sh
```

### Procrastinate Integration

The SDK includes optional support for the [Procrastinate](https://procrastinate.readthedocs.io/) task queue.

Install with the extra:

```bash
pip install 'taskbadger[procrastinate]'
```

Opt a single task into tracking with the `track` decorator:

```python
import procrastinate
from taskbadger.procrastinate import track, current_task

app = procrastinate.App(connector=...)

@track
@app.task(queue="default")
async def add(a, b):
return a + b

@track(name="report", value_max=100, tags={"env": "prod"})
@app.task
async def report(rows):
tb = current_task()
for i, row in enumerate(rows):
await process(row)
if i % 10 == 0:
tb.update(value=i)
```

To auto-track every task on an App, register the system integration:

```python
import taskbadger
from taskbadger.systems.procrastinate import ProcrastinateSystemIntegration

taskbadger.init(
token="***",
systems=[ProcrastinateSystemIntegration(
app=app,
auto_track_tasks=True,
includes=[r"myapp\..*"],
excludes=[r"myapp\.cleanup\..*"],
record_task_args=True,
)],
)
```

#### Known limitations

- **`task.configure(...).defer(...)` is not tracked.** Procrastinate's `configure()` returns a separate `JobDeferrer` whose methods bypass our wrapper. Use `task.defer(...)` directly for tracked deferrals. Tasks deferred via `configure().defer()` will run normally but will not appear in TaskBadger.
- **`task.batch_defer*` is not tracked.** Same reason as `configure().defer()`.
- **Tasks added via `app.add_tasks_from(blueprint)` after `ProcrastinateSystemIntegration` is constructed are not auto-instrumented.** Construct the integration after all blueprints are registered, or apply `@track` to those tasks explicitly.
Loading