-
Notifications
You must be signed in to change notification settings - Fork 32
🎨 adding new scheduling mode to dynamic-scheduler ⚠️ #6889
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 8 commits into
ITISFoundation:master
from
GitHK:pr-osparc-dynamic-scheduler-scheduling-options
Dec 5, 2024
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2eb364c
added new scheduling mode
f626572
restructured modules
3cb6e9a
extended tests
f7e5863
fixed broken test
c130e8b
renamed env var
c219c8e
add xfail for option
509eb21
Merge remote-tracking branch 'upstream/master' into pr-osparc-dynamic…
af041a9
mypy
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
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
61 changes: 61 additions & 0 deletions
61
...s/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/scheduler_interface.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,61 @@ | ||
| from fastapi import FastAPI | ||
| from models_library.api_schemas_directorv2.dynamic_services import DynamicServiceGet | ||
| from models_library.api_schemas_dynamic_scheduler.dynamic_services import ( | ||
| DynamicServiceStart, | ||
| DynamicServiceStop, | ||
| ) | ||
| from models_library.api_schemas_webserver.projects_nodes import NodeGet, NodeGetIdle | ||
| from models_library.projects_nodes_io import NodeID | ||
|
|
||
| from ..core.settings import ApplicationSettings | ||
| from .director_v2 import DirectorV2Client | ||
| from .service_tracker import set_request_as_running, set_request_as_stopped | ||
|
|
||
|
|
||
| async def get_service_status( | ||
| app: FastAPI, *, node_id: NodeID | ||
| ) -> NodeGet | DynamicServiceGet | NodeGetIdle: | ||
| settings: ApplicationSettings = app.state.settings | ||
| if settings.DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER: | ||
| raise NotImplementedError | ||
|
|
||
| director_v2_client = DirectorV2Client.get_from_app_state(app) | ||
| response: NodeGet | DynamicServiceGet | NodeGetIdle = ( | ||
| await director_v2_client.get_status(node_id) | ||
| ) | ||
| return response | ||
|
|
||
|
|
||
| async def run_dynamic_service( | ||
| app: FastAPI, *, dynamic_service_start: DynamicServiceStart | ||
| ) -> NodeGet | DynamicServiceGet: | ||
| settings: ApplicationSettings = app.state.settings | ||
| if settings.DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER: | ||
| raise NotImplementedError | ||
|
|
||
| director_v2_client = DirectorV2Client.get_from_app_state(app) | ||
| response: NodeGet | DynamicServiceGet = ( | ||
| await director_v2_client.run_dynamic_service(dynamic_service_start) | ||
| ) | ||
|
|
||
| await set_request_as_running(app, dynamic_service_start) | ||
| return response | ||
|
|
||
|
|
||
| async def stop_dynamic_service( | ||
| app: FastAPI, *, dynamic_service_stop: DynamicServiceStop | ||
| ) -> None: | ||
| settings: ApplicationSettings = app.state.settings | ||
| if settings.DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER: | ||
| raise NotImplementedError | ||
|
|
||
| director_v2_client = DirectorV2Client.get_from_app_state(app) | ||
| settings: ApplicationSettings = app.state.settings | ||
| await director_v2_client.stop_dynamic_service( | ||
| node_id=dynamic_service_stop.node_id, | ||
| simcore_user_agent=dynamic_service_stop.simcore_user_agent, | ||
| save_state=dynamic_service_stop.save_state, | ||
| timeout=settings.DYNAMIC_SCHEDULER_STOP_SERVICE_TIMEOUT, | ||
| ) | ||
|
|
||
| await set_request_as_stopped(app, dynamic_service_stop) |
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.
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.