@@ -1811,15 +1811,15 @@ async def add_project_states_for_user(
18111811 )
18121812 # for templates: the project is never locked and never opened. also the running state is always unknown
18131813 share_state = await _get_project_share_state (user_id , project ["uuid" ], app )
1814- running_state = RunningState .UNKNOWN
1814+ project_running_state = RunningState .UNKNOWN
18151815
18161816 if not is_template and (
18171817 computation_task := await director_v2_service .get_computation_task (
18181818 app , user_id , project ["uuid" ]
18191819 )
18201820 ):
18211821 # get the running state
1822- running_state = computation_task .state
1822+ project_running_state = computation_task .state
18231823 # get the nodes individual states
18241824 for (
18251825 node_id ,
@@ -1835,8 +1835,21 @@ async def add_project_states_for_user(
18351835 prj_node_progress = node_state_dict .get ("progress" , None ) or 0
18361836 prj_node .update ({"progress" : round (prj_node_progress * 100.0 )})
18371837
1838+ for node_uuid , node in project ["workbench" ].items ():
1839+ assert isinstance (node , dict ) # nosec
1840+ node_lock_state = await _get_node_lock_state (
1841+ app ,
1842+ user_id = user_id ,
1843+ project_uuid = project ["uuid" ],
1844+ node_id = NodeID (node_uuid ),
1845+ )
1846+ node .setdefault ("state" , {}).setdefault (
1847+ "lock_state" ,
1848+ node_lock_state .model_dump (mode = "json" , by_alias = True , exclude_unset = True ),
1849+ )
1850+
18381851 project ["state" ] = ProjectState (
1839- share_state = share_state , state = ProjectRunningState (value = running_state )
1852+ share_state = share_state , state = ProjectRunningState (value = project_running_state )
18401853 ).model_dump (by_alias = True , exclude_unset = True )
18411854 return project
18421855
0 commit comments