Skip to content

Commit 0f4a27e

Browse files
committed
ENH: re-implement fez host search using updated sdfconfig
1 parent ce0ebc3 commit 0f4a27e

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

scripts/restartdaq

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,21 @@ cd /reg/g/pcds/dist/pds/"$HUTCH"/scripts/ || exit
8888
DAQNETWORK='fez'
8989
PROCMGR="/reg/g/pcds/dist/pds/$HUTCH/current/tools/procmgr/procmgr"
9090

91-
if [ "$IS_DAQ_HOST" == 0 ]; then
92-
# There is currently no suitable way to find daq-compatible hosts in sdfconfig
93-
# Maybe this will work in the future, disable for now and have worse UX
94-
# HOSTS=$(sdfconfig search --type subnet PCDSN-${DAQNETWORK^^}-${HUTCH^^} --brief)
95-
# WORKINGHOSTS=''
96-
# #make sure at least cds is up.
97-
# for HOST in $HOSTS; do
98-
# if [[ $(ping -w 2 "$HOST" >/dev/null 2>&1) == 0 ]]; then
99-
# WORKINGHOSTS=$WORKINGHOSTS' '$HOST
100-
# fi
101-
# done
102-
# Placeholder less useful message:
103-
echo "$AIMHOST" does not have "$DAQNETWORK", please choose a server with "$DAQNETWORK"
104-
# echo "$AIMHOST" does not have "$DAQNETWORK", please choose one of the following machines to run the DAQ: "$WORKINGHOSTS"
105-
echo "restartdaq -m <machine_with_$DAQNETWORK>"
91+
if [ "${IS_DAQ_HOST}" == 0 ]; then
92+
HOSTS="$(sdfconfig search --brief --type subnet PCDSN-"${DAQNETWORK^^}"-"${HUTCH^^}")"
93+
WORKINGHOSTS=""
94+
for HOST in $HOSTS; do
95+
# Only consider hosts that start with hutch-, e.g. xpp-control, xcs-daq
96+
if [[ "${HOST}" == "${HUTCH}"-* ]]; then
97+
# Make sure cds intf is up via ping
98+
# Remove trailing .pcdsn to switch from fqdn to hostname
99+
if ping -w 2 "${HOST%.pcdsn}" &> /dev/null; then
100+
WORKINGHOSTS="${WORKINGHOSTS} ${HOST%.pcdsn}"
101+
fi
102+
fi
103+
done
104+
echo "${AIMHOST} does not have ${DAQNETWORK}, please choose one of the following machines to run the DAQ:${WORKINGHOSTS}"
105+
echo "restartdaq -m <machine_with_${DAQNETWORK}>"
106106
exit
107107
fi
108108

0 commit comments

Comments
 (0)