2626
2727
2828def _file_transferred_to (
29- environment : MurfeyInstanceEnvironment , source : Path , file_path : Path
29+ environment : MurfeyInstanceEnvironment , source : Path , file_path : Path , token : str
3030):
3131 machine_config = get_machine_config_client (
3232 str (environment .url .geturl ()),
33+ token ,
3334 instrument_name = environment .instrument_name ,
3435 demo = environment .demo ,
3536 )
@@ -111,8 +112,8 @@ class SPAModularContext(Context):
111112 ProcessingParameter ("motion_corr_binning" , "Motion Correction Binning" ),
112113 ]
113114
114- def __init__ (self , acquisition_software : str , basepath : Path ):
115- super ().__init__ ("SPA" , acquisition_software )
115+ def __init__ (self , acquisition_software : str , basepath : Path , token : str ):
116+ super ().__init__ ("SPA" , acquisition_software , token )
116117 self ._basepath = basepath
117118 self ._processing_job_stash : dict = {}
118119 self ._foil_holes : Dict [int , List [int ]] = {}
@@ -229,6 +230,7 @@ def gather_metadata(
229230 base_url = str (environment .url .geturl ()),
230231 router_name = "session_control.router" ,
231232 function_name = "machine_info_by_instrument" ,
233+ token = self ._token ,
232234 instrument_name = environment .instrument_name ,
233235 )
234236 if server_config_response is None :
@@ -302,6 +304,7 @@ def _position_analysis(
302304 base_url = str (environment .url .geturl ()),
303305 router_name = "session_info.router" ,
304306 function_name = "get_dc_groups" ,
307+ token = self ._token ,
305308 session_id = environment .murfey_session ,
306309 )
307310 .json ()
@@ -339,14 +342,17 @@ def _position_analysis(
339342 else metadata_source_as_str
340343 )
341344 image_path = (
342- _file_transferred_to (environment , metadata_source , Path (gs .image ))
345+ _file_transferred_to (
346+ environment , metadata_source , Path (gs .image ), self ._token
347+ )
343348 if gs .image
344349 else ""
345350 )
346351 capture_post (
347352 base_url = str (environment .url .geturl ()),
348353 router_name = "session_control.spa_router" ,
349354 function_name = "register_grid_square" ,
355+ token = self ._token ,
350356 session_id = environment .murfey_session ,
351357 gsid = grid_square ,
352358 data = {
@@ -385,14 +391,17 @@ def _position_analysis(
385391 else metadata_source_as_str
386392 )
387393 image_path = (
388- _file_transferred_to (environment , metadata_source , Path (fh .image ))
394+ _file_transferred_to (
395+ environment , metadata_source , Path (fh .image ), self ._token
396+ )
389397 if fh .image
390398 else ""
391399 )
392400 capture_post (
393401 base_url = str (environment .url .geturl ()),
394402 router_name = "session_control.spa_router" ,
395403 function_name = "register_foil_hole" ,
404+ token = self ._token ,
396405 session_id = environment .murfey_session ,
397406 gs_name = grid_square ,
398407 data = {
@@ -416,6 +425,7 @@ def _position_analysis(
416425 base_url = str (environment .url .geturl ()),
417426 router_name = "session_control.spa_router" ,
418427 function_name = "register_foil_hole" ,
428+ token = self ._token ,
419429 session_id = environment .murfey_session ,
420430 gs_name = grid_square ,
421431 data = {
@@ -444,6 +454,7 @@ def post_transfer(
444454 if environment :
445455 machine_config = get_machine_config_client (
446456 str (environment .url .geturl ()),
457+ self ._token ,
447458 instrument_name = environment .instrument_name ,
448459 demo = environment .demo ,
449460 )
@@ -470,13 +481,14 @@ def post_transfer(
470481
471482 if environment :
472483 file_transferred_to = _file_transferred_to (
473- environment , source , transferred_file
484+ environment , source , transferred_file , self . _token
474485 )
475486 if not environment .movie_counters .get (str (source )):
476487 movie_counts_get = capture_get (
477488 base_url = str (environment .url .geturl ()),
478489 router_name = "session_control.router" ,
479490 function_name = "count_number_of_movies" ,
491+ token = self ._token ,
480492 )
481493 if movie_counts_get is not None :
482494 environment .movie_counters [str (source )] = count (
@@ -493,6 +505,7 @@ def post_transfer(
493505 base_url = str (environment .url .geturl ()),
494506 router_name = "file_io_instrument.router" ,
495507 function_name = "write_eer_fractionation_file" ,
508+ token = self ._token ,
496509 visit_name = environment .visit ,
497510 session_id = environment .murfey_session ,
498511 data = {
@@ -552,6 +565,7 @@ def post_transfer(
552565 base_url = str (environment .url .geturl ()),
553566 router_name = "workflow.spa_router" ,
554567 function_name = "request_spa_preprocessing" ,
568+ token = self ._token ,
555569 visit_name = environment .visit ,
556570 session_id = environment .murfey_session ,
557571 data = {
0 commit comments