@@ -1367,7 +1367,12 @@ async def is_node_id_present_in_any_project_workbench(
13671367
13681368
13691369async def _get_node_share_state (
1370- app : web .Application , * , user_id : UserID , project_uuid : ProjectID , node_id : NodeID
1370+ app : web .Application ,
1371+ * ,
1372+ project_uuid : ProjectID ,
1373+ node_id : NodeID ,
1374+ computational_pipeline_running : bool ,
1375+ user_primrary_groupid : GroupID ,
13711376) -> NodeShareState :
13721377 node = await _projects_nodes_repository .get (
13731378 app , project_id = project_uuid , node_id = node_id
@@ -1398,11 +1403,11 @@ async def _get_node_share_state(
13981403 return NodeShareState (locked = False )
13991404
14001405 # if the service is computational and no pipeline is running it is not locked
1401- if await director_v2_service . is_pipeline_running ( app , user_id , project_uuid ) :
1406+ if computational_pipeline_running :
14021407 return NodeShareState (
14031408 locked = True ,
14041409 current_user_groupids = [
1405- await users_service . get_user_primary_group_id ( app , user_id )
1410+ user_primrary_groupid ,
14061411 ],
14071412 status = NodeShareStatus .OPENED ,
14081413 )
@@ -1906,6 +1911,11 @@ async def add_project_states_for_user(
19061911 )
19071912
19081913 # compose the node states
1914+ is_pipeline_running = (
1915+ await director_v2_service .is_pipeline_running (app , user_id , project ["uuid" ])
1916+ or True
1917+ )
1918+ user_primary_group_id = await users_service .get_user_primary_group_id (app , user_id )
19091919 for node_uuid , node in project ["workbench" ].items ():
19101920 assert isinstance (node_uuid , str ) # nosec
19111921 assert isinstance (node , dict ) # nosec
@@ -1914,9 +1924,10 @@ async def add_project_states_for_user(
19141924 with contextlib .suppress (NodeShareStateCannotBeComputedError ):
19151925 node_lock_state = await _get_node_share_state (
19161926 app ,
1917- user_id = user_id ,
19181927 project_uuid = project ["uuid" ],
19191928 node_id = NodeID (node_uuid ),
1929+ computational_pipeline_running = is_pipeline_running ,
1930+ user_primrary_groupid = user_primary_group_id ,
19201931 )
19211932 if NodeID (node_uuid ) in computational_node_states :
19221933 node_state = computational_node_states [NodeID (node_uuid )].model_copy (
0 commit comments