DUNE-DAQ / daq-buildtools

Make life for developers easier through a collection of CMake functions and scripts
0 stars 1 forks source link

Issue #270 spack disable local config #272

Closed andrewmogan closed 7 months ago

andrewmogan commented 7 months ago

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
ron003 commented 7 months ago

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.

andrewmogan commented 7 months ago

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 commented 7 months ago

I'm confused by: source daq-buildtools/env.sh

--Ron

On Fri, 2024-04-12 at 11:20 -0700, Andrew Mogan wrote:

[EXTERNAL] – This message is from an external sender

The reason I didn't initially export SPACK_USER_CACHE_PATH=${DBT_AREA_ROOT} inenv.sh is because ${DBT_AREA_ROOT} isn't defined until you sourcemy/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 createcache under the spack directory, as per your question), and then exportSPACK_USER_CACHE_DIR=${DBT_AREA_ROOT} when you runmy/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

— Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_DUNE-2DDAQ_daq-2Dbuildtools_pull_272-23issuecomment-2D2052250322&d=DwMFaQ&c=gRgGjJ3BkIsb5y6s49QqsA&r=7KXkqf0bzyUQv15jBKEcHw&m=olHZxZo7TAFT78vQHcjNcfsp7sm4fR_crMpuZw_jq1vFn0Qijjib-wb91VeXEBYQ&s=EGvD5sbfpIov49RhPIfPy853fGwIye-XZHX-tNxFxh4&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AGH7VZW7J7WJCCDBZCXLGTDY5AQXRAVCNFSM6AAAAABGC2ZRHCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJSGI2TAMZSGI&d=DwMFaQ&c=gRgGjJ3BkIsb5y6s49QqsA&r=7KXkqf0bzyUQv15jBKEcHw&m=olHZxZo7TAFT78vQHcjNcfsp7sm4fR_crMpuZw_jq1vFn0Qijjib-wb91VeXEBYQ&s=BzRLDDbXBpwQhL34eMgPqYv39RUH5Cn5rftE01h1HDs&e=. You are receiving this because your review was requested.Message ID: @.***>

--

Ron Rechenmacher Engineer, Tools and Advanced Computing Fermi National Accelerator Laboratory Batavia, IL 60510