-
Notifications
You must be signed in to change notification settings - Fork 32
♻️ common http API interface for long_running_tasks
#7843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
♻️ common http API interface for long_running_tasks
#7843
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7843 +/- ##
==========================================
+ Coverage 87.89% 87.96% +0.07%
==========================================
Files 1837 1640 -197
Lines 71032 66447 -4585
Branches 1219 912 -307
==========================================
- Hits 62433 58450 -3983
+ Misses 8256 7734 -522
+ Partials 343 263 -80
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
long_running_tasks
long_running_taskslong_running_tasks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the long running tasks API by unifying the HTTP interface for both aiohttp and FastAPI servers and delegating core implementation to a common servicelib module. Key changes include:
- Standardizing configuration values to use timedelta instead of raw seconds.
- Refactoring API endpoints and client/server modules to use shared http_endpoint_responses.
- Removing deprecated or unused code and updating tests to align with the new interface.
Reviewed Changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| services/director-v2/tests/integration/02/test_dynamic_sidecar_nodeports_integration.py | Updated import paths for FastAPI client and periodic_task_result. |
| packages/service-library/tests/long_running_tasks/test_long_running_tasks_task.py | Changed datetime import usage and updated configuration to use timedelta. |
| packages/service-library/src/servicelib/long_running_tasks/task.py | Refactored TasksManager usage to support timedelta and replaced the close method with teardown. |
| packages/service-library/src/servicelib/long_running_tasks/models.py | Introduced TaskGetWithoutHref and updated default factory for timestamps. |
| packages/service-library/src/servicelib/long_running_tasks/http_endpoint_responses.py | Added helper functions to centralize HTTP endpoint responses. |
| packages/service-library/src/servicelib/long_running_tasks/constants.py | Added new constants file for default poll and stale task intervals. |
| packages/service-library/src/servicelib/fastapi/long_running_tasks/* | Updated client, server, routes, and error handlers to use the new configuration and common responses. |
| packages/service-library/src/servicelib/aiohttp/long_running_tasks/* | Refactored server, client, routes, and dependencies to align with the new interface. |
| packages/models-library/src/models_library/api_schemas_long_running_tasks/tasks.py | Adjusted TaskGet hierarchy by splitting into TaskGetWithoutHref and extending TaskGet. |
| api/specs/web-server/* | Updated response_model to Any for legacy endpoints. |
packages/service-library/src/servicelib/fastapi/long_running_tasks/_error_handlers.py
Show resolved
Hide resolved
sanderegg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
packages/models-library/src/models_library/api_schemas_long_running_tasks/tasks.py
Outdated
Show resolved
Hide resolved
packages/service-library/src/servicelib/aiohttp/long_running_tasks/_dependencies.py
Outdated
Show resolved
Hide resolved
packages/service-library/src/servicelib/aiohttp/long_running_tasks/_routes.py
Outdated
Show resolved
Hide resolved
packages/service-library/src/servicelib/aiohttp/long_running_tasks/_routes.py
Show resolved
Hide resolved
packages/service-library/src/servicelib/long_running_tasks/task.py
Outdated
Show resolved
Hide resolved
|
packages/service-library/src/servicelib/aiohttp/long_running_tasks/_dependencies.py
Show resolved
Hide resolved
|
@Mergifyio queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at c7b7878 |



What do these changes do?
Aligns the public interface exposed by an
aiohttporFastAPIserver for managing the lifecycle of a long running task.Also delegates as much as possible of the implementation inside the common
servicelib/long_running_tasksinstead of the individualservicelib/aiohttp/long_running_tasksandservicelib/fastapi/long_running_tasksmodules.Removes some unused code
Related issue/s
How to test
Dev-ops