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

DETECTOR is not deprecated, but serves different purpose than DETECTOR_CONFIG #290

Closed
wdconinc opened this issue Oct 27, 2022 · 8 comments · Fixed by #1232
Closed

DETECTOR is not deprecated, but serves different purpose than DETECTOR_CONFIG #290

wdconinc opened this issue Oct 27, 2022 · 8 comments · Fixed by #1232
Labels
part:logging What goes to log and output part:services Core services and functionality

Comments

@wdconinc
Copy link
Contributor

In https://github.com/eic/EICrecon/blob/main/src/services/geometry/dd4hep/JDD4hep_service.cc#L66 eicrecon generates the warning

[WARN] DETECTOR environment variable is deprecated. Use DETECTOR_CONFIG instead

even when DETECTOR_CONFIG is defined (that's only checked later).

This is somewhat misleading since DETECTOR_CONFIG is what defines the detector configuration (e.g. epic_arches, epic_tracking_only) under a specific DETECTOR description (e.g. epic). The DETECTOR_CONFIG starts with DETECTOR.

This means that DETECTOR is not deprecated. It just isn't the variable that should be used to pass the configuration to use.

@DraTeots
Copy link
Contributor

Is there any place where those collaboration global variables are described?

Because previously in our documentation was written that one sets "DETECTOR" environment variable such as epic_arches . And then it was said that instead of DETECTOR environment variable DETECTOR_CONFIG should be used. In order to make smooth transition for scripts I made a deprecation warning for using DETECTOR env as epic_arches and suggested that DETECTOR_CONFIG should be used. In terms of EICrecon it is a deprecation.

@DraTeots
Copy link
Contributor

Lets kind of define what is the expected behavior

Now we have this in documentation

https://eic.github.io/EICrecon/#/design/common_flags_env?id=environment-variables

@DraTeots
Copy link
Contributor

Is there any place where those collaboration global variables are described?

@wdconinc If you list it here it will also work

@DraTeots
Copy link
Contributor

DraTeots commented Nov 6, 2022

@wdconinc bump

@wdconinc
Copy link
Contributor Author

wdconinc commented Nov 6, 2022

You should not rely on hardcoded names of environment variables to pass the geometry but you should use the value of a parameter for a plugin (-Pdd4hep:geometry=/path/to/detector/geometry.xml). It should not matter to EICrecon what convention is used in the epic repository. Any convention in that repository is a local convention and will not extend to other geometry repositories. Relying on that convention is reintroducing a dependency that we worked to remove early on.

@DraTeots
Copy link
Contributor

DraTeots commented Nov 6, 2022

That, I believe, needs to be passed to @faustus123 as he had a very strong argument, that in general -Pdd4hep:geometry=/path/to/detector/geometry.xml shouldn't be passed EVERY eicrecon run especially as this value most of the time is not changing. It is bad from users perspective, if every time, they call eicrecon, they should type in -Pdd4hep:geometry=/path/to/detector/geometry.xml.

At the same time, -Pdd4hep:geometry has priority. So if it is given, it is used independently on what is there in environment.

As of my opinion on this, I was strongly on your side (@wdconinc) in the beginning, but after speaking with David and thinking changed my mind. The decision, to use environment variables to set default values as this would cover 99% cases - is balanced between users conveniece and public interface goodness.

But you are correct, that Any convention in that repository is a local convention and will not extend to other geometry repositories so we could think of changing it to something Eicrecon or domain specific like:

EICRECON_DD4HEP_DETECTOR_PATH
EICRECON_DD4HEP_DETECTOR_CONFIG

Or if we will split EICrecon to some generic parts + EIC part, that could be this generic part thing. Better to have a convention ready then for such things.

P.S. What I concern more of, is that I believe having WHATEVER_DETECTOR_CONFIG without extension (.xml) is confusing. It would be better to have a full path only.

@faustus123
Copy link
Contributor

It looks like the printed warning with the misleading "deprecated" statement was removed in PR#293 11 days ago. I'm going to close this as an issue for now and suggest any further discussion be brought up in another forum since it is much broader than this one piece of code.

@wdconinc
Copy link
Contributor Author

wdconinc commented Nov 7, 2022

In 0.3.4 currently in eic-shell there are still references to DETECTOR alongside DETECTOR_CONFIG:

ERROR: file: /opt/local/share/epic/epic.xml does not exist!
Check that your DETECTOR and DETECTOR_CONFIG environment variables are set correctly.

@wdconinc wdconinc reopened this Nov 7, 2022
@DraTeots DraTeots added part:services Core services and functionality meta:QuickFix! part:logging What goes to log and output labels Mar 6, 2023
@wdconinc wdconinc linked a pull request Jan 14, 2024 that will close this issue
7 tasks
github-merge-queue bot pushed a commit that referenced this issue Jan 14, 2024
### Briefly, what does this PR introduce?
This PR removes some remaining references to the environment variable
DETECTOR, which is not used and should not be referred to.

### What kind of change does this PR introduce?
- [x] Bug fix (issue #290)
- [ ] New feature (issue #__)
- [ ] Documentation update
- [ ] Other: __

### Please check if this PR fulfills the following:
- [ ] Tests for the changes have been added
- [ ] Documentation has been added / updated
- [ ] Changes have been communicated to collaborators

### Does this PR introduce breaking changes? What changes might users
need to make to their code?
No.

### Does this PR change default behavior?
No.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part:logging What goes to log and output part:services Core services and functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants