34
34
#
35
35
# LAST UPDATED
36
36
#
37
- # Sunday, April 28th, 2024
37
+ # Wednesday, March 12th, 2025
38
38
#
39
39
# ----------------------------------------------------------------------
40
40
@@ -157,7 +157,6 @@ function galyleo_launch() {
157
157
# Declare directories that append MODULEPATH environment variable
158
158
local append_modpath=' '
159
159
160
-
161
160
# Declare input variables associated with Singularity containers.
162
161
local singularity_image_file=' '
163
162
local singularity_bind_mounts=' '
@@ -345,7 +344,7 @@ function galyleo_launch() {
345
344
slog output -m " -d | --notebook-dir : ${jupyter_notebook_dir} "
346
345
slog output -m " | --scratch-dir : ${local_scratch_dir} "
347
346
slog output -m " -e | --env-modules : ${env_modules} "
348
- slog output -m " --append-modulepath : ${append_modpath} "
347
+ slog output -m " | --append-modulepath : ${append_modpath} "
349
348
slog output -m " -s | --sif : ${singularity_image_file} "
350
349
slog output -m " -B | --bind : ${singularity_bind_mounts} "
351
350
slog output -m " | --nv : ${singularity_gpu_type} "
@@ -409,19 +408,17 @@ function galyleo_launch() {
409
408
return 1
410
409
fi
411
410
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.
414
413
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
422
420
fi
423
421
424
-
425
422
# Check if all environment modules specified by the user, if any, are
426
423
# available and can be loaded successfully. If not, then halt the launch.
427
424
if [[ -n " ${env_modules} " ]]; then
@@ -437,8 +434,6 @@ function galyleo_launch() {
437
434
done
438
435
fi
439
436
440
-
441
-
442
437
# Check if the conda environment specified by the user, if any, can be
443
438
# initialized and activated successfully. If not, then halt the launch.
444
439
if [[ -n " ${conda_env} " ]] && [[ -z " ${conda_yml} " ]]; then
@@ -452,11 +447,14 @@ function galyleo_launch() {
452
447
slog error -m " conda environment could not be activated: ${conda_env} "
453
448
return 1
454
449
fi
455
- elif [[ -n " ${conda_env} " ]] && [[ -n " ${conda_yml} " ]]; then
450
+ elif [[ -z " ${conda_env} " ]] && [[ -n " ${conda_yml} " ]]; then
456
451
if [[ ! -f " ${conda_yml} " ]]; then
457
452
slog error -m " conda environment yaml file not found: ${conda_yml} "
458
453
return 1
459
454
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
460
458
fi
461
459
462
460
# Check if the Singularity container image file specified by the user,
@@ -589,18 +587,16 @@ function galyleo_launch() {
589
587
slog append -f " ${job_name} .sh" -m ' declare -i random_ephemeral_port=-1'
590
588
slog append -f " ${job_name} .sh" -m ' '
591
589
592
- # Load environment modules specified by the user .
590
+ # Reset module environment to default set .
593
591
slog append -f " ${job_name} .sh" -m ' module reset'
594
592
595
593
# Append MODULEPATH with user specified directories
596
-
597
594
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} "
601
597
fi
602
598
603
-
599
+ # Load environment modules specified by the user.
604
600
if [[ -n " ${env_modules} " ]]; then
605
601
IFS=' ,'
606
602
read -r -a modules <<< " ${env_modules}"
@@ -621,7 +617,8 @@ function galyleo_launch() {
621
617
fi
622
618
623
619
# 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}' ) "
625
622
if [[ ! -d " ${GALYLEO_CACHE_DIR} /${conda_env} " ]]; then
626
623
mkdir -p " ${GALYLEO_CACHE_DIR} /${conda_env} "
627
624
fi
0 commit comments