-
Notifications
You must be signed in to change notification settings - Fork 32
🎨 Makes removal of long running tasks faster #8350
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
Merged
GitHK
merged 29 commits into
ITISFoundation:master
from
GitHK:pr-osparc-speedup-lrt-result
Sep 16, 2025
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
fa5a2e2
added is marked for removal
8cb2035
avoids flaky
59d92e4
refactored to remve task immediately
2b16d39
simplified interface
5c7f6c8
fixed tests
4ef3f22
fixed tests
591af8a
fixed tests
7397724
possible fix
690aacb
Merge remote-tracking branch 'upstream/master' into pr-osparc-speedup…
98ac056
fixed broken tests
0c8ed8a
refactor
40a0767
fixed removal
fa82a7d
rename
f986c47
refactor test
7f87ed4
removed unused
7cd3a23
refactor
10fc877
typo
0d23b86
removed unsued
579f6ce
added test to ensure it never changes
a8a1bf5
refactored test
11c8428
Merge remote-tracking branch 'upstream/master' into pr-osparc-speedup…
a581187
rename
78a9f09
removed comment
8f2999a
Merge branch 'master' into pr-osparc-speedup-lrt-result
GitHK a15cfbe
rename
295fa66
Merge branch 'pr-osparc-speedup-lrt-result' of github.com:GitHK/ospar…
c14dcc3
Merge branch 'master' into pr-osparc-speedup-lrt-result
GitHK e88090b
Merge branch 'master' into pr-osparc-speedup-lrt-result
GitHK fdf2f2c
Merge remote-tracking branch 'upstream/master' into pr-osparc-speedup…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
packages/pytest-simcore/src/pytest_simcore/helpers/long_running_tasks.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # pylint: disable=protected-access | ||
|
|
||
| import pytest | ||
| from fastapi import FastAPI | ||
| from servicelib.long_running_tasks.errors import TaskNotFoundError | ||
| from servicelib.long_running_tasks.manager import ( | ||
| LongRunningManager, | ||
| ) | ||
| from servicelib.long_running_tasks.models import TaskContext | ||
| from servicelib.long_running_tasks.task import TaskId | ||
| from tenacity import ( | ||
| AsyncRetrying, | ||
| retry_if_not_exception_type, | ||
| stop_after_delay, | ||
| wait_fixed, | ||
| ) | ||
|
|
||
|
|
||
| def get_fastapi_long_running_manager(app: FastAPI) -> LongRunningManager: | ||
| manager = app.state.long_running_manager | ||
| assert isinstance(manager, LongRunningManager) | ||
| return manager | ||
|
|
||
|
|
||
| async def assert_task_is_no_longer_present( | ||
| manager: LongRunningManager, task_id: TaskId, task_context: TaskContext | ||
| ) -> None: | ||
| async for attempt in AsyncRetrying( | ||
| reraise=True, | ||
| wait=wait_fixed(0.1), | ||
| stop=stop_after_delay(60), | ||
| retry=retry_if_not_exception_type(TaskNotFoundError), | ||
| ): | ||
| with attempt: # noqa: SIM117 | ||
| with pytest.raises(TaskNotFoundError): | ||
| # use internals to detirmine when it's no longer here | ||
| await manager._tasks_manager._get_tracked_task( # noqa: SLF001 | ||
| task_id, task_context | ||
| ) |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.