Skip to content

Commit 1c4df32

Browse files
fix
1 parent 411525d commit 1c4df32

File tree

7 files changed

+28
-21
lines changed

7 files changed

+28
-21
lines changed

packages/postgres-database/src/simcore_postgres_database/models/comp_run_snapshot_tasks.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
sa.Column(
3636
"project_id",
3737
sa.String,
38-
sa.ForeignKey("comp_pipeline.project_id"),
3938
doc="Project that contains the node associated to this task",
4039
),
4140
sa.Column("node_id", sa.String, doc="Node associated to this task"),

packages/postgres-database/src/simcore_postgres_database/utils_comp_run_snapshot_tasks.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import sqlalchemy as sa
2-
from models_library.projects_nodes_io import NodeID
32
from pydantic import PositiveInt
43
from sqlalchemy.ext.asyncio import AsyncConnection, AsyncEngine
54

@@ -38,7 +37,7 @@ async def update_for_run_id_and_node_id(
3837
conn: AsyncConnection | None = None,
3938
*,
4039
run_id: PositiveInt,
41-
node_id: NodeID,
40+
node_id: str,
4241
data: dict,
4342
):
4443
async with pass_or_acquire_connection(engine, connection=conn) as _conn:
@@ -50,7 +49,7 @@ async def update_for_run_id_and_node_id(
5049
)
5150
.where(
5251
(comp_run_snapshot_tasks.c.run_id == run_id)
53-
& (comp_run_snapshot_tasks.c.node_id == f"{node_id}")
52+
& (comp_run_snapshot_tasks.c.node_id == node_id)
5453
)
5554
.returning(*COMP_RUN_SNAPSHOT_TASKS_DB_COLS)
5655
)

packages/postgres-database/src/simcore_postgres_database/utils_comp_runs.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import sqlalchemy as sa
2-
from models_library.projects import ProjectID
32
from pydantic import PositiveInt
43
from sqlalchemy.ext.asyncio import AsyncConnection, AsyncEngine
54

@@ -11,7 +10,7 @@ async def get_latest_run_id_for_project(
1110
engine: AsyncEngine,
1211
conn: AsyncConnection | None = None,
1312
*,
14-
project_id: ProjectID,
13+
project_id: str,
1514
) -> PositiveInt:
1615
# Get latest run per (project_uuid, user_id)
1716
project_and_user_latest_runs = (
@@ -21,7 +20,7 @@ async def get_latest_run_id_for_project(
2120
sa.func.max(comp_runs.c.iteration).label("latest_iteration"),
2221
sa.func.max(comp_runs.c.created).label("created"),
2322
)
24-
.where(comp_runs.c.project_uuid == f"{project_id}")
23+
.where(comp_runs.c.project_uuid == project_id)
2524
.group_by(comp_runs.c.project_uuid, comp_runs.c.user_id)
2625
.subquery("project_and_user_latest_runs")
2726
)

packages/simcore-sdk/src/simcore_sdk/node_ports_common/dbmanager.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import sqlalchemy as sa
44
from common_library.json_serialization import json_dumps, json_loads
55
from models_library.projects import ProjectID
6-
from models_library.projects_nodes_io import NodeID
76
from models_library.users import UserID
87
from pydantic import TypeAdapter
98
from servicelib.db_asyncpg_utils import create_async_engine_and_database_ready
@@ -114,15 +113,15 @@ async def write_ports_configuration(
114113
)
115114
# 2. Get latest run id for the project
116115
_latest_run_id = await get_latest_run_id_for_project(
117-
engine, connection, project_id=ProjectID(project_id)
116+
engine, connection, project_id=project_id
118117
)
119118

120119
# 3. Update comp_run_snapshot_tasks table
121120
await update_for_run_id_and_node_id(
122121
engine,
123122
connection,
124123
run_id=_latest_run_id,
125-
node_id=NodeID(node_uuid),
124+
node_id=node_uuid,
126125
data={
127126
"schema": node_configuration["schema"],
128127
"inputs": node_configuration["inputs"],

services/director-v2/src/simcore_service_director_v2/modules/comp_scheduler/_scheduler_dask.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ async def _start_tasks(
117117
client.send_computation_tasks(
118118
user_id=user_id,
119119
project_id=project_id,
120-
run_id=comp_run.run_id,
121120
tasks={node_id: task.image},
122121
hardware_info=task.hardware_info,
123122
callback=wake_up_callback,

services/director-v2/src/simcore_service_director_v2/modules/db/repositories/comp_runs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ async def get_latest_run_id_for_project(
358358
project_id: ProjectID,
359359
) -> PositiveInt:
360360
return await get_latest_run_id_for_project(
361-
self.db_engine, conn, project_id=project_id
361+
self.db_engine, conn, project_id=f"{project_id}"
362362
)
363363

364364
async def create(

services/director-v2/src/simcore_service_director_v2/modules/db/repositories/comp_runs_snapshot_tasks.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,22 @@ async def batch_create(
2727
) -> list[CompRunSnapshotTaskAtDBGet]:
2828
async with transaction_context(self.db_engine) as conn:
2929

30-
result = await conn.execute(
31-
comp_run_snapshot_tasks.insert().returning(
32-
*COMP_RUN_SNAPSHOT_TASKS_DB_COLS
33-
),
34-
data,
35-
)
36-
rows = result.fetchall()
37-
return [CompRunSnapshotTaskAtDBGet.model_validate(row) for row in rows]
30+
try:
31+
result = await conn.execute(
32+
comp_run_snapshot_tasks.insert().returning(
33+
*COMP_RUN_SNAPSHOT_TASKS_DB_COLS
34+
),
35+
data,
36+
)
37+
rows = result.fetchall()
38+
return [CompRunSnapshotTaskAtDBGet.model_validate(row) for row in rows]
39+
except Exception as e:
40+
logger.error(
41+
"Failed to batch create comp run snapshot tasks: %s",
42+
e,
43+
exc_info=True,
44+
)
45+
raise
3846

3947
async def update_for_run_id_and_node_id(
4048
self,
@@ -45,6 +53,10 @@ async def update_for_run_id_and_node_id(
4553
data: dict,
4654
) -> CompRunSnapshotTaskAtDBGet:
4755
row = await update_for_run_id_and_node_id(
48-
self.db_engine, conn=connection, run_id=run_id, node_id=node_id, data=data
56+
self.db_engine,
57+
conn=connection,
58+
run_id=run_id,
59+
node_id=f"{node_id}",
60+
data=data,
4961
)
5062
return CompRunSnapshotTaskAtDBGet.model_validate(row)

0 commit comments

Comments
 (0)