Skip to content

Commit

Permalink
extend interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Neagu committed Dec 5, 2024
1 parent 65ee01c commit 3bf0292
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
async def list_tracked_dynamic_services(
app: FastAPI, *, user_id: UserID | None = None, project_id: ProjectID | None = None
) -> list[DynamicServiceGet]:
director_v2_client = DirectorV2Client.get_from_app_state(app)
return await director_v2_client.list_tracked_dynamic_services(
user_id=user_id, project_id=project_id
return await scheduler_interface.list_tracked_dynamic_services(
app, user_id=user_id, project_id=project_id
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,28 @@
DynamicServiceStop,
)
from models_library.api_schemas_webserver.projects_nodes import NodeGet, NodeGetIdle
from models_library.projects import ProjectID
from models_library.projects_nodes_io import NodeID
from models_library.users import UserID

from ..core.settings import ApplicationSettings
from .director_v2 import DirectorV2Client
from .service_tracker import set_request_as_running, set_request_as_stopped


async def list_tracked_dynamic_services(
app: FastAPI, *, user_id: UserID | None = None, project_id: ProjectID | None = None
) -> list[DynamicServiceGet]:
settings: ApplicationSettings = app.state.settings
if settings.DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER:
raise NotImplementedError

director_v2_client = DirectorV2Client.get_from_app_state(app)
return await director_v2_client.list_tracked_dynamic_services(
user_id=user_id, project_id=project_id
)


async def get_service_status(
app: FastAPI, *, node_id: NodeID
) -> NodeGet | DynamicServiceGet | NodeGetIdle:
Expand Down

0 comments on commit 3bf0292

Please sign in to comment.