3535from pioreactor .pubsub import post_into
3636from pioreactor .structs import CalibrationBase
3737from pioreactor .structs import Dataset
38+ from pioreactor .utils .networking import is_using_local_access_point
3839from pioreactor .utils .networking import resolve_to_address
3940from pioreactor .utils .timing import current_utc_datetime
4041from pioreactor .utils .timing import current_utc_timestamp
@@ -197,8 +198,12 @@ def get_models() -> ResponseReturnValue:
197198 "/workers/<pioreactor_unit>/jobs/stop/experiments/<experiment>" ,
198199 methods = ["POST" , "PATCH" ],
199200)
200- def stop_all_jobs_on_worker_for_experiment (pioreactor_unit : str , experiment : str ) -> ResponseReturnValue :
201- """Kills all jobs for worker assigned to experiment"""
201+ @api_bp .route (
202+ "/units/<pioreactor_unit>/jobs/stop/experiments/<experiment>" ,
203+ methods = ["POST" , "PATCH" ],
204+ )
205+ def stop_all_jobs_on_unit_for_experiment (pioreactor_unit : str , experiment : str ) -> ResponseReturnValue :
206+ """Kills all jobs for worker or unit assigned to experiment"""
202207 if pioreactor_unit == UNIVERSAL_IDENTIFIER :
203208 broadcast_post_across_cluster ("/unit_api/jobs/stop" , json = {"experiment" : experiment })
204209 else :
@@ -2716,17 +2721,18 @@ def get_historical_config_for(filename: str) -> ResponseReturnValue:
27162721 return attach_cache_control (jsonify (configs_for_filename ), max_age = 15 )
27172722
27182723
2719- @api_bp .route ("/is_local_access_point_active " , methods = ["GET" ])
2720- def is_local_access_point_active () -> ResponseReturnValue :
2724+ @api_bp .route ("/local_access_point " , methods = ["GET" ])
2725+ def get_local_access_point () -> ResponseReturnValue :
27212726 return attach_cache_control (
2722- jsonify ({"result" : os .path .isfile ("/boot/firmware/local_access_point" )}), max_age = 10_000
2727+ jsonify ({"active" : is_using_local_access_point ()}),
2728+ max_age = 10_000 ,
27232729 )
27242730
27252731
27262732### experiment profiles
27272733
27282734
2729- @api_bp .route ("/experiment_profiles/running/ experiments/<experiment>" , methods = ["GET" ])
2735+ @api_bp .route ("/experiments/<experiment>/experiment_profiles/running " , methods = ["GET" ])
27302736def get_running_profiles (experiment : str ) -> ResponseReturnValue :
27312737 jobs = query_temp_local_metadata_db (
27322738 """
@@ -2771,7 +2777,7 @@ def get_recent_experiment_profile_runs(experiment: str) -> ResponseReturnValue:
27712777 return attach_cache_control (jsonify (recent_runs ), max_age = 5 )
27722778
27732779
2774- @api_bp .route ("/contrib/ experiment_profiles" , methods = ["POST" ])
2780+ @api_bp .route ("/experiment_profiles" , methods = ["POST" ])
27752781def create_experiment_profile () -> ResponseReturnValue :
27762782 body = request .get_json ()
27772783 experiment_profile_body = body ["body" ]
@@ -2815,11 +2821,11 @@ def create_experiment_profile() -> ResponseReturnValue:
28152821 return {"status" : "success" }, 200
28162822
28172823
2818- @api_bp .route ("/contrib/ experiment_profiles" , methods = ["PATCH" ])
2819- def update_experiment_profile () -> ResponseReturnValue :
2824+ @api_bp .route ("/experiment_profiles/<filename> " , methods = ["PATCH" ])
2825+ def update_experiment_profile (filename : str ) -> ResponseReturnValue :
28202826 body = request .get_json ()
28212827 experiment_profile_body = body ["body" ]
2822- experiment_profile_filename = Path (body [ " filename" ] ).name
2828+ experiment_profile_filename = Path (filename ).name
28232829
28242830 # verify content
28252831 try :
@@ -2853,7 +2859,7 @@ def update_experiment_profile() -> ResponseReturnValue:
28532859 return {"status" : "success" }, 200
28542860
28552861
2856- @api_bp .route ("/contrib/ experiment_profiles" , methods = ["GET" ])
2862+ @api_bp .route ("/experiment_profiles" , methods = ["GET" ])
28572863def get_experiment_profiles () -> ResponseReturnValue :
28582864 try :
28592865 profile_path = Path (os .environ ["DOT_PIOREACTOR" ]) / "experiment_profiles"
@@ -2890,7 +2896,7 @@ def get_experiment_profiles() -> ResponseReturnValue:
28902896 abort_with (400 , str (e ))
28912897
28922898
2893- @api_bp .route ("/contrib/ experiment_profiles/<filename>" , methods = ["GET" ])
2899+ @api_bp .route ("/experiment_profiles/<filename>" , methods = ["GET" ])
28942900def get_experiment_profile (filename : str ) -> ResponseReturnValue :
28952901 file = Path (filename ).name
28962902 try :
@@ -2908,7 +2914,7 @@ def get_experiment_profile(filename: str) -> ResponseReturnValue:
29082914 abort_with (404 , str (e ))
29092915
29102916
2911- @api_bp .route ("/contrib/ experiment_profiles/<filename>" , methods = ["DELETE" ])
2917+ @api_bp .route ("/experiment_profiles/<filename>" , methods = ["DELETE" ])
29122918def delete_experiment_profile (filename : str ) -> ResponseReturnValue :
29132919 file = Path (filename ).name
29142920 try :
0 commit comments