@@ -25,7 +25,9 @@ async def _get_node_from_db(
2525 project_id ,
2626 )
2727 rows_count = await connection .scalar (
28- sa .select (sa .func .count ()).select_from (
28+ sa .select (sa .func .count ())
29+ .select_from (comp_tasks )
30+ .where (
2931 (comp_tasks .c .node_id == node_uuid )
3032 & (comp_tasks .c .project_id == project_id ),
3133 )
@@ -84,9 +86,10 @@ async def write_ports_configuration(
8486 _logger .debug (message )
8587
8688 node_configuration = json .loads (json_configuration )
87- async with DBContextManager (
88- self ._db_engine
89- ) as engine , engine .begin () as connection :
89+ async with (
90+ DBContextManager (self ._db_engine ) as engine ,
91+ engine .begin () as connection ,
92+ ):
9093 # update the necessary parts
9194 await connection .execute (
9295 comp_tasks .update ()
@@ -108,9 +111,10 @@ async def get_ports_configuration_from_node_uuid(
108111 _logger .debug (
109112 "Getting ports configuration of node %s from comp_tasks table" , node_uuid
110113 )
111- async with DBContextManager (
112- self ._db_engine
113- ) as engine , engine .connect () as connection :
114+ async with (
115+ DBContextManager (self ._db_engine ) as engine ,
116+ engine .connect () as connection ,
117+ ):
114118 node = await _get_node_from_db (project_id , node_uuid , connection )
115119 node_json_config = json .dumps (
116120 {
@@ -124,9 +128,10 @@ async def get_ports_configuration_from_node_uuid(
124128 return node_json_config
125129
126130 async def get_project_owner_user_id (self , project_id : ProjectID ) -> UserID :
127- async with DBContextManager (
128- self ._db_engine
129- ) as engine , engine .connect () as connection :
131+ async with (
132+ DBContextManager (self ._db_engine ) as engine ,
133+ engine .connect () as connection ,
134+ ):
130135 prj_owner = await connection .scalar (
131136 sa .select (projects .c .prj_owner ).where (
132137 projects .c .uuid == f"{ project_id } "
0 commit comments