-
Notifications
You must be signed in to change notification settings - Fork 3
/
ecmwf_install_as_module
executable file
·70 lines (58 loc) · 2.16 KB
/
ecmwf_install_as_module
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
#!/bin/bash
module unload python
module unload python3
module load python3
set -eux
mod_version=${1:-3.0.0.post1}
if [[ $# -gt 0 ]]; then shift; fi
hosts=${@:-deploy@aa-login deploy@ab-login deploy@ac-login deploy@ad-login}
assets_version=$mod_version
echo "module version to be installed: $mod_version"
echo "on hosts: $hosts"
# Where is pyg2p source code
src_dir=$PWD
src_host=$HOST
src_host=hpc-login
# where to install it
dest_dir=/usr/local/apps/pyg2p/$mod_version
eccodes=eccodes/2.24.0
for dest_host in $hosts; do
case $dest_host in
deploy@a?-login ) dest_dir=/usr/local/apps/pyg2p/$mod_version
static_data_root=/usr/local/apps/pyg2p/data
eccodes=ecmwf-toolbox/2022.08.0.0 ;;
* ) echo "unexpected target host $dest_host"; false ;;
esac
echo installing pyg2p/$mod_version in $dest_host ....
if ssh -x $dest_host [[ -d $dest_dir ]]; then
case $mod_version in
*dev* | *test | 3.0.0-01 | 3.0.1 | 3.0.0.post1 ) echo "reinstalling pyg2p/$mod_version" ;;
* ) echo "module pyg2p/$mod_version is already installed on $dest_host. skipping."; continue ;;
esac
fi
ssh -x $dest_host bash -l << END
set -eux
module unload python3 python gdal grib_api eccodes || :
module load $eccodes
module load gdal/3.2.1
module load python3/3.8.8-01
module load gcc || : # on HPC ;;
umask 022
mkdir -p \$SCRATCH/tmp_pyg2p
cd \$SCRATCH/tmp_pyg2p/
rsync -avz --exclude='.git/' -e ssh $src_host:$src_dir .
cd pyg2p
echo '{
"geopotentials": "$static_data_root/geopotentials",
"intertables": "$static_data_root/intertables"
}
' > configuration/global/global_conf.json
python_version=\$(python3 -c "import sys; print(f'python{sys.version_info.major}.{sys.version_info.minor}')")
export PYTHONPATH=$dest_dir/lib/\$python_version/site-packages
python3 setup.py clean --all
mkdir -p \$PYTHONPATH
PYTHONPATH=\$ECCODES_DIR/lib/\$python_version/site-packages/:\$PYTHONPATH
python3 setup.py install --prefix=$dest_dir
END
echo done
done