-
Notifications
You must be signed in to change notification settings - Fork 16
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
[Discussion] Refactor ldmx-env.sh
to use denv
for container interaction
#1232
Comments
HUGE
Neat
I think for most things having the environment variables passed in would be nice (how does it handle conflicts? I'm especially thinking about LD_LIBRARY_PATH and all the G4_WHATEVER variables. However, I do actually like the ability to "toggle" things that only end up affecting the container environment. Is this still possible somehow?
I don't think installing another dependency is a big problem w.r.t. having to build something. I could imagine some people being queezy about encouraging curl | sh, especially on things like clusters (I'm a bit ambivalent). I do think it will be a bit harder to teach "run denv command" rather than "run ldmx command", especially for people that aren't familiar with the technical side of things. It is a bit silly but it is a lot easier for people to grok that "oh when I'm working on ldmx things I put ldmx in front of the things" than "i need to use denv". Would it be possible to have some kind of setup with ldmx-sw/scripts/ldmx-env.sh that uses denv but calls it through something called ldmx? I am not kidding, I genuinely think this would be valuable
Could you elaborate? What do you mean with workspace? And what do you mean with home-directory?
|
The current strategy is simply to overwrite container-internal env-vars with host env-vars. This is the choice made by the singularity/apptainer container runner family and so I adopted it. The docker/podman also makes this choice but since you have to specify each env-var for the container-running command, there aren't as many conflicts. I could forsee a strategy where
I initially avoided this due to its complexity but I don't think it would be too difficult to implement.
This was my plan actually.
"Workspace" is just my short-hand for "that directory on your system that holds all the crap you are working on". Right now, the environment variable |
Right ok, so you mean that inside the container environment whatever you put as your workspace will be treated as $HOME. That seems reasonable to me for a whole bunch of reasons. When it comes to environment variables/overriding I think it is worth to be careful with. I recently lost an annoying number of hours having to debug something that was caused by LD_LIBRARY_PATH pointing somewhere surprising... I think that it is a safe assumption that any thing that someone might put in an environment variable no matter how unreasonable some user will have a good reason for why they needed That One Weird Thing (www.hyrumslaw.com example?) so being able to handle things is important |
Mmm yeah, this mixing of local and container variables actually makes me a little uneasy. Not just that it's a time sink to confuse them but also that it messes with reproducibility (and trouble shooting/debugging support). Are there ways around this? Any handy tools we can set up to print env variables, or warnings when a local env variable overrides the one in the container, or similar? The other part, about adding dependencies. For me this is usually not really a matter of bloating the container (maybe I should be more concerned with that) but more a matter of depending on something that will invariably change while we are using it. Outsourcing work is nice while it lasts but inevitably comes with having to take a leap now and then, and having handed off control over features to someone else. So I always think it's a matter of understanding which approach will be harder to maintain in the long run. I will err on the side of stability over convenience (which I know is not everyone's preference, and I think that's great, then we might strike a healthy balance). And admittedly this adds a touch of tealeaf reading to the decision workflow (what will development look like in five years?). Ok. Grumpy old physics coder comment done. Will be happy to learn why I shouldn't worry. |
Ok after trying things out a bit for actual work I have some thoughts
> denv
> fire myconfig.py
# Realise there was a typo in myconfig.py
> vim myconfig.py
zsh: command not found: vim which is quite painful. I get that you can run it like
|
There are many ways around this and I think the most stable solution is to put better env-var handling into One can use
Since you mentioned bloating the container, I want to emphasize that this would not be a new dependency in the container. It would be outside the container and thus would need to be installed separately like docker/apptainer. Since
There is nothing stopping us (on the
|
I've updated
This would copy the value of |
I've started a branch 1232-use-denv-in-ldmx-env beginning this refactor. I think the most intricate part is designing a smooth transition. I don't think replicating all of the sub-commands of
I find this a helpful goal so that people know they are using The largest separation between how Draft RoadmapThis first roadmap draft is mainly focused on moving fast and breaking everyone's set up after documenting how they could do the same tasks with the new ecosystem. We could insert some extra steps by (for example) adding deprecation/removal warnings to
Explanations for RemovalsAll of the
|
Using denv instead of the bash functions currently in ldmx-env.sh has several benefits and disadvantages.
Benefits
bash
requirement on ldmx-env.sh, supporting other POSIX-compliant shells..denv/config
) which we could distribute within our repository..denv/config
in ldmx-sw since some users of denv will want to include additional mounting paths corresponding to data locations at their clusters and that would incur a breaking change for many workflows..bashrc
work. ldmx-env.sh can spawn a shell but does not do this remapping and does not update the prompt.setenv
-style commandDisadvantages
PATH
..denv/config
within ldmx-sw unless we make the breaking change of moving the workspace to be ldmx-sw and not its parent.setenv
-style command isolating environment variables inside the container from outside the containerPATH
s setup correctly.The text was updated successfully, but these errors were encountered: