diff --git a/modulefiles/wflow_linux.lua b/modulefiles/wflow_linux.lua index dd9aec7afa..6c4cc6949d 100644 --- a/modulefiles/wflow_linux.lua +++ b/modulefiles/wflow_linux.lua @@ -5,16 +5,35 @@ This module sets a path to activate conda environment needed for running the UFS whatis([===[This module sets a path for conda environment needed for running the UFS SRW App on Linux]===]) setenv("CMAKE_Platform", "linux") -setenv("VENV", pathJoin(os.getenv("HOME"), "condaenv/envs/regional_workflow")) ---[[ -local ROCOTOmod="/Users/username/modules" -prepend_path("MODULEPATH", ROCOTOmod) -load(rocoto) ---]] +-- Conda initialization function +function init_conda(conda_path) + local shell=myShellType() + local conda_file + if shell == "csh" then + conda_file=pathJoin(conda_path,"etc/profile.d/conda.csh") + else + conda_file=pathJoin(conda_path,"etc/profile.d/conda.sh") + end + local mcmd="source " .. conda_file + execute{cmd=mcmd, modeA={"load"}} +end + +-- initialize conda +local conda_path="/home/username/miniconda3" +init_conda(conda_path) + +-- add rocoto to path +local rocoto_path="/home/username/rocoto" +prepend_path("PATH", pathJoin(rocoto_path,"bin")) + +-- add fake slurm commands +local srw_path="/home/username/ufs-srweather-app" +prepend_path("PATH", pathJoin(srw_path, "ush/rocoto_fake_slurm")) +-- display conda activation message if mode() == "load" then LmodMsgRaw([===[Please do the following to activate conda: - > conda activate $VENV + > conda activate regional_workflow ]===]) end diff --git a/modulefiles/wflow_macos.lua b/modulefiles/wflow_macos.lua index 769f1bc05e..d7cf30e0a3 100644 --- a/modulefiles/wflow_macos.lua +++ b/modulefiles/wflow_macos.lua @@ -5,17 +5,36 @@ This module set a path needed to activate conda environement for running UFS SRW whatis([===[This module activates conda environment for running the UFS SRW App on macOS]===]) setenv("CMAKE_Platform", "macos") -setenv("VENV", pathJoin(os.getenv("HOME"), "condaenv/envs/regional_workflow")) ---[[ -local ROCOTOmod="/Users/username/modules" -prepend_path("MODULEPATH", ROCOTOmod) -load(rocoto) ---]] +-- Conda initialization function +function init_conda(conda_path) + local shell=myShellType() + local conda_file + if shell == "csh" then + conda_file=pathJoin(conda_path,"etc/profile.d/conda.csh") + else + conda_file=pathJoin(conda_path,"etc/profile.d/conda.sh") + end + local mcmd="source " .. conda_file + execute{cmd=mcmd, modeA={"load"}} +end + +-- initialize conda +local conda_path="/Users/username/miniconda3" +init_conda(conda_path) + +-- add rocoto to path +local rocoto_path="/Users/username/rocoto" +prepend_path("PATH", pathJoin(rocoto_path,"bin")) + +-- add fake slurm commands +local srw_path="/Users/username/ufs-srweather-app" +prepend_path("PATH", pathJoin(srw_path, "ush/rocoto_fake_slurm")) +-- display conda activation message if mode() == "load" then LmodMsgRaw([===[Please do the following to activate conda virtual environment: - > conda activate $VENV " + > conda activate regional_workflow" ]===]) end