-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun_local.sh
executable file
·29 lines (25 loc) · 1.28 KB
/
run_local.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
#!/bin/bash
# example script for local run
if [ $# -lt 1 ]; then
echo "./run_local.sh <result_json_source> <result_output_sub> [<json_args>] - run flattening for existing director (downloaded from a single job)"
echo " e.g. ./run_local.sh results/SOMESUBID results/ \"{'force_overwrite':False}\" -- will re-run flatteners "
echo " e.g. find results -type d -d 1 | xargs -I {} ./run_local.sh {} results/ -- will run all flatteners in sub-dir"
echo ""
echo " NOTE: This script also searches for a text file called 'timing.txt' in each source directory. If found, it will "
echo " offset all results by the specified number of seconds before saving them to disk. "
exit -1
fi
DIR_FILE=$(dirname ${BASH_SOURCE[0]})
RUNARGS="{}"
if [ $# -gt 2 ]; then
RUNARGS="$3"
fi
if [ -f "$1/timing.txt" ]; then
OFFSET=$(cat "$1/timing.txt")
echo "Detected timing file '$1/timing.txt' with offset $OFFSET seconds..."
RUNARGS="{\"force_overwrite\":false, \"time_offset\":$OFFSET}"
echo "Overwriting extractor metadata to : '$RUNARGS'"
fi
EXTRACTOR_METADATA="$RUNARGS" EXTRACTOR_NAME=dsai_metadata_flatten EXTRACTOR_JOB_ID=1 \
EXTRACTOR_CONTENT_PATH=$1 EXTRACTOR_CONTENT_URL=file://$1 EXTRACTOR_RESULT_PATH=$2 \
python -u ${DIR_FILE}/contentai_metadata_flatten/main.py