@@ -30,6 +30,7 @@ def run(
3030 visit_number = message ["visit_number" ],
3131 db = ISPyBSession (),
3232 )
33+
3334 if dcg_murfey := murfey_db .exec (
3435 select (MurfeyDB .DataCollectionGroup )
3536 .where (MurfeyDB .DataCollectionGroup .session_id == message ["session_id" ])
@@ -53,18 +54,17 @@ def run(
5354 dcgid = _transport_object .do_insert_data_collection_group (record ).get (
5455 "return_value" , None
5556 )
57+
5658 atlas_record = ISPyBDB .Atlas (
5759 dataCollectionGroupId = dcgid ,
5860 atlasImage = message .get ("atlas" , "" ),
5961 pixelSize = message .get ("atlas_pixel_size" , 0 ),
6062 cassetteSlot = message .get ("sample" ),
6163 )
62- if _transport_object :
63- atlas_id = _transport_object .do_insert_atlas (atlas_record ).get (
64- "return_value" , None
65- )
66- else :
67- atlas_id = None
64+ atlas_id = _transport_object .do_insert_atlas (atlas_record ).get (
65+ "return_value" , None
66+ )
67+
6868 murfey_dcg = MurfeyDB .DataCollectionGroup (
6969 id = dcgid ,
7070 atlas_id = atlas_id ,
@@ -77,6 +77,7 @@ def run(
7777 murfey_db .add (murfey_dcg )
7878 murfey_db .commit ()
7979 murfey_db .close ()
80+
8081 if dcgid is None :
8182 time .sleep (2 )
8283 logger .error (
@@ -85,6 +86,7 @@ def run(
8586 "Requeuing message"
8687 )
8788 return {"success" : False , "requeue" : True }
89+
8890 if dcg_hooks := entry_points ().select (
8991 group = "murfey.hooks" , name = "data_collection_group"
9092 ):
@@ -93,4 +95,5 @@ def run(
9395 hook .load ()(dcgid , session_id = message ["session_id" ])
9496 except Exception :
9597 logger .error ("Call to data collection group hook failed" , exc_info = True )
98+
9699 return {"success" : True }
0 commit comments