Skip to content

Commit 9b5252f

Browse files
committed
Use name: value in --conda-yml file
Previously, users needed to match the --conda-env value with the name: value in an environment.yml file. Now, conda_env will be set by the name: value within the environment.yml file when using the --conda-yml option. The --conda-env option is now used only for loading pre-installed conda environments. e.g., in a user's HOME directory and initialized in their ~/.bashrc file. --conda-env and --conda-yml should no longer be used together moving forward.
1 parent 8920892 commit 9b5252f

File tree

2 files changed

+23
-26
lines changed

2 files changed

+23
-26
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,16 +429,16 @@ report, then please create a GitHub issue.
429429
## Author
430430

431431
Marty Kandes, Ph.D.
432-
Computational & Data Science Research Specialist
432+
Senior Computational & Data Science Research Specialist
433433
High-Performance Computing User Services Group
434434
Data-Enabled Scientific Computing Division
435435
San Diego Supercomputer Center
436436
University of California, San Diego
437437

438438
## Version
439439

440-
0.7.6
440+
0.7.9
441441

442442
## Last Updated
443443

444-
Monday, May 6th, 2024
444+
Wednesday, March 12th, 2025

galyleo.sh

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#
3535
# LAST UPDATED
3636
#
37-
# Sunday, April 28th, 2024
37+
# Wednesday, March 12th, 2025
3838
#
3939
# ----------------------------------------------------------------------
4040

@@ -157,7 +157,6 @@ function galyleo_launch() {
157157
# Declare directories that append MODULEPATH environment variable
158158
local append_modpath=''
159159

160-
161160
# Declare input variables associated with Singularity containers.
162161
local singularity_image_file=''
163162
local singularity_bind_mounts=''
@@ -345,7 +344,7 @@ function galyleo_launch() {
345344
slog output -m " -d | --notebook-dir : ${jupyter_notebook_dir}"
346345
slog output -m " | --scratch-dir : ${local_scratch_dir}"
347346
slog output -m " -e | --env-modules : ${env_modules}"
348-
slog output -m " --append-modulepath : ${append_modpath}"
347+
slog output -m " | --append-modulepath : ${append_modpath}"
349348
slog output -m " -s | --sif : ${singularity_image_file}"
350349
slog output -m " -B | --bind : ${singularity_bind_mounts}"
351350
slog output -m " | --nv : ${singularity_gpu_type}"
@@ -409,19 +408,17 @@ function galyleo_launch() {
409408
return 1
410409
fi
411410

412-
# Check whether the directory(ies) to be append to MODULEPATH exists and
413-
# are accessible, if not halt the launch.
411+
# Check if any directories to be append to MODULEPATH exist and
412+
# are accessible. If they are not, then halt the launch.
414413
if [[ -n "${append_modpath}" ]]; then
415-
for mpath_name in $(sed 's/,/ /g' <<< "$append_modpath"); do
416-
if [[ ! -d "${mpath_name}" ]] \
417-
|| [[ ! -r "${mpath_name}" ]]; then
418-
slog error -m "directory to append MODULE path not found: ${mpath_name}"
419-
return 1
420-
fi
421-
done
414+
for mpath_name in $(sed 's/,/ /g' <<< "$append_modpath"); do
415+
if [[ ! -d "${mpath_name}" ]] || [[ ! -r "${mpath_name}" ]]; then
416+
slog error -m "directory to append MODULE path not found: ${mpath_name}"
417+
return 1
418+
fi
419+
done
422420
fi
423421

424-
425422
# Check if all environment modules specified by the user, if any, are
426423
# available and can be loaded successfully. If not, then halt the launch.
427424
if [[ -n "${env_modules}" ]]; then
@@ -437,8 +434,6 @@ function galyleo_launch() {
437434
done
438435
fi
439436

440-
441-
442437
# Check if the conda environment specified by the user, if any, can be
443438
# initialized and activated successfully. If not, then halt the launch.
444439
if [[ -n "${conda_env}" ]] && [[ -z "${conda_yml}" ]]; then
@@ -452,11 +447,14 @@ function galyleo_launch() {
452447
slog error -m "conda environment could not be activated: ${conda_env}"
453448
return 1
454449
fi
455-
elif [[ -n "${conda_env}" ]] && [[ -n "${conda_yml}" ]]; then
450+
elif [[ -z "${conda_env}" ]] && [[ -n "${conda_yml}" ]]; then
456451
if [[ ! -f "${conda_yml}" ]]; then
457452
slog error -m "conda environment yaml file not found: ${conda_yml}"
458453
return 1
459454
fi
455+
elif [[ -n "${conda_env}" ]] && [[ -n "${conda_yml}" ]]; then
456+
slog error -m "--conda-env and --conda-yml options should no longer be used together."
457+
return 1
460458
fi
461459

462460
# Check if the Singularity container image file specified by the user,
@@ -589,18 +587,16 @@ function galyleo_launch() {
589587
slog append -f "${job_name}.sh" -m 'declare -i random_ephemeral_port=-1'
590588
slog append -f "${job_name}.sh" -m ''
591589

592-
# Load environment modules specified by the user.
590+
# Reset module environment to default set.
593591
slog append -f "${job_name}.sh" -m 'module reset'
594592

595593
# Append MODULEPATH with user specified directories
596-
597594
if [[ -n "$append_modpath" ]]; then
598-
append_modpath=$(sed 's/,/:/g' <<< "$append_modpath")
599-
slog append -f "${job_name}.sh" \
600-
-m 'export MODULEPATH=${MODULEPATH}:'"${append_modpath}"
595+
append_modpath=$(sed 's/,/:/g' <<< "$append_modpath")
596+
slog append -f "${job_name}.sh" -m 'export MODULEPATH=${MODULEPATH}:'"${append_modpath}"
601597
fi
602598

603-
599+
# Load environment modules specified by the user.
604600
if [[ -n "${env_modules}" ]]; then
605601
IFS=','
606602
read -r -a modules <<< "${env_modules}"
@@ -621,7 +617,8 @@ function galyleo_launch() {
621617
fi
622618

623619
# Create and/or activate a dynamically generated conda environment specified by the user.
624-
if [[ -n "${conda_env}" ]] && [[ -n "${conda_yml}" ]]; then
620+
if [[ -z "${conda_env}" ]] && [[ -n "${conda_yml}" ]]; then
621+
conda_env="$(grep name: ${OLDPWD}/${conda_yml} | awk '{print $2}')"
625622
if [[ ! -d "${GALYLEO_CACHE_DIR}/${conda_env}" ]]; then
626623
mkdir -p "${GALYLEO_CACHE_DIR}/${conda_env}"
627624
fi

0 commit comments

Comments
 (0)