Skip to content

Commit

Permalink
further purging of modules
Browse files Browse the repository at this point in the history
  • Loading branch information
bcumming committed Jun 25, 2024
1 parent ceaef61 commit d6bb298
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 67 deletions.
1 change: 0 additions & 1 deletion activate
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ function uenv {
echo " start start a new shell with an environment loaded"
echo " stop stop a shell with an environment loaded"
echo " status print information about each running environment"
echo " modules view module status and activate with 'use'"
echo " view activate a view"
echo " image query and pull uenv images"
echo ""
Expand Down
8 changes: 0 additions & 8 deletions docs/implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@

### Variables set and read by UENV

* `UENV_MODULE_PATH`: a comma separated list of module files that have been loaded.

For example:
```
UENV_MODULE_PATH=/user-environment/modules,/user-tools/modules
UENV_MODULE_PATH=/user-tools/modules
```

* `UENV_VIEW`: the view that has been loaded (only one view can be loaded at a time

```
Expand Down
42 changes: 0 additions & 42 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,45 +69,3 @@ To get the status of all loaded environments:
uenv status
```

### Modules

Uenv can be configured to provide modules, however not all uenv provide modules.
If a uenv provides modules, they are not directly available for querying and accessing using `module avail` or `module load` etc.

To find information about which running uenv provide modules, and whether modules have been activated:

```bash
uenv modules
```

If a loaded uenv provides modules, these can be enabled using the `modules use` command:

```bash
uenv modules use [environments]
```

where `[environments]'` is a list of uenv whose modules are to be made available.

!!! info
If `[environments]` is not provided, the module files from all loaded uenv that provide modules will be made available.

**Example 1**: use the modules provided by `/user-environment`:
```bash
uenv modules use /user-environment
```

**Example 2**: use the modules provided by the loaded uenv with name `gromacs/2023`:
```bash
uenv modules use gromacs/2023
```

**Example 3**: the modules provided by all loaded uenv that provide modules:
```bash
uenv modules use
```

**Example 4**: use the modules provided by the uenv mounted at `/user-tools` and the uenv with name `gromacs/2023`
```bash
uenv modules use gromacs/2023 /user-tools
```

2 changes: 1 addition & 1 deletion lib/envvars.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def update(self, other: 'EnvVarSet'):
# "post": the list of commands to be executed to revert the environment
#
# The "post" list is optional, and should not be used for commands that
# update the environment like "uenv view" and "uenv modules use", instead
# update the environment like "uenv view", instead
# it should be used for commands that should not alter the calling environment,
# like "uenv run" and "uenv start".
#
Expand Down
6 changes: 0 additions & 6 deletions test/commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ echo ==================== stop
uenv stop --help
echo ==================== status
uenv status --help
echo ==================== modules
uenv modules --help

echo
echo ==================== uenv status
Expand All @@ -37,10 +35,6 @@ echo
echo ==================== uenv run --uarch=gh200 prgenv-gnu -- ls /user-environment
time uenv run --uarch=gh200 prgenv-gnu -- ls /user-environment

echo
echo ==================== uenv run --modules prgenv-gnu -- bash -c "module avail; ls /user-environment; module load gcc; gcc --version; which gcc;"
time uenv run --modules prgenv-gnu -- bash -c "module avail; ls /user-environment; module load gcc; gcc --version; which gcc;"

echo
echo ==================== uenv run --view=default prgenv-gnu -- bash -c "which gcc; mpic++ --version; nvcc --version;"
time uenv run --view=default prgenv-gnu -- bash -c "which gcc; mpic++ --version; nvcc --version;"
Expand Down
33 changes: 29 additions & 4 deletions todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ This document outlines a single design for how this should be achieved for all u

Activating a view sets environment variables like `PATH`, `PKG_CONFIG_PATH`, etc.

### Enabling modules

To automatically enable modules, the MODULEPATH variable needs to be prenended.

### Configuration files

We want to support configruation files that specify a uenv, and how the environment should be configured, fo users.
Expand All @@ -32,6 +28,35 @@ Environment modification:
- create a new namespace and mount squashfs images.
- set environment variables using `spank_setenv`, `os.setenv`, etc.

## Design

The current design, a bash function wrapper that `exec`s commands returned by the `uenv-impl` app, supports modifying the environment of the calling shell.
This enables `uenv view x` to "load a view" in the running shell, by modifying environment variables.
Unfortunately, this approach is fragile and complicated.

A more robust design would drop the ability to modify the calling shell's environment.

There would no longer be separate `uenv-impl` ane `uenv-image` commands - these would be merged into a single `uenv` executable that would be called directly on the CLI (instead of indirectly calling them via a bash function).

Modifications to the environment would only be performed via calls to `uenv start` and `uenv run`, each of which starts a new shell.

```
uenv start --view=develop icon
|
|_fork__
|
|
setenv("PATH", ...)
setenv("LD_LIBRARY_PATH", ...)
|
execve(bash)
|
|_fork__
|
|
bash
```

## Features

1. support for scalar and list variables.
Expand Down
5 changes: 0 additions & 5 deletions uenv-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ if [ -n "$UENV_FORWARD_VIEW" ]; then
uenv view $UENV_FORWARD_VIEW
fi

if [ -n "$UENV_FORWARD_MODULES" ]; then
uenv modules use
fi

unset UENV_FORWARD_VIEW
unset UENV_FORWARD_MODULES

exec "$@"

0 comments on commit d6bb298

Please sign in to comment.