feat: Add task state query API for static and dynamic tasks#47
Merged
Conversation
Adds comprehensive query capabilities to inspect task state: - get_task(task, instance_name=None) for querying individual tasks - list_tasks(parent_task) for paginated listing of dynamic task instances - Supports both static and dynamic tasks with flexible API patterns - Implemented across all backends (PostgreSQL, MySQL, SQLite, DynamoDB, Redis) New Repository methods: - get_task_state() - query individual task state - list_task_states() - list dynamic task instances with pagination New model classes: - TaskState - snapshot of task state (task, scheduled_at, locked_until, locked_by) - ListTasksResponse - paginated results with continuation tokens Implementation highlights: - Redis uses optimized Lua script for listing with nested array returns - All backends handle static vs dynamic tasks via task_spec differentiation - Type-safe assertions ensure scheduled_at is never None for existing tasks - Comprehensive test coverage for all three usage patterns - Updated documentation with examples for static and dynamic tasks
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #47 +/- ##
==========================================
- Coverage 97.98% 97.25% -0.74%
==========================================
Files 26 26
Lines 3124 3495 +371
Branches 180 224 +44
==========================================
+ Hits 3061 3399 +338
- Misses 34 57 +23
- Partials 29 39 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Adds query capabilities to inspect task state:
New Repository methods: