Skip to content

Commit 3ebacc2

Browse files
snopokeclaude
andcommitted
docs(procrastinate): add Procrastinate section to README
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6f1f356 commit 3ebacc2

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,54 @@ taskbadger.init(
4141
$ export TASKBADGER_API_KEY=***
4242
$ taskbadger run "nightly-backup" -- ./backup.sh
4343
```
44+
45+
### Procrastinate Integration
46+
47+
The SDK includes optional support for the [Procrastinate](https://procrastinate.readthedocs.io/) task queue.
48+
49+
Install with the extra:
50+
51+
```bash
52+
pip install 'taskbadger[procrastinate]'
53+
```
54+
55+
Opt a single task into tracking with the `track` decorator:
56+
57+
```python
58+
import procrastinate
59+
from taskbadger.procrastinate import track, current_task
60+
61+
app = procrastinate.App(connector=...)
62+
63+
@track
64+
@app.task(queue="default")
65+
async def add(a, b):
66+
return a + b
67+
68+
@track(name="report", value_max=100, tags={"env": "prod"})
69+
@app.task
70+
async def report(rows):
71+
tb = current_task()
72+
for i, row in enumerate(rows):
73+
await process(row)
74+
if i % 10 == 0:
75+
tb.update(value=i)
76+
```
77+
78+
To auto-track every task on an App, register the system integration:
79+
80+
```python
81+
import taskbadger
82+
from taskbadger.systems.procrastinate import ProcrastinateSystemIntegration
83+
84+
taskbadger.init(
85+
token="***",
86+
systems=[ProcrastinateSystemIntegration(
87+
app=app,
88+
auto_track_tasks=True,
89+
includes=[r"myapp\..*"],
90+
excludes=[r"myapp\.cleanup\..*"],
91+
record_task_args=True,
92+
)],
93+
)
94+
```

0 commit comments

Comments
 (0)