Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

submit cumulative redshifts only for lastnight of each tile #1955

Merged
merged 1 commit into from Jan 5, 2023

Conversation

sbailey
Copy link
Contributor

@sbailey sbailey commented Jan 4, 2023

This PR adds support to desi_run_night to submit cumulative redshifts only for tiles for which the current night is the last night that they were observed. This allows them to be tracked in the processing tables (see issue #1952) while not submitting cumulative redshift jobs for nights earlier than the LASTNIGHT for each tile.

I did not implement an option to override this and submit cumulative redshifts for every tile, even if they have future observations (current behavior). The code is already complex from supporting tilenight, non-tilenight, productions, and daily-like "is this the last exposure for this tile or the end of the night?" style logic, and I didn't want to add additional options that we may never use and then feel obligated to support those in any future refactors. If we find we need that functionality, we can add it later.

Tests

I tested on the following nights, to cover several cases:

  • 20211216 - ends with a science exposure
  • 20220602 - ends with a full set of arcs+flats+zeros+darks
  • 20220603 - ends with zeros+darks but the science exposures are the last that would be processed
export DESI_SPECTRO_REDUX=/global/cfs/cdirs/desi/users/sjbailey/spectro/redux
export SPECPROD=zproc
cd $DESI_SPECTRO_REDUX/$SPECPROD
svn checkout https://desi.lbl.gov/svn/data/exposure_tables

desi_run_night --dry-run-level=2 -n 20211216 --z-submit-types pernight,cumulative &> 20211216-submit.log
desi_job_graph -n 20211216
...

The resulting jobgraphs in https://data.desi.lbl.gov/desi/users/sjbailey/spectro/redux/zproc/run/jobgraph/ show that all tiles get perexp redshift jobs, but only some tiles get cumulative redshift jobs. I used code like the following to identify which tiles are supposed to get cumulative jobs:

from desispec.workflow.redshifts import read_minimal_exptables_columns
exps = read_minimal_exptables_columns()

night = 20220603
tiles = np.unique(exps["TILEID"][exps["NIGHT"] == night])
for t in tiles:
    jj = exps["TILEID"] == t
    lastnight = np.max(exps["NIGHT"][jj])
    if lastnight == night:
        print(f"tile {t} - ok to submit")
    else:
        print(f"tile {t} {lastnight=}")

I repeated with desi_run_night --no-use-tilenight ... to make sure that variant of the logic works too.

Copy link
Member

@akremin akremin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks great and the tests are thorough. This will be susceptible to the year-boundary issue outlined in #1943, but will be automatically accounted for when that is resolved, so nothing needs to be done with that here. I will do more testing once this and the PR resolving #1943 are both implemented to ensure we don't have any corner cases that have snuck through. For now I will approve and merge this.

@akremin
Copy link
Member

akremin commented Jan 5, 2023

The failed tests are related to a scipy issue, not an issue with this PR. The tests are now fixed in the daily branch thanks to desihub/desimodel#164 and desispec #1957 , and fixed in main thanks to #1958.

@akremin akremin merged commit 176041b into main Jan 5, 2023
@akremin akremin deleted the ztile_proc branch January 5, 2023 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants