@@ -60,8 +60,8 @@ async def activate_instrument_server_for_session(
6060 machine_config = get_machine_config (instrument_name = instrument_name )[
6161 instrument_name
6262 ]
63- async with aiohttp .ClientSession () as session :
64- async with session .post (
63+ async with aiohttp .ClientSession () as clientsession :
64+ async with clientsession .post (
6565 f"{ machine_config .instrument_server_url } /sessions/{ int (sanitise (str (session_id )))} /token" ,
6666 json = {"access_token" : token , "token_type" : "bearer" },
6767 ) as response :
@@ -80,11 +80,11 @@ async def check_if_session_is_active(instrument_name: str, session_id: int):
8080 if instrument_server_tokens .get (session_id ) is None :
8181 return {"active" : False }
8282 async with lock :
83- async with aiohttp .ClientSession () as session :
83+ async with aiohttp .ClientSession () as clientsession :
8484 machine_config = get_machine_config (instrument_name = instrument_name )[
8585 instrument_name
8686 ]
87- async with session .get (
87+ async with clientsession .get (
8888 f"{ machine_config .instrument_server_url } /sessions/{ int (sanitise (str (session_id )))} /check_token" ,
8989 headers = {
9090 "Authorization" : f"Bearer { instrument_server_tokens [session_id ]['access_token' ]} "
@@ -116,8 +116,8 @@ async def start_multigrid_watcher(
116116 "visit" : visit ,
117117 "default_model" : str (machine_config .default_model ),
118118 }
119- async with aiohttp .ClientSession () as session :
120- async with session .post (
119+ async with aiohttp .ClientSession () as clientsession :
120+ async with clientsession .post (
121121 f"{ machine_config .instrument_server_url } /sessions/{ session_id } /multigrid_watcher" ,
122122 json = {
123123 "source" : str (secure_path (watcher_spec .source / visit )),
@@ -171,8 +171,8 @@ async def pass_proc_params_to_instrument_server(
171171 ]
172172 if machine_config .instrument_server_url :
173173 label = db .exec (select (Session ).where (Session .id == session_id )).one ().name
174- async with aiohttp .ClientSession () as session :
175- async with session .post (
174+ async with aiohttp .ClientSession () as clientsession :
175+ async with clientsession .post (
176176 f"{ machine_config .instrument_server_url } /sessions/{ session_id } /processing_parameters" ,
177177 json = {
178178 "label" : label ,
@@ -200,8 +200,8 @@ async def check_instrument_server(instrument_name: str):
200200 instrument_name
201201 ]
202202 if machine_config .instrument_server_url :
203- async with aiohttp .ClientSession () as session :
204- async with session .get (
203+ async with aiohttp .ClientSession () as clientsession :
204+ async with clientsession .get (
205205 f"{ machine_config .instrument_server_url } /health" ,
206206 ) as resp :
207207 data = await resp .json ()
@@ -221,8 +221,8 @@ async def get_possible_gain_references(
221221 if machine_config .instrument_server_url :
222222 async with lock :
223223 token = instrument_server_tokens [session_id ]["access_token" ]
224- async with aiohttp .ClientSession () as session :
225- async with session .get (
224+ async with aiohttp .ClientSession () as clientsession :
225+ async with clientsession .get (
226226 f"{ machine_config .instrument_server_url } /instruments/{ sanitise (instrument_name )} /sessions/{ sanitise (str (session_id ))} /possible_gain_references" ,
227227 headers = {"Authorization" : f"Bearer { token } " },
228228 ) as resp :
@@ -250,8 +250,8 @@ async def request_gain_reference_upload(
250250 visit_path = f"{ datetime .datetime .now ().year } /{ visit } "
251251 data = {}
252252 if machine_config .instrument_server_url :
253- async with aiohttp .ClientSession () as session :
254- async with session .post (
253+ async with aiohttp .ClientSession () as clientsession :
254+ async with clientsession .post (
255255 f"{ machine_config .instrument_server_url } /instruments/{ instrument_name } /sessions/{ session_id } /upload_gain_reference" ,
256256 json = {
257257 "gain_path" : str (gain_reference_request .gain_path ),
@@ -283,8 +283,8 @@ async def request_upstream_tiff_data_download(
283283 / secure_filename (visit_name )
284284 )
285285 if machine_config .instrument_server_url :
286- async with aiohttp .ClientSession () as session :
287- async with session .post (
286+ async with aiohttp .ClientSession () as clientsession :
287+ async with clientsession .post (
288288 f"{ machine_config .instrument_server_url } /visits/{ secure_filename (visit_name )} /sessions/{ sanitise (str (session_id ))} /upstream_tiff_data_request" ,
289289 json = {"download_dir" : download_dir },
290290 headers = {
@@ -311,8 +311,8 @@ async def stop_rsyncer(
311311 instrument_name
312312 ]
313313 if machine_config .instrument_server_url :
314- async with aiohttp .ClientSession () as session :
315- async with session .post (
314+ async with aiohttp .ClientSession () as clientsession :
315+ async with clientsession .post (
316316 f"{ machine_config .instrument_server_url } /sessions/{ session_id } /stop_rsyncer" ,
317317 json = {
318318 "label" : session_id ,
@@ -338,8 +338,8 @@ async def finalise_rsyncer(
338338 instrument_name
339339 ]
340340 if machine_config .instrument_server_url :
341- async with aiohttp .ClientSession () as session :
342- async with session .post (
341+ async with aiohttp .ClientSession () as clientsession :
342+ async with clientsession .post (
343343 f"{ machine_config .instrument_server_url } /sessions/{ session_id } /finalise_rsyncer" ,
344344 json = {
345345 "label" : session_id ,
@@ -366,8 +366,8 @@ async def remove_rsyncer(
366366 ]
367367 if isinstance (session_id , int ):
368368 if machine_config .instrument_server_url :
369- async with aiohttp .ClientSession () as session :
370- async with session .post (
369+ async with aiohttp .ClientSession () as clientsession :
370+ async with clientsession .post (
371371 f"{ machine_config .instrument_server_url } /sessions/{ session_id } /remove_rsyncer" ,
372372 json = {
373373 "label" : session_id ,
@@ -394,8 +394,8 @@ async def restart_rsyncer(
394394 ]
395395 if isinstance (session_id , int ):
396396 if machine_config .instrument_server_url :
397- async with aiohttp .ClientSession () as session :
398- async with session .post (
397+ async with aiohttp .ClientSession () as clientsession :
398+ async with clientsession .post (
399399 f"{ machine_config .instrument_server_url } /sessions/{ session_id } /restart_rsyncer" ,
400400 json = {
401401 "label" : session_id ,
0 commit comments