Skip to content

Commit df53e20

Browse files
committed
Using consul and apricot servers in EPNSYNCMODE only
1 parent f794b85 commit df53e20

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

DATA/common/gen_topo_helper_functions.sh

+14-10
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,18 @@ add_W() # Add binarry to workflow command USAGE: add_W [BINARY] [COMMAND_LINE_OP
252252
WORKFLOW+=$WFADD
253253
}
254254

255-
if [[ "${GEN_TOPO_DEPLOYMENT_TYPE:-}" == "ALICE_STAGING" ]]; then
256-
GEN_TOPO_QC_CONSUL_SERVER=ali-staging.cern.ch
257-
else
258-
GEN_TOPO_QC_CONSUL_SERVER=alio2-cr1-hv-con01.cern.ch
255+
if [[ ${EPNSYNCMODE:-0} == 1 && "${WORKFLOW_PARAMETERS:-}" =~ (^|,)"QC"(,|$) ]]; then
256+
if [[ "${GEN_TOPO_DEPLOYMENT_TYPE:-}" == "ALICE_STAGING" ]]; then
257+
GEN_TOPO_QC_CONSUL_SERVER=ali-staging.cern.ch
258+
else
259+
GEN_TOPO_QC_CONSUL_SERVER=alio2-cr1-hv-con01.cern.ch
260+
fi
261+
GEN_TOPO_QC_APRICOT_SERVER=`curl -s "http://${GEN_TOPO_QC_CONSUL_SERVER}:8500/v1/kv/o2/runtime/aliecs/vars/apricot_endpoint?raw"`
259262
fi
260-
GEN_TOPO_QC_APRICOT_SERVER=`curl -s "http://${GEN_TOPO_QC_CONSUL_SERVER}:8500/v1/kv/o2/runtime/aliecs/vars/apricot_endpoint?raw"`
261263

262264
add_QC_from_consul()
263265
{
266+
[[ ${EPNSYNCMODE:-0} == 1 ]] || { echo "Error fetching QC JSON $1: consul server only set for EPNSYNCMODE == 1 " 1>&2 && exit 1; }
264267
if [[ ! -z ${GEN_TOPO_QC_JSON_FILE:-} ]]; then
265268
curl -s -o $GEN_TOPO_QC_JSON_FILE "http://${GEN_TOPO_QC_CONSUL_SERVER}:8500/v1/kv${1}?raw"
266269
if [[ $? != 0 ]]; then
@@ -276,12 +279,13 @@ add_QC_from_consul()
276279

277280
add_QC_from_apricot()
278281
{
282+
[[ ${EPNSYNCMODE:-0} == 1 ]] || { echo "Error fetching QC JSON $1: apricot server only set for EPNSYNCMODE == 1 " 1>&2 && exit 1; }
279283
if [[ ! -z ${GEN_TOPO_QC_JSON_FILE:-} ]]; then
280-
if [[ ${1} =~ "?" ]]; then
281-
curl -s -o $GEN_TOPO_QC_JSON_FILE "${GEN_TOPO_QC_APRICOT_SERVER}/${1}\&process=true"
282-
else
283-
curl -s -o $GEN_TOPO_QC_JSON_FILE "${GEN_TOPO_QC_APRICOT_SERVER}/${1}?process=true"
284-
fi
284+
if [[ ${1} =~ "?" ]]; then
285+
curl -s -o $GEN_TOPO_QC_JSON_FILE "${GEN_TOPO_QC_APRICOT_SERVER}/${1}\&process=true"
286+
else
287+
curl -s -o $GEN_TOPO_QC_JSON_FILE "${GEN_TOPO_QC_APRICOT_SERVER}/${1}?process=true"
288+
fi
285289
if [[ $? != 0 ]]; then
286290
echo "Error fetching QC JSON $1"
287291
exit 1

DATA/production/qc-workflow.sh

+9-7
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,24 @@ OUTPUT_SUFFIX=
2020

2121
add_QC_JSON() {
2222
if [[ ${2} =~ ^consul://.* ]]; then
23+
[[ $EPNSYNCMODE == 1 ]] || { echo "Error fetching QC JSON $2: consul server is used for EPNSYNCMODE == 1 only" 1>&2 && exit 1; }
2324
TMP_FILENAME=$FETCHTMPDIR/$1.$RANDOM.$RANDOM.json
2425
curl -s -o $TMP_FILENAME "http://${GEN_TOPO_QC_CONSUL_SERVER}:8500/v1/kv/${2/consul:\/\//}?raw"
2526
if [[ $? != 0 ]]; then
26-
echo "Error fetching QC JSON $2"
27+
echo "Error fetching QC JSON $2" 1>&2
2728
exit 1
2829
fi
2930
elif [[ ${2} =~ ^apricot://.* ]]; then
31+
[[ $EPNSYNCMODE == 1 ]] || { echo "Error fetching QC JSON $2: apricot server is used for EPNSYNCMODE == 1 only" 1>&2 && exit 1; }
3032
TMP_FILENAME=$FETCHTMPDIR/$1.$RANDOM.$RANDOM.json
31-
if [[ ${2} =~ "?" ]]; then
32-
curl -s -o $TMP_FILENAME "${GEN_TOPO_QC_APRICOT_SERVER}/${2/apricot:\/\/o2\//}\&run_type=${RUNTYPE:-}\&beam_type=${BEAMTYPE:-}\&process=true"
33-
else
34-
curl -s -o $TMP_FILENAME "${GEN_TOPO_QC_APRICOT_SERVER}/${2/apricot:\/\/o2\//}?run_type=${RUNTYPE:-}\&beam_type=${BEAMTYPE:-}\&process=true"
35-
fi
33+
if [[ ${2} =~ "?" ]]; then
34+
curl -s -o $TMP_FILENAME "${GEN_TOPO_QC_APRICOT_SERVER}/${2/apricot:\/\/o2\//}\&run_type=${RUNTYPE:-}\&beam_type=${BEAMTYPE:-}\&process=true"
35+
else
36+
curl -s -o $TMP_FILENAME "${GEN_TOPO_QC_APRICOT_SERVER}/${2/apricot:\/\/o2\//}?run_type=${RUNTYPE:-}\&beam_type=${BEAMTYPE:-}\&process=true"
37+
fi
3638

3739
if [[ $? != 0 ]]; then
38-
echo "Error fetching QC JSON $2"
40+
echo "Error fetching QC JSON $2" 1>&2
3941
exit 1
4042
fi
4143
else

0 commit comments

Comments
 (0)