@@ -1169,7 +1169,8 @@ def all_calibs_submitted(accounted_for, do_cte_flats):
1169
1169
def update_and_recursively_submit (proc_table , submits = 0 , max_resubs = 100 ,
1170
1170
resubmission_states = None ,
1171
1171
no_resub_failed = False , ptab_name = None ,
1172
- dry_run_level = 0 , reservation = None ):
1172
+ dry_run_level = 0 , reservation = None ,
1173
+ expids = None , tileids = None ):
1173
1174
"""
1174
1175
Given an processing table, this loops over job rows and resubmits failed jobs (as defined by resubmission_states).
1175
1176
Before submitting a job, it checks the dependencies for failures. If a dependency needs to be resubmitted, it recursively
@@ -1194,6 +1195,8 @@ def update_and_recursively_submit(proc_table, submits=0, max_resubs=100,
1194
1195
4 Doesn't write, submit jobs, or query Slurm.
1195
1196
5 Doesn't write, submit jobs, or query Slurm; instead it makes up the status of the jobs.
1196
1197
reservation: str. The reservation to submit jobs to. If None, it is not submitted to a reservation.
1198
+ expids: list of ints. The exposure ids to resubmit (along with the jobs they depend on).
1199
+ tileids: list of ints. The tile ids to resubmit (along with the jobs they depend on).
1197
1200
1198
1201
Returns:
1199
1202
tuple: A tuple containing:
@@ -1207,6 +1210,17 @@ def update_and_recursively_submit(proc_table, submits=0, max_resubs=100,
1207
1210
This modifies the inputs of both proc_table and submits and returns them.
1208
1211
"""
1209
1212
log = get_logger ()
1213
+ if tileids is not None and expids is not None :
1214
+ msg = f"Provided both expids and tilesids. Please only provide one."
1215
+ log .critical (msg )
1216
+ raise AssertionError (msg )
1217
+ elif tileids is not None :
1218
+ msg = f"Only resubmitting the following tileids and the jobs they depend on: { tileids = } "
1219
+ log .info (msg )
1220
+ elif expids is not None :
1221
+ msg = f"Only resubmitting the following expids and the jobs they depend on: { expids = } "
1222
+ log .info (msg )
1223
+
1210
1224
if resubmission_states is None :
1211
1225
resubmission_states = get_resubmission_states (no_resub_failed = no_resub_failed )
1212
1226
@@ -1219,9 +1233,23 @@ def update_and_recursively_submit(proc_table, submits=0, max_resubs=100,
1219
1233
log .info (np .array (cols ))
1220
1234
for row in proc_table :
1221
1235
log .info (np .array (row [cols ]))
1236
+
1237
+ ## If expids or tileids are given, subselect to the processing table rows
1238
+ ## that included those exposures or tiles otherwise just list all indices
1239
+ ## NOTE: Other rows can still be submitted if the selected rows depend on them
1240
+ ## we hand the entire table to recursive_submit_failed(), which will walk the
1241
+ ## entire dependency tree as necessary.
1242
+ if expids is not None :
1243
+ select_ptab_rows = np .where ([np .any (np .isin (prow_eids , expids )) for prow_eids in proc_table ['EXPID' ]])[0 ]
1244
+ elif tileids is not None :
1245
+ select_ptab_rows = np .where (np .isin (proc_table ['TILEID' ], tileids ))[0 ]
1246
+ else :
1247
+ select_ptab_rows = np .arange (len (proc_table ))
1248
+
1222
1249
log .info ("\n " )
1223
1250
id_to_row_map = {row ['INTID' ]: rown for rown , row in enumerate (proc_table )}
1224
- for rown in range (len (proc_table )):
1251
+ ## Loop over all requested rows and resubmit those that have failed
1252
+ for rown in select_ptab_rows :
1225
1253
if proc_table ['STATUS' ][rown ] in resubmission_states :
1226
1254
proc_table , submits = recursive_submit_failed (rown = rown , proc_table = proc_table ,
1227
1255
submits = submits , max_resubs = max_resubs ,
0 commit comments