Add Procrastinate integration#46
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… docs Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- ProcrastinateSystemIntegration.track_task now refuses task names starting with "builtin:" or "procrastinate." so Procrastinate's own housekeeping jobs aren't auto-tracked. - README documents three known limitations: configure().defer(), batch_defer*, and post-init add_tasks_from. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds first-class TaskBadger tracking for the Procrastinate task queue, paralleling the existing Celery integration.
Public API:
taskbadger.procrastinate.track— per-task decorator (bare or parameterized:@track(name=..., value_max=..., tags=..., data=..., record_task_args=...)).taskbadger.procrastinate.current_task()— ContextVar-backed accessor for the running TB task.taskbadger.systems.procrastinate.ProcrastinateSystemIntegration— auto-track all tasks on an App, withincludes/excludesregex filters.Lifecycle:
task.defer(...)/task.defer_async(...)is called. The TB task id is smuggled through Procrastinate'stask_kwargsunder a reserved key (__taskbadger_task_id__).Other notes:
inspect.iscoroutinefunctiondispatch).pass_context=Trueworks transparently — the wrapper uses*args/**kwargsso the context is forwarded unchanged.procrastinate >= 3.0is opt-in via the newtaskbadger[procrastinate]extra; the top-leveltaskbadgerpackage never imports Procrastinate.tests/test_procrastinate.py, 13 intests/test_procrastinate_system_integration.py, 2 real-Postgres integration tests inintegration_tests/test_procrastinate.py(gated byPROCRASTINATE_DSN+TASKBADGER_*env vars).Known limitations (documented in README, candidates for follow-up)
task.configure(...).defer(...)is not tracked — Procrastinate'sconfigure()returns a separateJobDeferrerthat bypasses our wrapper.task.batch_defer*is not tracked — same reason.app.add_tasks_from(blueprint)after the system integration is constructed are not auto-instrumented; construct the integration after blueprint registration or apply@trackto those tasks explicitly.builtin:/procrastinate.*) are explicitly skipped bytrack_task.Design + plan
docs/superpowers/specs/2026-05-25-procrastinate-integration-design.mddocs/superpowers/plans/2026-05-25-procrastinate-integration.mdTest plan
PROCRASTINATE_DSNandTASKBADGER_*env vars, thenuv run pytest integration_tests/test_procrastinate.py -vs)🤖 Generated with Claude Code