File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ async def check_if_session_is_active(instrument_name: str, session_id: int):
9494
9595
9696@router .post ("/sessions/{session_id}/multigrid_watcher" )
97- async def start_multigrid_watcher (
97+ async def setup_multigrid_watcher (
9898 session_id : MurfeySessionID , watcher_spec : MultigridWatcherSetup , db = murfey_db
9999):
100100 data = {}
@@ -139,6 +139,27 @@ async def start_multigrid_watcher(
139139 return data
140140
141141
142+ @router .post ("/sessions/{session_id}/start_multigrid_watcher" )
143+ async def start_multigrid_watcher (session_id : MurfeySessionID , db = murfey_db ):
144+ data = {}
145+ instrument_name = (
146+ db .exec (select (Session ).where (Session .id == session_id )).one ().instrument_name
147+ )
148+ machine_config = get_machine_config (instrument_name = instrument_name )[
149+ instrument_name
150+ ]
151+ if machine_config .instrument_server_url :
152+ async with aiohttp .ClientSession () as clientsession :
153+ async with clientsession .post (
154+ f"{ machine_config .instrument_server_url } /sessions/{ session_id } /start_multigrid_watcher" ,
155+ headers = {
156+ "Authorization" : f"Bearer { instrument_server_tokens [session_id ]['access_token' ]} "
157+ },
158+ ) as resp :
159+ data = await resp .json ()
160+ return data
161+
162+
142163class ProvidedProcessingParameters (BaseModel ):
143164 dose_per_frame : float
144165 extract_downscale : bool = True
You can’t perform that action at this time.
0 commit comments