-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_human_epi_model.sh
executable file
·76 lines (65 loc) · 4.06 KB
/
run_human_epi_model.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
75
76
#!/bin/sh
############################################################################################
# Runs human epi model
# USAGE: ./run_human_epi_model.sh HUMAN_EPI_MODEL_PATH CONFIG_PATH HUMAN_EPI_CONFIG_FILENAME HUMAN_EPI_INPUT_PATH HUMAN_EPI_MODEL_OUTPUT_PATH HUMAN_EPI_LOGS_PATH HUMAN_EPI_MODEL_BRANCH MINICONDA_PATH
# HUMAN_EPI_MODEL_PATH: Path where human epi model is cloned from git
# CONFIG_PATH: Path where config files are stored for the current experiment run
# HUMAN_EPI_CONFIG_FILENAME: Name of the human epi model config file
# HUMAN_EPI_INPUT_PATH: Path (directory) to read input from (the same as mosquito-pop output directory)
# HUMAN_EPI_MODEL_OUTPUT_PATH: Path where human epi output will be stored for the current experiment run
# HUMAN_EPI_LOGS_PATH: Path where human epi log will be stored for the current experiment run
# HUMAN_EPI_MODEL_BRANCH: Human epi model branch to use
# MINICONDA_PATH: Path where miniconda3 is installed (e.g., '/projects/epiearth/miniconda3' for Darwin)
# GLOBAL_CONFIG_FILE: Path to global config file (e.g., epiearth_darwin.yaml)
############################################################################################
conda init bash
source ~/.bashrc
if [ "$#" -lt 9 ] || ! [ -d "$1" ] || ! [ -d "$2" ] || ! [ -f "$1/config/$3" ] || ! [ -d "$4" ] || ! [ -d "$5" ] || ! [ -d "$6" ] || ! [ -d "$8" ] || ! [ -f "$9" ]; then
echo -e "ERROR!! Incorrect number or type of arguments. See usage information below:\n"
echo "USAGE: ./run_human_epi_model.sh HUMAN_EPI_MODEL_PATH CONFIG_PATH HUMAN_EPI_CONFIG_FILENAME HUMAN_EPI_INPUT_PATH HUMAN_EPI_MODEL_OUTPUT_PATH HUMAN_EPI_LOGS_PATH MINICONDA_PATH"
echo "HUMAN_EPI_MODEL_PATH: Path where human epi model is cloned from git"
echo "CONFIG_PATH: Path where config files are stored for the current experiment run"
echo "HUMAN_EPI_CONFIG_FILENAME: Name of the human epi model config file"
echo "HUMAN_EPI_INPUT_PATH: Path (directory) to read input from (the same as mosquito-pop output directory)"
echo "HUMAN_EPI_MODEL_OUTPUT_PATH: Path where human epi output will be stored for the current experiment run"
echo "HUMAN_EPI_LOGS_PATH: Path where human epi log will be stored for the current experiment run"
echo "HUMAN_EPI_MODEL_BRANCH: Human epi model branch to use"
echo "MINICONDA_PATH: Path where miniconda3 is installed (e.g., '/projects/epiearth/miniconda3' for Darwin)\n"
echo -e "GLOBAL_CONFIG_FILE: Path to global config file (e.g., epiearth_darwin.yaml)"
exit
fi
HUMAN_EPI_MODEL_PATH=$1
CONFIG_PATH=$2
HUMAN_EPI_CONFIG_FILENAME=$3
HUMAN_EPI_MODEL_INPUT_PATH=$4
HUMAN_EPI_MODEL_OUTPUT_PATH=$5
HUMAN_EPI_LOGS_PATH=$6
HUMAN_EPI_MODEL_BRANCH=$7
MINICONDA_PATH=$8
GLOBAL_CONFIG_FILE=$9
BASE_PATH=`pwd`
# Change to directory where human epi model is cloned
pushd $HUMAN_EPI_MODEL_PATH > /dev/null
# Checkout the given branch and get latest commit id
git checkout $HUMAN_EPI_MODEL_BRANCH --quiet > /dev/null
git pull > /dev/null
echo "$(date): Pulled branch $HUMAN_EPI_MODEL_BRANCH.."
latest_human_epi_model_commit_id=`git log --format="%H" -n 1`
echo "$(date): Latest commit id is $latest_human_epi_model_commit_id.."
# Set configuration file
cp $HUMAN_EPI_MODEL_PATH/config/$HUMAN_EPI_CONFIG_FILENAME $CONFIG_PATH
sed -i.bak "s|HUMAN_EPI_MODEL_PATH|$HUMAN_EPI_MODEL_PATH|g" $CONFIG_PATH/$HUMAN_EPI_CONFIG_FILENAME
sed -i.bak "s|HUMAN_EPI_LOGS_PATH|$HUMAN_EPI_LOGS_PATH|g" $CONFIG_PATH/$HUMAN_EPI_CONFIG_FILENAME
sed -i.bak "s|HUMAN_EPI_MODEL_OUTPUT_PATH|$HUMAN_EPI_MODEL_OUTPUT_PATH|g" $CONFIG_PATH/$HUMAN_EPI_CONFIG_FILENAME
python $BASE_PATH/update_config_parameters.py $GLOBAL_CONFIG_FILE $CONFIG_PATH/$HUMAN_EPI_CONFIG_FILENAME EPI_MODEL
# Run model
conda activate "$MINICONDA_PATH/envs/human-epi-env"
#source activate "$MINICONDA_PATH/envs/human-epi-env"
logfiles=`shopt -s nullglob dotglob; echo $HUMAN_EPI_LOGS_PATH/*`
if [ "$logfiles" != "" ]; then
rm $HUMAN_EPI_LOGS_PATH/*
fi
sh run_LLM_human_model.sh $CONFIG_PATH/$HUMAN_EPI_CONFIG_FILENAME $HUMAN_EPI_MODEL_INPUT_PATH 0 > $HUMAN_EPI_LOGS_PATH/human_epi.out
conda deactivate
# Change back to integration directory
popd > /dev/null