-
Notifications
You must be signed in to change notification settings - Fork 24
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
Replace hard-coded paths with environment variables #2294
Conversation
To emphasize the WIP status as a warning to my future self: this requires updates to desimodules to define $DESI_TILES before it will work, and there are other places that also reference trunk that have not yet been updated (e.g. desispec.io.fibermap.assemble_fibermap). But in the spirit of WIP, the basic structure of |
@sbailey, while working on this, I noticed that fiberassign file names are specified in multiple ways e.g. |
Good point. Best would be to add a new filetype entry to |
OK, and while working on if isinstance(tile, str): tile = int(night) |
Indeed, that whole block was introduced (by me!) in PR #1931 and is a cut-and-paste typo on multiple lines: #- be robust to str vs. int
if isinstance(healpix, str): healpix = int(healpix)
if isinstance(night, str): night = int(night)
if isinstance(expid, str): expid = int(night)
if isinstance(tile, str): tile = int(night)
if isinstance(spectrograph, str): spectrogrpah = int(night) Note the "spectrogrpah" typo as well. @weaverba137 would you like me to fix these in a separate PR (with tests!) or will you fix it in your current branch? |
I will do a minimal fix on this branch, but let's think about a separate PR to do more robust unit tests on In addition, I think a future policy for all PRs should be "if you are trying to create a file name, you must use |
I'm moving this out of draft status. @sbailey, please review this listing of 'trunk' occurrences. I believe these files can be ignored:
I'm not sure about these, because a URL is being constructed instead of a filename:
These files have been updated:
|
The procdashboards are used frequently and so a refactor is welcome, but I
also think it is okay to leave as-is since it is a special case where it
constructs a url. If you want, you are welcome to update the logic so that
it uses findfile for the relative path and then creates the url based on
that. But I'm also fine with leaving it. These files aren't moving anytime
soon, so keeping the dashboard code as-is is very low risk.
…On Wed, Jul 17, 2024, 11:02 PM Benjamin Alan Weaver < ***@***.***> wrote:
I'm moving this out of draft status.
@sbailey <https://github.com/sbailey>, please review this listing of
'trunk' occurrences
<https://github.com/search?q=repo%3Adesihub%2Fdesispec+trunk+NOT+trunk_py+NOT+language%3A%22Jupyter+Notebook%22+NOT+path%3Adoc&type=code>.
I believe these files can be ignored:
1. etc/cron_dailytest.sh
2. etc/desi_nersc_pipetest.py
3. py/desispec/database/redshift.py (the entire database directory is
deprecated anyway)
4. py/desispec/test/test_photo.py
5. py/desispec/test/integration_test.py
I'm not sure about these, because a URL is being constructed instead of a
filename:
6. py/desispec/scripts/procdashboard.py
7. py/desispec/scripts/zprocdashboard.py
These files have been updated:
8. py/desispec/io/photo.py
9. bin/desi_tile_qa_reference
10. py/desispec/io/fibermap.py
11. py/desispec/workflow/exptable.py
12. py/desispec/scripts/archive_night.py
—
Reply to this email directly, view it on GitHub
<#2294 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACBM5O3O4F43RPC3ZGOVJETZM3LXPAVCNFSM6AAAAABK7HYDRGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZUGI4DANJWGU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I can't add comments directly to this line item:
I'm not entirely sure what you're recommending here. Maybe you could express this as a code snippet? However, I now realize that the way |
Thinking about it more, let's just go all-in on making $FIBER_ASSIGN_DIR a required variable for standard operations, and not try to support an interim period where it might not be defined, since desimodules/main already defines it. Heads up @sybenzvi, when you update desispec at KPNO, you'll also need to make sure that module files / config gets set to define FIBER_ASSIGN_DIR=$DESI_TARGET/fiberassign/tiles/trunk .
We're ok here. You added if tiles_dir is None and 'tiles_dir' in required_inputs:
tiles_dir = os.environ['FIBER_ASSIGN_DIR'] which means that $FIBER_ASSIGN_DIR is only required if tiles_dir is not specified, which is good. We'll require $FIBER_ASSIGN_DIR for normal operations, but if for whatever reason someone is running without it, Summarizing, I think we want the if allow_svn_override:
testfile, svn_exists = findfile('fiberassignsvn', tile=tileid, readonly=True, return_exists=True)
if svn_exists:
fafile = testfile
log.info(f'Overriding raw fiberassign file {rawfafile} with svn {fafile}')
else:
log.info(f'{testfile}[.gz] not found; sticking with raw data fiberassign file') i.e. findfile will require $FIBER_ASSIGN_DIR to exist and raise a KeyError if it doesn't, and this code handles the case where findfile works but the tile hasn't yet been committed to svn (svn_exists=False). |
@sbailey, I've made the requested changes, except for the open question about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for iterating on all the details.
For the record: I have installed this updated version at NERSC |
This PR fixes #2272.
This PR introduces a new environment variable,
DESI_TILES
, similar toDESI_SURVEYOPS
and also usesDESI_SURVEYOPS
more extensively.DESI_TILES
will be defined in desimodules (as a fix to desihub/desimodules#49).