Skip to content

Commit

Permalink
'all' command should run only the selected tasks if schema is PICA #265
Browse files Browse the repository at this point in the history
  • Loading branch information
pkiraly committed May 5, 2023
1 parent b7080b3 commit 2ebef70
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions common-script
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,30 @@ do_all_analyses() {
done
}

do_all_analyses_for_pica() {
tasks=$(echo "${PICA}" | tr , ' ')
for task in $tasks; do
declare -F "do_$task" > /dev/null || fatal "unknown analysis task: $task"
done
for task in $(echo "${PICA}" | tr , ' '); do
do_$task
done
}

do_all_solr() {
do_prepare_solr
do_index
}

do_all() {
if [ "${SCHEMA:-}" == "PICA" ]; then
do_all_analyses_for_pica
else
do_all_analyses
fi
do_all_solr
}

# ---- usage and execution of proccessing steps ----

help() {
Expand Down Expand Up @@ -485,8 +504,9 @@ commands:
export-schema-files export schema files
shacl4bib run SHACL-like validation
all-analyses run all analytical tasks (or those set via ANALYSES)
all-analyses-pica run all analytical tasks for PICA records (or those set via PICA_ANALYSES)
all-solr run all indexing tasks
all run all tasks
all run all tasks (analyses and indexing)
config show configuration
help print this help message
Expand Down Expand Up @@ -528,6 +548,8 @@ fi
# which tasks to run on `all-analyses`
ALL_ANALYSES=validate,sqlite,completeness,completeness_sqlite,classifications,authorities,tt_completeness,shelf_ready_completeness,serial_score,functional_analysis,pareto,marc_history
ANALYSES=${ANALYSES:-$ALL_ANALYSES}
PICA_ANALYSES=validate,sqlite,completeness,completeness_sqlite,classifications,authorities,marc_history
PICA=${PICA:-$PICA_ANALYSES}

# check directories for processing commands
if [[ ! "${1:-help}" =~ ^(help|config|export-schema-files)$ ]]; then
Expand Down Expand Up @@ -570,8 +592,9 @@ case "${1:-help}" in
mysql) do_mysql ;;
export-schema-files) do_export_schema_files ;;
all-analyses) do_all_analyses ;;
all-analyses-pica) do_all_analyses_for_pica ;;
all-solr) do_all_solr ;;
all) do_all_analyses ; do_all_solr ;;
all) do_all ;;
version-link) do_version_link ;;
config) config ;;
help) help ;;
Expand Down

0 comments on commit 2ebef70

Please sign in to comment.