Skip to content

feat: Add task state query API for static and dynamic tasks#47

Merged
tibordp merged 2 commits into
masterfrom
feature/query-api-static-tasks
Oct 19, 2025
Merged

feat: Add task state query API for static and dynamic tasks#47
tibordp merged 2 commits into
masterfrom
feature/query-api-static-tasks

Conversation

@tibordp
Copy link
Copy Markdown
Owner

@tibordp tibordp commented Oct 19, 2025

Adds 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

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
Copy link
Copy Markdown

codecov Bot commented Oct 19, 2025

Codecov Report

❌ Patch coverage is 91.10512% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.25%. Comparing base (a29c291) to head (d8b41b8).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
tests/test_pyncette_integration.py 93.79% 8 Missing ⚠️
src/pyncette/dynamodb.py 87.17% 3 Missing and 2 partials ⚠️
src/pyncette/mysql.py 87.80% 3 Missing and 2 partials ⚠️
src/pyncette/postgres.py 85.71% 3 Missing and 2 partials ⚠️
src/pyncette/redis/__init__.py 87.50% 3 Missing and 2 partials ⚠️
src/pyncette/sqlite.py 87.50% 3 Missing and 2 partials ⚠️
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     
Flag Coverage Δ
integration 97.22% <91.10%> (-0.73%) ⬇️
py3.10 76.93% <59.29%> (-2.10%) ⬇️
py3.11 76.93% <59.29%> (-2.10%) ⬇️
py3.12 76.93% <59.29%> (-2.10%) ⬇️
py3.13 76.93% <59.29%> (-2.10%) ⬇️
py3.14 76.84% <59.29%> (-2.10%) ⬇️
py3.9 76.92% <59.29%> (-2.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tibordp tibordp merged commit 07b6c01 into master Oct 19, 2025
12 checks passed
@tibordp tibordp deleted the feature/query-api-static-tasks branch October 19, 2025 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant