-
Notifications
You must be signed in to change notification settings - Fork 0
/
config_env.sh
74 lines (62 loc) · 2.33 KB
/
config_env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# if [ -x /glade/u/home/benkirk/bugreports/spack/charliecloud/spack/share/spack/setup-env.sh ]; then
# . /glade/u/home/benkirk/bugreports/spack/charliecloud/spack/share/spack/setup-env.sh || exit 1
# spack env activate -p container_env || exit 1
# else
# . ~benkirk/spack_modules.sh && module load podman charliecloud singularityce || exit 1
# spack env activate -p container_env || exit 1
# fi
module --force purge && module load ncarenv/23.05 && module load charliecloud podman apptainer && module list
# preliminaries - podman at least seems to require a local filesystem, try leaving TMPDIR on lustre
# and I see failures...
TMPDIR=/var/tmp/${USER}/container_tmp && mkdir -p ${TMPDIR}
clean_container_dirs()
{
chmod -R u+rwX /var/tmp/${USER}*
rm -rf /var/tmp/${USER}*
mkdir -p /var/tmp/${USER}
[ -d ${TMPDIR} ] || mkdir -p ${TMPDIR}
}
for exe in podman ch-image singularity ; do
which $exe && $exe --version && echo || exit 1
done
gotocolumn="\033["$rescol"G";
white="\033[01;37m";
green="\033[01;32m";
red="\033[01;31m";
grey="\033[00;37m";
cyan="\033[01;36m";
colorreset="\033[m";
# Write pretty status message
function message_running {
echo " "
echo -e $cyan"-------------------------------------------------------------------------------------"
echo -e $cyan'(test): Running' $@
echo -e $cyan"-------------------------------------------------------------------------------------"
echo -e -n $colorreset;
}
# Write pretty status message
function message_cmd {
echo -e $cyan'(test): Running' $@
echo -e -n $colorreset;
eval $@
}
# Write failure message
function message_failed {
echo -e $red"-------------------------------------------------------------------------------------"
echo -e $red'(test): ** ERROR:' $@
echo -e $red"-------------------------------------------------------------------------------------"
echo -e -n $colorreset;
#exit 1
}
# Write pretty pass message
function message_passed {
echo -e $green"-------------------------------------------------------------------------------------"
echo -e $green'(test): PASSED:' $@
echo -e $green"-------------------------------------------------------------------------------------"
echo -e -n $colorreset;
}
function try_command {
message_cmd $@ \
&& message_passed $@ \
|| message_failed $@
}