File tree Expand file tree Collapse file tree 4 files changed +16
-15
lines changed
Expand file tree Collapse file tree 4 files changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -567,7 +567,7 @@ def post_transfer(
567567 )
568568 if not environment .movie_counters .get (str (source )):
569569 movie_counts_get = capture_get (
570- f"{ environment .url .geturl ()} { url_path_for ('session_info .router' , 'count_number_of_movies' )} " ,
570+ f"{ environment .url .geturl ()} { url_path_for ('session_control .router' , 'count_number_of_movies' )} " ,
571571 )
572572 if movie_counts_get is not None :
573573 environment .movie_counters [str (source )] = count (
Original file line number Diff line number Diff line change 77from fastapi .responses import FileResponse
88from ispyb .sqlalchemy import AutoProcProgram as ISPyBAutoProcProgram
99from pydantic import BaseModel
10+ from sqlalchemy import func
1011from sqlmodel import select
1112from werkzeug .utils import secure_filename
1213
3940 DataCollectionGroup ,
4041 FoilHole ,
4142 GridSquare ,
43+ Movie ,
4244 ProcessingJob ,
4345 RsyncInstance ,
4446 Session ,
@@ -178,6 +180,14 @@ def register_processing_success_in_ispyb(
178180 _transport_object .do_update_processing_status (updated )
179181
180182
183+ @router .get ("/num_movies" )
184+ def count_number_of_movies (db = murfey_db ) -> Dict [str , int ]:
185+ res = db .exec (
186+ select (Movie .tag , func .count (Movie .murfey_id )).group_by (Movie .tag )
187+ ).all ()
188+ return {r [0 ]: r [1 ] for r in res }
189+
190+
181191class PostInfo (BaseModel ):
182192 url : str
183193 data : dict
Original file line number Diff line number Diff line change 66from fastapi import APIRouter , Depends , Request
77from fastapi .responses import FileResponse , HTMLResponse
88from pydantic import BaseModel
9- from sqlalchemy import func
109from sqlmodel import select
1110from werkzeug .utils import secure_filename
1211
@@ -262,14 +261,6 @@ async def get_clients(db=murfey_db):
262261 return clients
263262
264263
265- @router .get ("/num_movies" )
266- def count_number_of_movies (db = murfey_db ) -> Dict [str , int ]:
267- res = db .exec (
268- select (Movie .tag , func .count (Movie .murfey_id )).group_by (Movie .tag )
269- ).all ()
270- return {r [0 ]: r [1 ] for r in res }
271-
272-
273264class CurrentGainRef (BaseModel ):
274265 path : str
275266
Original file line number Diff line number Diff line change @@ -706,6 +706,11 @@ murfey.server.api.session_control.router:
706706 path_params : []
707707 methods :
708708 - POST
709+ - path : /session_control/num_movies
710+ function : count_number_of_movies
711+ path_params : []
712+ methods :
713+ - GET
709714 - path : /session_control/instruments/{instrument_name}/failed_client_post
710715 function : failed_client_post
711716 path_params :
@@ -921,11 +926,6 @@ murfey.server.api.session_info.router:
921926 path_params : []
922927 methods :
923928 - GET
924- - path : /session_info/num_movies
925- function : count_number_of_movies
926- path_params : []
927- methods :
928- - GET
929929 - path : /session_info/sessions/{session_id}/current_gain_ref
930930 function : update_current_gain_ref
931931 path_params : []
You can’t perform that action at this time.
0 commit comments