@@ -127,7 +127,10 @@ def sanity_check(flux: tuple, spatial_extent: tuple,
127
127
128
128
129
129
async def match_merge_detections (conn , run : Run , instance : Instance , cwd : str ):
130
+ """The database connection remains open for the duration of this
131
+ process of merging and matching detections.
130
132
133
+ """
131
134
input_fits = instance .params ['input.data' ]
132
135
output_dir = instance .params ['output.directory' ]
133
136
@@ -275,21 +278,16 @@ async def match_merge_detections(conn, run: Run, instance: Instance, cwd: str):
275
278
f"Not Resolved, Name: { detect_dict ['name' ]} \
276
279
Details: Setting to unresolved"
277
280
)
278
- # Create tasks that are awaited upon together
279
- insert_task = db_detection_insert (
281
+ await db_detection_insert (
280
282
conn , run .run_id , instance .instance_id , detect_dict ,
281
283
cube_bytes , mask_bytes , mom0_bytes , mom1_bytes ,
282
284
mom2_bytes , chan_bytes , spec_bytes , True
283
285
)
284
- update_detection_task = db_update_detection_unresolved (
286
+ await db_update_detection_unresolved (
285
287
conn ,
286
288
True ,
287
289
[i ['id' ] for i in result ]
288
290
)
289
- await asyncio .gather (
290
- insert_task ,
291
- update_detection_task
292
- )
293
291
294
292
295
293
async def run_merge (config , run_name , param_list , sanity ):
0 commit comments