🥅 include client log in error handling

This commit is contained in:
Felix Lohmeier 2021-02-23 17:22:27 +01:00
parent 6789554c60
commit 7ada831c3f
5 changed files with 23 additions and 9 deletions

View File

@ -127,7 +127,6 @@ Please file an [issue](https://github.com/opencultureconsulting/openrefine-task-
## To do ## To do
- [ ] Codacy badge (needs to be public) - [ ] Codacy badge (needs to be public)
- [ ] add client log messages to openrefine.log (tee -a)
- [ ] differentiate examples - [ ] differentiate examples
- [ ] example for loading multiple input files by providing a zip archive - [ ] example for loading multiple input files by providing a zip archive
- [ ] example for download "fresh" input data as a dependent task and generating archives/diffs - [ ] example for download "fresh" input data as a dependent task and generating archives/diffs

View File

@ -50,11 +50,11 @@ tasks:
if [ ! -f "../openrefine/refine" ]; then if [ ! -f "../openrefine/refine" ]; then
echo 1>&2 "OpenRefine missing; try task install"; exit 1 echo 1>&2 "OpenRefine missing; try task install"; exit 1
fi fi
rm -rf ./*.project* workspace.json rm -rf ./*.project* workspace.json openrefine.log
- > # launch OpenRefine with specific data directory and redirect its output to a log file - > # launch OpenRefine with specific data directory and redirect its output to a log file
../openrefine/refine -v warn -p {{.PORT}} -m {{.RAM}} ../openrefine/refine -v warn -p {{.PORT}} -m {{.RAM}}
-d ../{{.PROJECT}} -d ../{{.PROJECT}}
> openrefine.log 2>&1 & >> openrefine.log 2>&1 &
- | # wait until OpenRefine API is available - | # wait until OpenRefine API is available
timeout 30s bash -c "until timeout 30s bash -c "until
wget -q -O - http://localhost:{{.PORT}} | cat | grep -q -o OpenRefine wget -q -O - http://localhost:{{.PORT}} | cat | grep -q -o OpenRefine

View File

@ -23,17 +23,22 @@ tasks:
../openrefine/client -P {{.PORT}} ../openrefine/client -P {{.PORT}}
--create "$(readlink -m input/doaj-article-sample.csv)" --create "$(readlink -m input/doaj-article-sample.csv)"
--projectName {{.PROJECT}} --projectName {{.PROJECT}}
> >(tee -a openrefine.log) 2>&1
- > # apply transformation rules - > # apply transformation rules
../openrefine/client -P {{.PORT}} {{.PROJECT}} ../openrefine/client -P {{.PORT}} {{.PROJECT}}
--apply config/doaj-openrefine.json --apply config/doaj-openrefine.json
> >(tee -a openrefine.log) 2>&1
- > # export to file - > # export to file
mkdir -p output && mkdir -p output &&
../openrefine/client -P {{.PORT}} {{.PROJECT}} ../openrefine/client -P {{.PORT}} {{.PROJECT}}
--output "$(readlink -m output/doaj-results.tsv)" --output "$(readlink -m output/doaj-results.tsv)"
> >(tee -a openrefine.log) 2>&1
- | # print allocated system resources - | # print allocated system resources
PID="$(lsof -t -i:{{.PORT}})" PID="$(lsof -t -i:{{.PORT}})"
echo "used $(($(ps --no-headers -o rss -p "$PID") / 1024)) MB RAM" echo "used $(($(ps --no-headers -o rss -p "$PID") / 1024)) MB RAM" \
echo "used $(ps --no-headers -o cputime -p "$PID") CPU time" > >(tee -a openrefine.log)
echo "used $(ps --no-headers -o cputime -p "$PID") CPU time" \
> >(tee -a openrefine.log)
- task: :stop # shut down OpenRefine and archive the OpenRefine project - task: :stop # shut down OpenRefine and archive the OpenRefine project
vars: {PROJECT: '{{.PROJECT}}', PORT: '{{.PORT}}'} vars: {PROJECT: '{{.PROJECT}}', PORT: '{{.PORT}}'}
sources: sources:

View File

@ -22,17 +22,22 @@ tasks:
--create "$(readlink -m input/duplicates.csv)" --create "$(readlink -m input/duplicates.csv)"
--encoding UTF-8 --encoding UTF-8
--projectName {{.PROJECT}} --projectName {{.PROJECT}}
> >(tee -a openrefine.log) 2>&1
- > # apply transformation rules - > # apply transformation rules
../openrefine/client -P {{.PORT}} {{.PROJECT}} ../openrefine/client -P {{.PORT}} {{.PROJECT}}
--apply config/duplicates-deletion.json --apply config/duplicates-deletion.json
> >(tee -a openrefine.log) 2>&1
- > # export to file - > # export to file
mkdir -p output && mkdir -p output &&
../openrefine/client -P {{.PORT}} {{.PROJECT}} ../openrefine/client -P {{.PORT}} {{.PROJECT}}
--output "$(readlink -m output/deduped.xls)" --output "$(readlink -m output/deduped.xls)"
> >(tee -a openrefine.log) 2>&1
- | # print allocated system resources - | # print allocated system resources
PID="$(lsof -t -i:{{.PORT}})" PID="$(lsof -t -i:{{.PORT}})"
echo "used $(($(ps --no-headers -o rss -p "$PID") / 1024)) MB RAM" echo "used $(($(ps --no-headers -o rss -p "$PID") / 1024)) MB RAM" \
echo "used $(ps --no-headers -o cputime -p "$PID") CPU time" > >(tee -a openrefine.log)
echo "used $(ps --no-headers -o cputime -p "$PID") CPU time" \
> >(tee -a openrefine.log)
- task: :stop # shut down OpenRefine and archive the OpenRefine project - task: :stop # shut down OpenRefine and archive the OpenRefine project
vars: {PROJECT: '{{.PROJECT}}', PORT: '{{.PORT}}'} vars: {PROJECT: '{{.PROJECT}}', PORT: '{{.PORT}}'}
sources: sources:

View File

@ -25,17 +25,22 @@ tasks:
--processQuotes false --processQuotes false
--guessCellValueTypes true --guessCellValueTypes true
--projectName {{.PROJECT}} --projectName {{.PROJECT}}
> >(tee -a openrefine.log) 2>&1
- > # apply transformation rules - > # apply transformation rules
../openrefine/client -P {{.PORT}} {{.PROJECT}} ../openrefine/client -P {{.PORT}} {{.PROJECT}}
--apply config/phm-transform.json --apply config/phm-transform.json
> >(tee -a openrefine.log) 2>&1
- > # export to file - > # export to file
mkdir -p output && mkdir -p output &&
../openrefine/client -P {{.PORT}} {{.PROJECT}} ../openrefine/client -P {{.PORT}} {{.PROJECT}}
--output "$(readlink -m output/phm-results.tsv)" --output "$(readlink -m output/phm-results.tsv)"
> >(tee -a openrefine.log) 2>&1
- | # print allocated system resources - | # print allocated system resources
PID="$(lsof -t -i:{{.PORT}})" PID="$(lsof -t -i:{{.PORT}})"
echo "used $(($(ps --no-headers -o rss -p "$PID") / 1024)) MB RAM" echo "used $(($(ps --no-headers -o rss -p "$PID") / 1024)) MB RAM" \
echo "used $(ps --no-headers -o cputime -p "$PID") CPU time" > >(tee -a openrefine.log)
echo "used $(ps --no-headers -o cputime -p "$PID") CPU time" \
> >(tee -a openrefine.log)
- task: :stop # shut down OpenRefine and archive the OpenRefine project - task: :stop # shut down OpenRefine and archive the OpenRefine project
vars: {PROJECT: '{{.PROJECT}}', PORT: '{{.PORT}}'} vars: {PROJECT: '{{.PROJECT}}', PORT: '{{.PORT}}'}
sources: sources: