-
Notifications
You must be signed in to change notification settings - Fork 0
/
batch_victree_harald.sh
executable file
·61 lines (47 loc) · 1.56 KB
/
batch_victree_harald.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
#!/bin/bash
# Parse command line arguments
if [[ $# -ne 1 ]]; then
echo "Usage: $0 <config_dir>"
echo "run the script in the folder relative to the input file specification"
exit 1
fi
config_dir="$1"
# input_file="$2"
# remote_dir="$3"
# Set output directory prefix
output_prefix="${config_dir}/out_"
#mkdir -p "${output_prefix}"
# Create zip directory if it doesn't exist
# zip_dir="./zip"
# mkdir -p "${zip_dir}"
# Loop over configuration files in directory
for config_file in "${config_dir}"/*.yml; do
# Set output directory for this run
# which looks like configs/out_<config_file>
output_dir="${output_prefix}$(basename "${config_file}" .yml)"
args=("--output" "${output_dir}")
while IFS="=" read -r key value; do
# replace underscores with dashes
key=${key//_/-}
# flag param
if [[ "${value}" == "true" ]]; then
args+=("--${key}")
elif [[ "${key}" == "input" ]]; then
args+=("--${key} ${value}")
else
args+=("--${key} ${value}")
fi
done < <(
yq 'to_entries | map([.key, .value] | join("=")) | .[]' "${config_file}"
)
# load params from yaml config file
# Run script with parameters
full_cmd="/home/x_vitza/coPy-tree/src/main.py ${args[@]}"
echo "executing: ${full_cmd}"
eval "$full_cmd"
# Zip output directory and delete it
# zip -r "${output_dir}.zip" "$(basename "${output_dir}")"
# rm -rf "${output_dir}"
# # Copy zip file to remote directory
# scp "${zip_dir}/${output_dir}.zip" "${remote_dir}/$(basename "${output_dir}").zip" && rm -f "${zip_dir}/${output_dir}.zip"
done