Skip to content

Commit 61178ba

Browse files
committed
fill: Introduce --debug-loading
1 parent af7c1e5 commit 61178ba

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

run/fill-db

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ CLONE_URL_SAMPLE_DATA="https://gitlab.opensourceecology.de/verein/projekte/okh/d
2828
CLONE_URL_SPDX_LICENSES="https://github.com/spdx/license-list-data.git"
2929
data_url="$CLONE_URL_OLD_DATA"
3030
data_branch="main"
31+
debug_loading=false
3132
cleanup=false
3233
online=true
3334
batch_size="$BATCH_SIZE_DEFAULT"
@@ -44,6 +45,9 @@ function print_help() {
4445
echo "Options:"
4546
echo " -h, --help"
4647
echo " Print this usage help and exit"
48+
echo " --debug-loading"
49+
echo " Instead of a nice progress bar when loading the data into the DB,"
50+
echo " this shows the raw output."
4751
echo " --validate"
4852
echo " Validate the RDF input files before loading them into the DB"
4953
echo " (output: '$validation_output_file')"
@@ -86,6 +90,9 @@ do
8690
print_help
8791
exit 0
8892
;;
93+
--debug-loading)
94+
debug_loading=true
95+
;;
8996
--validate)
9097
validate=true
9198
;;
@@ -281,14 +288,25 @@ mkdir -p "$db_tmp_dir"
281288

282289
echo
283290
echo "Loading data into the DB in batches of size $batch_size ..."
284-
time while mapfile -t -n "$batch_size" batch && ((${#batch[@]}))
285-
do
286-
"$jena_db_data_injector" \
287-
--loc "$db_tmp_dir" \
288-
"${batch[@]}"
289-
# --loader=parallel \
290-
done < "$input_list_file" 2>&1 \
291-
| pv -pet --line-mode --size "$num_inputs" > /dev/null
291+
if $debug_loading
292+
then
293+
time while mapfile -t -n "$batch_size" batch && ((${#batch[@]}))
294+
do
295+
"$jena_db_data_injector" \
296+
--loc "$db_tmp_dir" \
297+
"${batch[@]}"
298+
# --loader=parallel \
299+
done < "$input_list_file"
300+
else
301+
time while mapfile -t -n "$batch_size" batch && ((${#batch[@]}))
302+
do
303+
"$jena_db_data_injector" \
304+
--loc "$db_tmp_dir" \
305+
"${batch[@]}"
306+
# --loader=parallel \
307+
done < "$input_list_file" 2>&1 \
308+
| pv -pet --line-mode --size "$num_inputs" > /dev/null
309+
fi
292310
echo
293311
if [ -e "$db_dir" ]
294312
then

0 commit comments

Comments
 (0)