desihub / desispec

DESI spectral pipeline
BSD 3-Clause "New" or "Revised" License
36 stars 24 forks source link

nightqa crashes because it can't find a tile in surveyops tiles-*.ecsv file #2357

Closed akremin closed 1 week ago

akremin commented 1 week ago

Nightqa is crashing because it assumes a tile should be in a tiles*.ecsv file but isn't. We should investigate whether the code or ecsv file is correct here. In any case, it may also help to have this be a non-fatal error (especially for an 80000 series tile from sv2).

ERROR:tile_qa_plot.py:1146:get_tilecov: no TILEID=81099 found in /global/cfs/cdirs/desi/survey/ops/surveyops/tags/2.0/ops/tiles-sv2.ecsv
Traceback (most recent call last):
  File "/global/common/software/desi/perlmutter/desiconda/20240425-2.2.0/code/desispec/0.66.2/bin/desi_night_qa", line 210, in <module>
    main()
  File "/global/common/software/desi/perlmutter/desiconda/20240425-2.2.0/code/desispec/0.66.2/bin/desi_night_qa", line 192, in main
    create_petalnz_pdf(outfns["petalnz"], args.night, args.prod, unq_tileids, unq_surveys, dchi2_threshold=25,
  File "/global/common/software/desi/perlmutter/desiconda/20240425-2.2.0/code/desispec/0.66.2/lib/python3.10/site-packages/desispec/night_qa.py", line 1796, in create_petalnz_pdf
    _, pix_ntilecovs, _, _, _ = get_tilecov(tileid, surveys=survey, programs=faprgrm.upper(), lastnight=night)
  File "/global/common/software/desi/perlmutter/desiconda/20240425-2.2.0/code/desispec/0.66.2/lib/python3.10/site-packages/desispec/tile_qa_plot.py", line 1147, in get_tilecov
    raise ValueError(msg)
ValueError: no TILEID=81099 found in /global/cfs/cdirs/desi/survey/ops/surveyops/tags/2.0/ops/tiles-sv2.ecsv

Log: /global/cfs/cdirs/desi/spectro/redux/kibo/run/scripts/tsnr_nightqa/logs/nightqa-kibo-20210511.log

Script: /global/cfs/cdirs/desi/spectro/redux/kibo/run/scripts/tsnr_nightqa/scripts/nightqa-kibo-20210511.slurm

Command: desi_night_qa --nproc=64 --recompute -p kibo -n 20210511 -o /global/cfs/cdirs/desi/spectro/redux/kibo/nightqa/20210511

araichoor commented 1 week ago

from a quick digging:

araichoor commented 1 week ago

code-wise: I ll have a look with fresh brains tomorrow, but I see that the error is in the create_petalnz_pdf() function. in the current code, are only considered in that function tiles from: sv1, sv2, sv3, main. an easy / reasonable fix could be to just remove sv2 from that list, as sv2 really was more for operational tests, no science tests, if I remember correctly. (for instance, here, the crash is in the function get_tilecov(), which is used for the lya-diagnosis).

akremin commented 1 week ago

Would it be possible to check if the tile is in the file and if not raise a Warning but otherwise proceed without that specific tile?

araichoor commented 1 week ago

sure I could do that. that s a bit "less disruptive", even if I m pretty sure those petalnz_pdf diagnoses are useless for sv2... I ll code that up, with the code reading the $DESI_SURVEYOPS/ops folder (ie trunk in the daily operations; maybe some tagged version for e.g. kibo).

akremin commented 1 week ago

Resolved with Pull Request #2361