Skip to content

Commit ce6f78e

Browse files
committed
send notification when node is started/stopped
1 parent fd96a66 commit ce6f78e

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

services/web/server/src/simcore_service_webserver/projects/_controller/nodes_rest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,15 @@ async def _stop_dynamic_service_task(
311311
await dynamic_scheduler_service.stop_dynamic_service(
312312
app, dynamic_service_stop=dynamic_service_stop
313313
)
314+
project = await _projects_service.get_project_for_user(
315+
app,
316+
f"{dynamic_service_stop.project_id}",
317+
dynamic_service_stop.user_id,
318+
include_state=True,
319+
)
320+
await _projects_service.notify_project_node_update(
321+
app, project, dynamic_service_stop.node_id, errors=None
322+
)
314323
return web.json_response(status=status.HTTP_204_NO_CONTENT)
315324

316325
except (RPCServerError, ServiceWaitingForManualInterventionError) as exc:

services/web/server/src/simcore_service_webserver/projects/_projects_service.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ async def _start_dynamic_service( # noqa: C901
731731

732732
# this is a dynamic node, let's gather its resources and start it
733733

734-
db: ProjectDBAPI = ProjectDBAPI.get_from_app_context(request.app)
734+
db = ProjectDBAPI.get_from_app_context(request.app)
735735

736736
try:
737737
await _check_project_node_has_all_required_inputs(
@@ -916,6 +916,10 @@ async def _() -> None:
916916
hardware_info=hardware_info,
917917
),
918918
)
919+
project = await get_project_for_user(
920+
request.app, f"{project_uuid}", user_id, include_state=True
921+
)
922+
await notify_project_node_update(request.app, project, node_uuid, errors=None)
919923

920924
await _()
921925

@@ -2105,8 +2109,6 @@ async def remove_project_dynamic_services(
21052109
:raises ProjectLockError
21062110
"""
21072111

2108-
# NOTE: during the closing process, which might take awhile,
2109-
# the project is locked so no one opens it at the same time
21102112
_logger.debug(
21112113
"removing project interactive services for project [%s] and user [%s]",
21122114
project_uuid,

0 commit comments

Comments
 (0)