Skip to content

Commit

Permalink
deal with concurrency issue in import_docs - merge cbimport into run_…
Browse files Browse the repository at this point in the history
…imports
  • Loading branch information
matsgsl committed Feb 8, 2024
1 parent e8346ed commit 023ad23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 129 deletions.
123 changes: 0 additions & 123 deletions scripts/VXingest_utilities/import_docs.sh

This file was deleted.

14 changes: 8 additions & 6 deletions scripts/VXingest_utilities/run-import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,22 @@ ls -1 ${load_dir}/*.gz | while read f; do
log_file=`ls -1 ${data_dir}/*.log`
echo "processing log_file ${log_file}"
log_dir=$(dirname ${log_file})
mkdir -p ${log_dir}
log_file_name=$(basename $log_file)
import_log_file="${log_dir}/import-${log_file_name}"
import_log_file="${log_dir}import-${log_file_name}"
echo "import log file will be: ${import_log_file}"
# run the import job
metric_name=$(grep metric_name ${log_file} | awk '{print $6}') # Grab the desired column from the python log format
echo "metric name will be ${metric_name}"
import_metric_name="import_${metric_name}"
echo "import metric name will be ${import_metric_name}"
echo "metric_name ${import_metric_name}" > ${import_log_file}
echo "RUNNING - scripts/VXingest_utilities/import_docs.sh -c ${credentials_file} -p ${data_dir} -n 6 -l logs >> ${import_log_file}"
scripts/VXingest_utilities/import_docs.sh -c ${credentials_file} -p ${data_dir} -n $(nproc) -l logs 2>&1 >> ${import_log_file}
exit_code=$?
wait
echo "exit_code:${exit_code}" >> ${import_log_file}
number_of_cpus=$(nproc)

for json_f in ${data_dir}/*.json; do
fname=$(basename ${json_f})
${HOME}/cbtools/bin/cbimport json --threads ${number_of_cpus} --cluster couchbase://${cb_host} --bucket ${bucket} --scope-collection-exp ${scope}.${collection} --username ${cb_user} --password ${cb_pwd} --format list --generate-key %id% --dataset file:///${json_f}
done
if [[ "${exit_code}" -ne "0" ]]; then
echo "import failed for $f exit_code:${exit_code}"
failed_import_count=$((failed_import_count+1))
Expand Down

0 comments on commit 023ad23

Please sign in to comment.