Skip to content

Commit

Permalink
bug fixes to resub and standardize cache cols
Browse files Browse the repository at this point in the history
  • Loading branch information
akremin committed Aug 15, 2024
1 parent a2e5190 commit c3444b8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions py/desispec/workflow/exptable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1079,10 +1079,10 @@ def update_science_etab_cache(etab):
cleaned_etab = _select_sciences_from_etab(etab)
new_nights = np.unique(cleaned_etab['NIGHT'])
log.info(f'Removing all current entries in science exposure '
+ f'table row cache for nights {new_nights}')
+ f'table row cache for nights {list(new_nights)}')
conflicting_entries = np.isin(_science_etab_cache['NIGHT'], new_nights)
log.info(
f"Removing {len(conflicting_entries)} rows and adding {len(cleaned_etab)} rows "
f"Removing {np.sum(conflicting_entries)} rows and adding {len(cleaned_etab)} rows "
+ f"to science exposure table row cache.")
keep = np.bitwise_not(conflicting_entries)
_science_etab_cache = _science_etab_cache[keep]
Expand Down
5 changes: 1 addition & 4 deletions py/desispec/workflow/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ def recursive_submit_failed(rown, proc_table, submits, id_to_row_map, ptab_name=
if resubmission_states is None:
resubmission_states = get_resubmission_states()
ideps = proc_table['INT_DEP_IDS'][rown]
if ideps is None:
if ideps is None or len(ideps)==0:
proc_table['LATEST_DEP_QID'][rown] = np.ndarray(shape=0).astype(int)
else:
all_valid_states = list(resubmission_states.copy())
Expand All @@ -1229,13 +1229,10 @@ def recursive_submit_failed(rown, proc_table, submits, id_to_row_map, ptab_name=
othernight_idep_qid_lookup = {}
for idep in np.sort(np.atleast_1d(ideps)):
if idep not in id_to_row_map:
log.info(idep // 1000)
log.info(row['INTID'] // 1000)
if idep // 1000 != row['INTID'] // 1000:
log.info(f"Internal ID: {idep} not in id_to_row_map. "
+ "This is expected since it's from another day. ")
reference_night = 20000000 + (idep // 1000)
log.info(reference_night)
reftab = read_minimal_full_proctab_cols(nights=[reference_night])
if reftab is None:
msg = f"The dependency is from night={reference_night}" \
Expand Down
8 changes: 4 additions & 4 deletions py/desispec/workflow/proctable.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,14 +549,14 @@ def update_tilenight_ptab_cache(ptab):
log = get_logger()
## If the cache doesn't exist, don't update it.
if _tilenight_ptab_cache is None:
log.debug(f'Science exptab cache does not exist, so not updating')
log.debug(f'Tilenight proctab cache does not exist, so not updating')
return
cleaned_ptab = _select_tilenights_from_ptab(ptab)
new_nights = np.unique(cleaned_ptab['NIGHT'])
log.info(f'Removing all current entries in processing table tilenight '
+ f'selection cache for nights {new_nights}')
+ f'selection cache for nights {list(new_nights)}')
conflicting_entries = np.isin(_tilenight_ptab_cache['NIGHT'], new_nights)
log.info(f"Removing {len(conflicting_entries)} rows and adding "
log.info(f"Removing {np.sum(conflicting_entries)} rows and adding "
+ f"{len(cleaned_ptab)} rows "
+ f"to processing table tilenight cache.")
keep = np.bitwise_not(conflicting_entries)
Expand Down Expand Up @@ -683,6 +683,6 @@ def update_full_ptab_cache(ptab):
t = ptab[_required_full_ptab_cols]
new_nights = np.unique(t['NIGHT'])
log.info(f'Replacing all current entries in processing table '
+ f'cache for nights {new_nights.data}')
+ f'cache for nights {list(new_nights)}')
for night in new_nights:
_full_ptab_cache[night] = t[t['NIGHT'] == night]

0 comments on commit c3444b8

Please sign in to comment.