Skip to content

Commit

Permalink
Prepare QC json fetching from apricot
Browse files Browse the repository at this point in the history
  • Loading branch information
martenole committed Jun 3, 2024
1 parent b7121a9 commit 86e139d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
16 changes: 16 additions & 0 deletions DATA/common/gen_topo_helper_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ if [[ "${GEN_TOPO_DEPLOYMENT_TYPE:-}" == "ALICE_STAGING" ]]; then
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"`

add_QC_from_consul()
{
Expand All @@ -268,4 +269,19 @@ add_QC_from_consul()
add_W o2-qc "--config $QC_CONFIG_ARG $2"
}

add_QC_from_apricot()
{
if [[ ! -z ${GEN_TOPO_QC_JSON_FILE:-} ]]; then
curl -s -o $GEN_TOPO_QC_JSON_FILE "${GEN_TOPO_QC_APRICOT_SERVER}/${1}?process=true"
if [[ $? != 0 ]]; then
echo "Error fetching QC JSON $1"
exit 1
fi
QC_CONFIG_ARG="json://${GEN_TOPO_QC_JSON_FILE}"
else
QC_CONFIG_ARG="apricot://${GEN_TOPO_QC_APRICOT_SERVER}$1"
fi
add_W o2-qc "--config $QC_CONFIG_ARG $2"
}

fi # functions.sh sourced
7 changes: 7 additions & 0 deletions DATA/production/qc-workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ add_QC_JSON() {
echo "Error fetching QC JSON $2"
exit 1
fi
elif [[ ${2} =~ ^apricot://.* ]]; then
TMP_FILENAME=$FETCHTMPDIR/$1.$RANDOM.$RANDOM.json
curl -s -o $TMP_FILENAME "${GEN_TOPO_QC_APRICOT_SERVER}/${2/apricot:\/\/o2\//}?process=true"
if [[ $? != 0 ]]; then
echo "Error fetching QC JSON $2"
exit 1
fi
else
TMP_FILENAME=$2
fi
Expand Down

0 comments on commit 86e139d

Please sign in to comment.