-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathecmwf_install_as_module
More file actions
executable file
·80 lines (66 loc) · 2.56 KB
/
ecmwf_install_as_module
File metadata and controls
executable file
·80 lines (66 loc) · 2.56 KB
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
75
76
77
78
79
80
#!/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=ecmwf-toolbox/2025.04.0.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/2025.04.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.2.8 | 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 hdf5 python3 python gdal grib_api eccodes netcdf4 || :
module load $eccodes
module load netcdf4/4.9.3
module load gdal/3.10.2
module load python3/3.12.9-01
module load hdf5/1.14.6
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
mkdir -p \$PYTHONPATH
PYTHONPATH=\$ECCODES_DIR/lib/\$python_version/site-packages/:${dest_dir}:\$PYTHONPATH
rm -rf $dest_dir
python3 -m venv $dest_dir --system-site-packages
source $dest_dir/bin/activate
pip3 install --upgrade --force-reinstall -r requirements.txt
python3 -m pip install .
cp -rf ${dest_dir}/pyg2p/configuration/ ${dest_dir}/lib/\${python_version}/site-packages/pyg2p/
END
echo done
done
# Modulemgr commands
modulemgr -m tag comfies 0.3 default