-
Notifications
You must be signed in to change notification settings - Fork 33
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 xenon_secrets with utilix config file #163
Conversation
Hi Evan, thanks for the proposal. A couple of ideas:
|
Hi Joran,
Does this answer your questions? |
On the other hand keeping it as a backup option wouldn't be a bad idea.
Yeah sorry it's some edge case I ran into I fixed with the xenon-sectrets but adding a ~/.xenon_config seems similar to the xenon_secrets so that sounds like it work, guess would have to try.
OK, I also just looked very briefly and saw that the secondary was preferred which is readonly usually right? I guess I'd be nice to add the required kwargs into this part of the straxen RunDB.py but this would presumably be one of those things we could fix if people agree on your proposal. |
I will test some of these things more thoroughly and get back to Joran (also with more examples etc). I will be mostly offline for the next ~ week or more so it might be a bit. Thanks for the comments! |
I would like to revive this PR, as this change is important for any future reprocessing campaign. There are two main goals here:
@jorana thoughts? Not sure I addressed your concerns from before or not. |
Maybe I should add that, to make this work, one needs a xenon_config file of the following syntax:
This is what is replacing the xenon_secrets file. When you enter a singularity container on midway, by default the config loaded is in a file called xenon.config, in same place as current xenon_secrets file. But if you are running somewhere else (DAQ machines, e.g.) you will need to create your own config file. |
Now added GitHub actions to automatically update the context collection of the RunDB whenever there is a new straxen release. I've tested a slightly different version of this with my personal fork of utilix but have not tested this exact one. |
@ershockley , let me know when this is ready for review by 'un-drafting' the PR. |
Wouldn't this be easy to do with the corrections system? This could be for strax settings beyond physics. @ahiguera-mx thoughts? |
@tunnell I don't understand what you mean, sorry. This change would replace e.g. how straxen sets up the runDB, which is needed to access correction system in the first place right? |
straxen/common.py
Outdated
raise ValueError(message + " and the secret is not in xenon_secrets.py") | ||
except: | ||
message += (f"nor was there a valid field in your utilix configuration file, ") | ||
raise | ||
|
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.
Are not you missing here something after the raise?
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.
Yes thanks!
@jorana I just tested on midway and using all 3 works fine
I do remember you had issues, but I think that was on your personal machine? Not sure we ever figured out what was causing that, but in general having all three is not a problem, I don't think. |
Yes, it was when you were on any location that was not dali, fried rice or LNGS (I think). We could not determine which was primary because none was. At the moment it's fine because all the databases are up (also on my machine). |
@jorana Sorry we're working on two repos at once which is making things unstable. To satisfy travis we need to be able to import straxen and do basic tests without a valid config file. If we merge utilix #8 then the most recent changes should work, I think. This will have utilix throw an error, but straxen does try-except to circumvent it. |
If one ever runs into problems using three mirrors. Please replace: In the config file |
This should not be merged yet
This PR is a proposal to replace the xenon_secrets python file with the configuration file handled by utilix. This is helpful for running strax on e.g. OSG or anywhere else where a xenon_secrets.py file might not be present. I also prefer this type of text file configuration, which one could modify and/or have multiple copies of in case you want to change anything (e.g. I have a 1T config and an nT one, and just need to change XENON_CONFIG env variable to switch between the two).
In addition, it uses the utilix wrapper around pymongo, which increases readability and centralizes the runDB stuff.
I'm still testing some things, but wanted to get people's thoughts on something like this. If we don't want to go this route I need a different solution for OSG.
As an example, my utilix config file now looks like this (removing the actual content to be overly cautious)
In this way we can combine configuration of many things into a single file. For more info on utilix config, see here.
This should not be merged yet