diff --git a/DATA/common/gen_topo_helper_functions.sh b/DATA/common/gen_topo_helper_functions.sh index 0ce33047b..4b0abb550 100755 --- a/DATA/common/gen_topo_helper_functions.sh +++ b/DATA/common/gen_topo_helper_functions.sh @@ -252,15 +252,18 @@ add_W() # Add binarry to workflow command USAGE: add_W [BINARY] [COMMAND_LINE_OP WORKFLOW+=$WFADD } -if [[ "${GEN_TOPO_DEPLOYMENT_TYPE:-}" == "ALICE_STAGING" ]]; then - GEN_TOPO_QC_CONSUL_SERVER=ali-staging.cern.ch -else - GEN_TOPO_QC_CONSUL_SERVER=alio2-cr1-hv-con01.cern.ch +if [[ ${EPNSYNCMODE:-0} == 1 && "${WORKFLOW_PARAMETERS:-}" =~ (^|,)"QC"(,|$) ]]; then + if [[ "${GEN_TOPO_DEPLOYMENT_TYPE:-}" == "ALICE_STAGING" ]]; then + GEN_TOPO_QC_CONSUL_SERVER=ali-staging.cern.ch + else + GEN_TOPO_QC_CONSUL_SERVER=alio2-cr1-hv-con01.cern.ch + fi + GEN_TOPO_QC_APRICOT_SERVER=`curl -s "http://${GEN_TOPO_QC_CONSUL_SERVER}:8500/v1/kv/o2/runtime/aliecs/vars/apricot_endpoint?raw"` fi -GEN_TOPO_QC_APRICOT_SERVER=`curl -s "http://${GEN_TOPO_QC_CONSUL_SERVER}:8500/v1/kv/o2/runtime/aliecs/vars/apricot_endpoint?raw"` add_QC_from_consul() { + [[ ${EPNSYNCMODE:-0} == 1 ]] || { echo "Error fetching QC JSON $1: consul server only set for EPNSYNCMODE == 1 " 1>&2 && exit 1; } if [[ ! -z ${GEN_TOPO_QC_JSON_FILE:-} ]]; then curl -s -o $GEN_TOPO_QC_JSON_FILE "http://${GEN_TOPO_QC_CONSUL_SERVER}:8500/v1/kv${1}?raw" if [[ $? != 0 ]]; then @@ -276,12 +279,13 @@ add_QC_from_consul() add_QC_from_apricot() { + [[ ${EPNSYNCMODE:-0} == 1 ]] || { echo "Error fetching QC JSON $1: apricot server only set for EPNSYNCMODE == 1 " 1>&2 && exit 1; } if [[ ! -z ${GEN_TOPO_QC_JSON_FILE:-} ]]; then - if [[ ${1} =~ "?" ]]; then - curl -s -o $GEN_TOPO_QC_JSON_FILE "${GEN_TOPO_QC_APRICOT_SERVER}/${1}\&process=true" - else - curl -s -o $GEN_TOPO_QC_JSON_FILE "${GEN_TOPO_QC_APRICOT_SERVER}/${1}?process=true" - fi + if [[ ${1} =~ "?" ]]; then + curl -s -o $GEN_TOPO_QC_JSON_FILE "${GEN_TOPO_QC_APRICOT_SERVER}/${1}\&process=true" + else + curl -s -o $GEN_TOPO_QC_JSON_FILE "${GEN_TOPO_QC_APRICOT_SERVER}/${1}?process=true" + fi if [[ $? != 0 ]]; then echo "Error fetching QC JSON $1" exit 1 diff --git a/DATA/production/qc-workflow.sh b/DATA/production/qc-workflow.sh index 79cccfeb1..1bd6b5811 100755 --- a/DATA/production/qc-workflow.sh +++ b/DATA/production/qc-workflow.sh @@ -20,22 +20,24 @@ OUTPUT_SUFFIX= add_QC_JSON() { if [[ ${2} =~ ^consul://.* ]]; then + [[ $EPNSYNCMODE == 1 ]] || { echo "Error fetching QC JSON $2: consul server is used for EPNSYNCMODE == 1 only" 1>&2 && exit 1; } TMP_FILENAME=$FETCHTMPDIR/$1.$RANDOM.$RANDOM.json curl -s -o $TMP_FILENAME "http://${GEN_TOPO_QC_CONSUL_SERVER}:8500/v1/kv/${2/consul:\/\//}?raw" if [[ $? != 0 ]]; then - echo "Error fetching QC JSON $2" + echo "Error fetching QC JSON $2" 1>&2 exit 1 fi elif [[ ${2} =~ ^apricot://.* ]]; then + [[ $EPNSYNCMODE == 1 ]] || { echo "Error fetching QC JSON $2: apricot server is used for EPNSYNCMODE == 1 only" 1>&2 && exit 1; } TMP_FILENAME=$FETCHTMPDIR/$1.$RANDOM.$RANDOM.json - if [[ ${2} =~ "?" ]]; then - curl -s -o $TMP_FILENAME "${GEN_TOPO_QC_APRICOT_SERVER}/${2/apricot:\/\/o2\//}\&run_type=${RUNTYPE:-}\&beam_type=${BEAMTYPE:-}\&process=true" - else - curl -s -o $TMP_FILENAME "${GEN_TOPO_QC_APRICOT_SERVER}/${2/apricot:\/\/o2\//}?run_type=${RUNTYPE:-}\&beam_type=${BEAMTYPE:-}\&process=true" - fi + if [[ ${2} =~ "?" ]]; then + curl -s -o $TMP_FILENAME "${GEN_TOPO_QC_APRICOT_SERVER}/${2/apricot:\/\/o2\//}\&run_type=${RUNTYPE:-}\&beam_type=${BEAMTYPE:-}\&process=true" + else + curl -s -o $TMP_FILENAME "${GEN_TOPO_QC_APRICOT_SERVER}/${2/apricot:\/\/o2\//}?run_type=${RUNTYPE:-}\&beam_type=${BEAMTYPE:-}\&process=true" + fi if [[ $? != 0 ]]; then - echo "Error fetching QC JSON $2" + echo "Error fetching QC JSON $2" 1>&2 exit 1 fi else