File tree Expand file tree Collapse file tree 2 files changed +20
-15
lines changed
postgres-database/src/simcore_postgres_database
simcore-sdk/src/simcore_sdk/node_ports_common Expand file tree Collapse file tree 2 files changed +20
-15
lines changed Original file line number Diff line number Diff line change 1+ import logging
12from typing import cast
23
34import sqlalchemy as sa
78from .models .comp_runs import comp_runs
89from .utils_repos import pass_or_acquire_connection
910
11+ _logger = logging .getLogger (__name__ )
12+
1013
1114async def get_latest_run_id_for_project (
1215 engine : AsyncEngine ,
1316 conn : AsyncConnection | None = None ,
1417 * ,
1518 project_id : str ,
16- ) -> PositiveInt :
19+ ) -> PositiveInt | None :
1720 # Get latest run per (project_uuid, user_id)
1821 project_and_user_latest_runs = (
1922 sa .select (
@@ -68,6 +71,7 @@ async def get_latest_run_id_for_project(
6871 result = await _conn .execute (base_select_query )
6972 row = result .one_or_none ()
7073 if not row :
71- msg = f"get_latest_run_id_for_project did not return any row for project_id={ project_id } "
72- raise ValueError (msg )
74+ msg = f"get_latest_run_id_for_project did not return any row for project_id={ project_id } (MD: I think this should not happen, but if it happens contact MD/SAN)"
75+ _logger .error (msg )
76+ return None
7377 return cast (PositiveInt , row .run_id )
Original file line number Diff line number Diff line change @@ -66,18 +66,19 @@ async def _update_comp_run_snapshot_tasks_if_computational(
6666 _latest_run_id = await get_latest_run_id_for_project (
6767 engine , connection , project_id = project_id
6868 )
69- await update_for_run_id_and_node_id (
70- engine ,
71- connection ,
72- run_id = _latest_run_id ,
73- node_id = node_uuid ,
74- data = {
75- "schema" : node_configuration ["schema" ],
76- "inputs" : node_configuration ["inputs" ],
77- "outputs" : node_configuration ["outputs" ],
78- "run_hash" : node_configuration .get ("run_hash" ),
79- },
80- )
69+ if _latest_run_id is not None :
70+ await update_for_run_id_and_node_id (
71+ engine ,
72+ connection ,
73+ run_id = _latest_run_id ,
74+ node_id = node_uuid ,
75+ data = {
76+ "schema" : node_configuration ["schema" ],
77+ "inputs" : node_configuration ["inputs" ],
78+ "outputs" : node_configuration ["outputs" ],
79+ "run_hash" : node_configuration .get ("run_hash" ),
80+ },
81+ )
8182
8283
8384class DBContextManager :
You can’t perform that action at this time.
0 commit comments