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

support for view and module loading by start and run commands #31

Merged
merged 10 commits into from
Jun 5, 2024

Conversation

bcumming
Copy link
Member

This PR implements support for loading views and making modules available inside an environment via command line arguments to start and run commands.

# start with the view named develop loaded
uenv start --view=develop myenv

# start with modules available
uenv start --modules myenv

# run a command with modules available
uenv run --modules myenv -- bash -c "module load cray-mpich; mpicc test.c"

# run a command with a view loaded
uenv run --view=develop myenv -- mpicc test.c
  • add lib/envvars.py that implements classes that support setting and modifying environment variables.
    • support for scalar variables that take a single value and list variables (e.g. PATH) that are assembled by setting, appending and prepending paths.
    • support for accumulating operations on collections environment variables
    • support
  • instead of sourcing activate.sh when loading a view, the script is parsed and export commands is generated based its contents
    • this allows us to perform operations like overriding or preserving existing list variables
    • in the future this can be used to generate information required to deactivate a view
  • changed the behavior of uenv view to preserve existing values of variables like PATH, LD_LIBRARY_PATH, etc
  • add unit tests for the new environment variable code

@simonpintarelli simonpintarelli self-requested a review June 5, 2024 09:11
Copy link
Member

@simonpintarelli simonpintarelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@bcumming bcumming merged commit 3b5d8f0 into master Jun 5, 2024
4 checks passed
@bcumming bcumming deleted the feature/env-vars branch July 5, 2024 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants