Skip to content

Commit

Permalink
avoid interactive prompts when updating from an environment.yaml (#727)
Browse files Browse the repository at this point in the history
Working with @taureandyernv yesterday, we tried something like this to patch in a dependency at run time.

```shell
cat > ./environment.yml <<EOF
channels:
- dglteam/label/th23_cu121
dependencies:
- dgl
EOF

docker run \
  --rm \
  -v $(pwd)/environment.yml:/home/rapids/environment.yml \
  -it rapidsai/base:25.02a-cuda12.5-py3.12 \
  conda env export
```

Found that that prompts for confirmation:

```text
  Package           Version  Build    Channel                       Size
──────────────────────────────────────────────────────────────────────────
  Install:
──────────────────────────────────────────────────────────────────────────

  + dgl    2.4.0.th23.cu121  py312_0  dglteam/label/th23_cu121     295MB

  Summary:
  Install: 1 packages
  Total download: 295MB

──────────────────────────────────────────────────────────────────────────

Confirm changes: [Y/n]
```

But that prompt seems not to make it through to `mamba`.

And even if that did work, this interactive prompt prevents the use of the "mount in an `environment.yml`" approach in situations where you aren't running the container interactively... for example, where you want to use this image in a container in a Kubernetes Pod, and provide an `environment.yml` via a ConfigMap or file Secret.

This proposes skipping the confirmation and always running `mamba env update -y` when an `environment.yml` is provided.

## Notes for Reviewers

### How I tested this

Pulled an image built from this PR and confirmed that that install pattern described above works and does not prompt for interactive input.

```shell
cat > ./environment.yml <<EOF
channels:
- dglteam/label/th23_cu121
dependencies:
- dgl
EOF

docker run \
  --rm \
  -v $(pwd)/environment.yml:/home/rapids/environment.yml \
  -it rapidsai/staging:docker-727-25.02a-cuda12.5-py3.12 \
  conda env export
```

```text
...
  - dgl=2.4.0.th23.cu121=py312_0
...
```

Authors:
  - James Lamb (https://github.com/jameslamb)
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - Bradley Dice (https://github.com/bdice)

URL: #727
  • Loading branch information
jameslamb authored Feb 3, 2025
1 parent 3f8cea7 commit edcacd1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion context/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ EOF

if [ -e "/home/rapids/environment.yml" ]; then
echo "environment.yml found. Installing packages."
timeout ${CONDA_TIMEOUT:-600} mamba env update -n base -f /home/rapids/environment.yml || exit $?
timeout ${CONDA_TIMEOUT:-600} mamba env update -n base -y -f /home/rapids/environment.yml || exit $?
fi

if [ "$EXTRA_CONDA_PACKAGES" ]; then
Expand Down
2 changes: 1 addition & 1 deletion context/test_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
'cuspatial/nyc_taxi_years_correlation.ipynb',
# context on skip zipcodes: https://github.com/rapidsai/cuspatial/issues/1426
'cuspatial/ZipCodes_Stops_PiP_cuSpatial.ipynb',
# context on this being skipped: https://github.com/rapidsai/docker/pull/728#issuecomment-2631146036
# context on this being skipped: https://github.com/rapidsai/docker/issues/726
'cuspatial/trajectory_clustering.ipynb',
]

Expand Down

0 comments on commit edcacd1

Please sign in to comment.