1717 MurfeyID ,
1818 MurfeyInstanceEnvironment ,
1919)
20+ from murfey .server .api .file_manip import router as file_manip_router
21+ from murfey .server .api .workflow import router as workflow_router
22+ from murfey .server .api .workflow import tomo_router as workflow_tomo_router
2023from murfey .util .client import (
2124 authorised_requests ,
2225 capture_post ,
@@ -109,7 +112,7 @@ def register_tomography_data_collections(
109112 )
110113 return
111114 try :
112- dcg_url = f"{ str (environment .url .geturl ())} /visits/ { str ( environment .visit ) } / { environment .murfey_session } /register_data_collection_group "
115+ dcg_url = f"{ str (environment .url .geturl ())} { workflow_router . url_path_for ( 'register_dc_group' , visit_name = environment .visit , session_id = environment .murfey_session ) } "
113116 dcg_data = {
114117 "experiment_type" : "tomo" ,
115118 "experiment_type_id" : 36 ,
@@ -121,7 +124,7 @@ def register_tomography_data_collections(
121124
122125 for tilt_series in self ._tilt_series .keys ():
123126 if tilt_series not in self ._tilt_series_with_pjids :
124- dc_url = f"{ str (environment .url .geturl ())} /visits/ { environment .visit } / { environment .murfey_session } /start_data_collection "
127+ dc_url = f"{ str (environment .url .geturl ())} { workflow_router . url_path_for ( 'start_dc' , visit_name = environment .visit , session_id = environment .murfey_session ) } "
125128 dc_data = {
126129 "experiment_type" : "tomography" ,
127130 "file_extension" : file_extension ,
@@ -157,7 +160,7 @@ def register_tomography_data_collections(
157160 )
158161 capture_post (dc_url , json = dc_data )
159162
160- proc_url = f"{ str (environment .url .geturl ())} /visits/ { environment .visit } / { environment .murfey_session } /register_processing_job "
163+ proc_url = f"{ str (environment .url .geturl ())} { workflow_router . url_path_for ( 'register_proc' , visit_name = environment .visit , session_id = environment .murfey_session ) } "
161164 for recipe in ("em-tomo-preprocess" , "em-tomo-align" ):
162165 capture_post (
163166 proc_url ,
@@ -262,7 +265,7 @@ def _add_tilt(
262265 f"Tilt series { tilt_series } was previously thought complete but now { file_path } has been seen"
263266 )
264267 self ._completed_tilt_series .remove (tilt_series )
265- rerun_url = f"{ str (environment .url .geturl ())} /visits/ { environment .visit } /rerun_tilt_series "
268+ rerun_url = f"{ str (environment .url .geturl ())} { workflow_tomo_router . url_path_for ( 'register_tilt_series_for_rerun' , visit_name = environment .visit ) } "
266269 rerun_data = {
267270 "session_id" : environment .murfey_session ,
268271 "tag" : tilt_series ,
@@ -276,7 +279,7 @@ def _add_tilt(
276279 if not self ._tilt_series .get (tilt_series ):
277280 logger .info (f"New tilt series found: { tilt_series } " )
278281 self ._tilt_series [tilt_series ] = [file_path ]
279- ts_url = f"{ str (environment .url .geturl ())} /visits/ { environment .visit } /tilt_series "
282+ ts_url = f"{ str (environment .url .geturl ())} { workflow_tomo_router . url_path_for ( 'register_tile_series' , visit_name = environment .visit ) } "
280283 ts_data = {
281284 "session_id" : environment .murfey_session ,
282285 "tag" : tilt_series ,
@@ -305,7 +308,7 @@ def _add_tilt(
305308 self ._tilt_series [tilt_series ].append (file_path )
306309
307310 if environment :
308- tilt_url = f"{ str (environment .url .geturl ())} /visits/ { environment .visit } / { environment .murfey_session } /tilt "
311+ tilt_url = f"{ str (environment .url .geturl ())} { workflow_tomo_router . url_path_for ( 'register_tilt' , visit_name = environment .visit , session_id = environment .murfey_session ) } "
309312 tilt_data = {
310313 "movie_path" : str (file_transferred_to ),
311314 "tilt_series_tag" : tilt_series ,
@@ -316,7 +319,7 @@ def _add_tilt(
316319 eer_fractionation_file = None
317320 if environment .data_collection_parameters .get ("num_eer_frames" ):
318321 response = requests .post (
319- f"{ str (environment .url .geturl ())} /visits/ { environment .visit } / { environment .murfey_session } /eer_fractionation_file " ,
322+ f"{ str (environment .url .geturl ())} { file_manip_router . url_path_for ( 'write_eer_fractionation_file' , visit_name = environment .visit , session_id = environment .murfey_session ) } " ,
320323 json = {
321324 "num_frames" : environment .data_collection_parameters [
322325 "num_eer_frames"
@@ -331,7 +334,7 @@ def _add_tilt(
331334 },
332335 )
333336 eer_fractionation_file = response .json ()["eer_fractionation_file" ]
334- preproc_url = f"{ str (environment .url .geturl ())} /visits/ { environment .visit } / { environment .murfey_session } /tomography_preprocess "
337+ preproc_url = f"{ str (environment .url .geturl ())} { workflow_tomo_router . url_path_for ( 'request_tomography_preprocessing' , visit_name = environment .visit , session_id = environment .murfey_session ) } "
335338 preproc_data = {
336339 "path" : str (file_transferred_to ),
337340 "description" : "" ,
@@ -491,7 +494,7 @@ def post_transfer(
491494
492495 # Always update the tilt series length in the database after an mdoc
493496 if environment .murfey_session is not None :
494- length_url = f"{ str (environment .url .geturl ())} /sessions/ { environment .murfey_session } /tilt_series_length "
497+ length_url = f"{ str (environment .url .geturl ())} { workflow_tomo_router . url_path_for ( 'register_tile_series_length' , session_id = environment .murfey_session ) } "
495498 capture_post (
496499 length_url ,
497500 json = {
@@ -508,7 +511,7 @@ def post_transfer(
508511 f"The following tilt series are considered complete: { completed_tilts } "
509512 f"after { transferred_file } "
510513 )
511- complete_url = f"{ str (environment .url .geturl ())} /visits/ { environment .visit } / { environment .murfey_session } /completed_tilt_series "
514+ complete_url = f"{ str (environment .url .geturl ())} { workflow_tomo_router . url_path_for ( 'register_completed_tilt_series' , visit_name = environment .visit , session_id = environment .murfey_session ) } "
512515 capture_post (
513516 complete_url ,
514517 json = {
0 commit comments