This repository has been archived by the owner on Dec 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathrun.sh
136 lines (106 loc) · 4.05 KB
/
run.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/bash
test_case=$1
scoop_test=$2
set -e
if [ -z ${RMG_BENCHMARK+x} ]; then
echo "RMG variable is unset. Exiting..."
exit 1
fi
export ORIGIN_PYTHONPATH=$PYTHONPATH
echo "ORIGIN_PYTHONPATH=$ORIGIN_PYTHONPATH" >> $GITHUB_ENV
echo "Running $1 test case"
###########
#BENCHMARK#
###########
# make folder for models generated by the benchmark version of RMG-Py/RMG-database:
mkdir -p $BASE_DIR/results/benchmark/$test_case
rm -rf $BASE_DIR/results/benchmark/$test_case/*
cp $BASE_DIR/tests/$test_case/input.py $BASE_DIR/results/benchmark/$test_case/input.py
source "$BASE_DIR/.bash_profile"
conda activate $BENCHMARK_CONDA_ENV
echo "Benchmark code directory: "$RMG_BENCHMARK
export PYTHONPATH=$RMG_BENCHMARK:$ORIGIN_PYTHONPATH
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
rm -rf ${RMG_BENCHMARK}/rmgpy/rmgrc
rmgrc="database.directory : "${RMGDB_BENCHMARK}/input/
echo $rmgrc >> ${RMG_BENCHMARK}/rmgpy/rmgrc
echo "Running benchmark job"
if timeout 570 python-jl $RMG_BENCHMARK/rmg.py $BASE_DIR/results/benchmark/$test_case/input.py > /dev/null
then
echo "Benchmark job completed"
else
echo "Benchmark job timed out"
fi
conda deactivate
export PYTHONPATH=$ORIGIN_PYTHONPATH
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
#########
#TESTING#
#########
# make folder for models generated by the test version of RMG-Py and RMG-database:
mkdir -p $BASE_DIR/results/testmodel/$test_case
rm -rf $BASE_DIR/results/testmodel/$test_case/*
cp $BASE_DIR/tests/$test_case/input.py $BASE_DIR/results/testmodel/$test_case/input.py
conda activate $TESTING_CONDA_ENV
echo "Testing code directory: "$RMG_TESTING
export PYTHONPATH=$RMG_TESTING:$ORIGIN_PYTHONPATH
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
rm -rf ${RMG_TESTING}/rmgpy/rmgrc
rmgrc="database.directory : "${RMGDB_TESTING}/input/
echo $rmgrc >> ${RMG_TESTING}/rmgpy/rmgrc
echo "Running testing job"
if timeout 570 python-jl $RMG_TESTING/rmg.py $BASE_DIR/results/testmodel/$test_case/input.py > /dev/null
then
echo "Testing job completed"
else
echo "Testing job timed out"
exit 1
fi
conda deactivate
export PYTHONPATH=$ORIGIN_PYTHONPATH
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
# compare both generated models
mkdir -p $BASE_DIR/results/check/$test_case
rm -rf $BASE_DIR/results/check/$test_case/*
cd $BASE_DIR/results/check/$test_case
conda activate $TESTING_CONDA_ENV
echo "Comparing results"
export PYTHONPATH=$RMG_TESTING:$ORIGIN_PYTHONPATH
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
bash $BASE_DIR/check.sh $test_case $BASE_DIR/results/benchmark/$test_case $BASE_DIR/results/testmodel/$test_case
export PYTHONPATH=$ORIGIN_PYTHONPATH
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
conda deactivate
if [ $scoop_test == "yes" ]; then
# make folder for models generated by the test version of RMG-Py and RMG-database, with scoop enabled:
mkdir -p $BASE_DIR/results/testmodel/$test_case/scoop
rm -rf $BASE_DIR/results/testmodel/$test_case/scoop/*
cp $BASE_DIR/tests/$test_case/input.py $BASE_DIR/results/testmodel/$test_case/scoop/input.py
echo "Testing code directory: $RMG_TESTING"
conda activate $TESTING_CONDA_ENV
export PYTHONPATH=$RMG_TESTING:$ORIGIN_PYTHONPATH
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
echo "Running test job with scoop"
if timeout 570 python-jl -m scoop -n 1 $RMG_TESTING/rmg.py $BASE_DIR/results/testmodel/$test_case/scoop/input.py > /dev/null
then
echo "Testing job with scoop completed"
else
echo "Testing job with scoop timed out"
exit 1
fi
export PYTHONPATH=$ORIGIN_PYTHONPATH
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
conda deactivate
# compare both generated models
mkdir -p $BASE_DIR/results/check/$test_case/scoop
cd $BASE_DIR/results/check/$test_case/scoop
conda activate $BENCHMARK_CONDA_ENV
export PYTHONPATH=$RMG_BENCHMARK:$ORIGIN_PYTHONPATH
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
bash $BASE_DIR/check.sh $test_case $BASE_DIR/results/benchmark/$test_case $BASE_DIR/results/testmodel/$test_case/scoop
export PYTHONPATH=$ORIGIN_PYTHONPATH
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
conda deactivate
fi
# return to main directory
cd $BASE_DIR