Skip to content

Commit

Permalink
tesstrain: check all subjobs' retval
Browse files Browse the repository at this point in the history
  • Loading branch information
bertsky committed Mar 14, 2019
1 parent 5316bcb commit 6cbad17
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/training/tesstrain_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,14 @@ phase_I_generate_image() {
check_file_readable ${TRAIN_NGRAMS_FILE}
fi

local counter=0
local jobs=
for font in "${FONTS[@]}"; do
sleep 1
test $(jobs -r | wc -l) -ge $par_factor && wait -n
generate_font_image "${font}" &
let counter++
((counter%par_factor)) || wait -n
jobs="$jobs $!"
done
wait -n
wait $jobs
# Check that each process was successful.
for font in "${FONTS[@]}"; do
local fontname=$(echo ${font} | tr ' ' '_' | sed 's/,//g')
Expand Down Expand Up @@ -443,14 +443,14 @@ phase_E_extract_features() {
OLD_TESSDATA_PREFIX=${TESSDATA_PREFIX}
export TESSDATA_PREFIX=${TESSDATA_DIR}
tlog "Using TESSDATA_PREFIX=${TESSDATA_PREFIX}"
local counter=0
local jobs=
for img_file in ${img_files}; do
test $(jobs -r | wc -l) -ge $par_factor && wait -n
run_command tesseract ${img_file} ${img_file%.*} \
${box_config} ${config} &
let counter++
((counter%par_factor)) || wait -n
jobs="$jobs $!"
done
wait -n
wait $jobs
export TESSDATA_PREFIX=${OLD_TESSDATA_PREFIX}
# Check that all the output files were produced.
for img_file in ${img_files}; do
Expand Down

0 comments on commit 6cbad17

Please sign in to comment.