|
1 | 1 | import logging |
2 | | -from collections import deque |
3 | | -from collections.abc import Coroutine |
4 | 2 | from typing import Any |
5 | 3 |
|
6 | 4 | from aiohttp import web |
7 | 5 | from models_library.errors import ErrorDict |
8 | 6 | from models_library.projects import ProjectID |
9 | 7 | from models_library.projects_nodes_io import NodeID |
10 | 8 | from models_library.users import UserID |
11 | | -from servicelib.aiohttp.application_keys import APP_FIRE_AND_FORGET_TASKS_KEY |
12 | 9 | from servicelib.logging_utils import log_decorator |
13 | | -from servicelib.utils import fire_and_forget_task, logged_gather |
| 10 | +from servicelib.utils import logged_gather |
14 | 11 |
|
15 | 12 | from . import _projects_service |
16 | | -from .utils import get_frontend_node_outputs_changes |
17 | 13 |
|
18 | 14 | log = logging.getLogger(__name__) |
19 | 15 |
|
@@ -91,48 +87,3 @@ async def update_node_outputs( |
91 | 87 | await _projects_service.post_trigger_connected_service_retrieve( |
92 | 88 | app=app, project=project, updated_node_uuid=f"{node_uuid}", changed_keys=keys |
93 | 89 | ) |
94 | | - |
95 | | - |
96 | | -async def update_frontend_outputs( |
97 | | - app: web.Application, |
98 | | - user_id: UserID, |
99 | | - project_uuid: ProjectID, |
100 | | - old_project: dict[str, Any], |
101 | | - new_project: dict[str, Any], |
102 | | -) -> None: |
103 | | - old_workbench = old_project["workbench"] |
104 | | - new_workbench = new_project["workbench"] |
105 | | - frontend_nodes_update_tasks: deque[Coroutine] = deque() |
106 | | - |
107 | | - for node_key, node in new_workbench.items(): |
108 | | - old_node = old_workbench.get(node_key) |
109 | | - if not old_node: |
110 | | - continue |
111 | | - |
112 | | - # check if there were any changes in the outputs of |
113 | | - # frontend services |
114 | | - # NOTE: for now only file-picker is handled |
115 | | - outputs_changes: set[str] = get_frontend_node_outputs_changes( |
116 | | - new_node=node, old_node=old_node |
117 | | - ) |
118 | | - |
119 | | - if len(outputs_changes) > 0: |
120 | | - frontend_nodes_update_tasks.append( |
121 | | - update_node_outputs( |
122 | | - app=app, |
123 | | - user_id=user_id, |
124 | | - project_uuid=project_uuid, |
125 | | - node_uuid=node_key, |
126 | | - outputs=node.get("outputs", {}), |
127 | | - run_hash=None, |
128 | | - node_errors=None, |
129 | | - ui_changed_keys=outputs_changes, |
130 | | - ) |
131 | | - ) |
132 | | - |
133 | | - for task_index, frontend_node_update_task in enumerate(frontend_nodes_update_tasks): |
134 | | - fire_and_forget_task( |
135 | | - frontend_node_update_task, |
136 | | - task_suffix_name=f"frontend_node_update_task_{task_index}", |
137 | | - fire_and_forget_tasks_collection=app[APP_FIRE_AND_FORGET_TASKS_KEY], |
138 | | - ) |
0 commit comments