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

Issue #270 spack disable local config #272

Merged
merged 11 commits into from
Apr 15, 2024

Conversation

andrewmogan
Copy link
Contributor

This PR seeks to address Issue #270 by

  1. setting SPACK_DISABLE_LOCAL_CONFIG=true when env.sh is sourced,
  2. doing the same in dbt_create.py when -s is given as an argument,
  3. setting SPACK_USER_CACHE_PATH to the dev environment so that $HOME/.spack/cache isn't created, and
  4. printing warning is printed if $HOME/.spack already exists

@andrewmogan andrewmogan requested a review from ron003 April 11, 2024 18:57
@ron003
Copy link
Collaborator

ron003 commented Apr 12, 2024

I was expecting to see export SPACK_USER_CACHE_PATH=... in
env.sh
As for the value, did you verify that the variable value is the path to the parent dir into which the cache (sub)dir goes? This, as opposed to "the path to the cache" i.e. the name of the actual cache dir is contained in the variable value such that it could be named "apple" for example. I'm guessing the former will be the answer.

SPACK_USER_CACHE_PATH will default to /tmp/$USER/spack (will be created
if it doesn't exist). Once the working area env.sh is sourced, it will
be set to $DBT_AREA_ROOT
…into amogan/issue270_spack_disable_local
@andrewmogan
Copy link
Contributor Author

The reason I didn't initially export SPACK_USER_CACHE_PATH=${DBT_AREA_ROOT} in env.sh is because ${DBT_AREA_ROOT} isn't defined until you source my/daq/area/env.sh, which exports DBT_AREA_ROOT=/my/daq/area. So the new solution is to initially default SPACK_USER_CACHE_PATH to /tmp/$USER/spack (which does create cache under the spack directory, as per your question), and then export SPACK_USER_CACHE_DIR=${DBT_AREA_ROOT} when you run my/daq/area/env.sh. This means that $HOME/.spack is never created by dbt-create -s, but it will still print a warning if that directory exists.

Here's a test that helps illustrate what I mean. I ran this on daq.fnal.gov as myself. After cloning daq-buildtools and checking out this branch,

$ pwd # /nfs/home/amogan
$ env | grep SPACK # Initially empty

$ ls $HOME/.spack # If exists, (re)move it

$ source daq-buildtools/env.sh
$ env | grep SPACK 
SPACK_DISABLE_LOCAL_CONFIG=true
SPACK_USER_CACHE_PATH=/tmp/amogan/spack
$ ls /tmp/$USER/spack # Should be empty or nonexistent

$ dbt-create -s -n NFD_DEV_240411_A9 test_spack_disable_local
$ ls /tmp/$USER/spack # Now has cache subdir
$ ls $HOME/.spack # Should still not exist

$ cd test_spack_disable_local 
$ source env.sh
$ env | grep SPACK
SPACK_DISABLE_LOCAL_CONFIG=true
SPACK_USER_CACHE_PATH=/home/nfs/amogan/test_spack_disable_local
$ ls $HOME/.spack # Still nonexistent 

@ron003
Copy link
Collaborator

ron003 commented Apr 12, 2024 via email

Moved from ${DBT_ROOT}/env.sh to
${DBT_ROOT}/scripts/dbt-install-spack.sh. This prevents unncessary
environment variable exports in the case where dbt-create is called
without -s
@ron003 ron003 merged commit 8d951ca into develop Apr 15, 2024
@ron003 ron003 deleted the amogan/issue270_spack_disable_local branch April 15, 2024 19:02
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