-
Notifications
You must be signed in to change notification settings - Fork 17
/
pattern_data_sim_runner.sh
34 lines (29 loc) · 1.1 KB
/
pattern_data_sim_runner.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
#!/bin/bash
# This script is needed to autorestart execution of simulating datapoints for a dataset
# in case of crashes and/or using mini-batches
# sh ./datasim_runner.sh 3>&1 2>&1 > C:\Users\out.txt (path to output file)
dataset_name=my_dataset
config=default_sim_props.yaml
sim_default_bodies=false
batch_size=100
# -- Main calls --
ret_code=1
STARTTIME=$(date +%s)
while [ $ret_code != 0 ] # failed for any reason
do
if [ "$sim_default_bodies" = "true" ]; then
python ./pattern_data_sim.py --data $dataset_name --default_body --config $config -b $batch_size
else
python ./pattern_data_sim.py --data $dataset_name --config $config -b $batch_size
fi
ret_code=$?
if [ $ret_code -eq 0 ]; then
echo "The execution completed successfully."
else
echo "The execution failed with an error (ret_code: $ret_code)."
fi
ENDTIME=$(date +%s)
T=$(($ENDTIME - $STARTTIME))
echo "It took ${T} seconds to complete this task so far..."
printf "Pretty format: %02dd %02dh %02dm %02ds\n" "$(($T/86400))" "$(($T/3600%24))" "$(($T/60%60))" "$(($T%60))"
done