Makefile.in 3.52 KiB
SHELL := /bin/bash
STANDARD_TAGS := "IO_EVT, IO_SUM, IO_TSL, IO_TSL0, IO_TSL1, IO_TSL2, IO_TSSN, MSG, IO_MONIT"
LIGIER := $(shell command -v JLigier 2> /dev/null)
ifndef LIGIER
LIGIER := "SJ\ JLigier"
endif
default: build
build:
pip install -Ur requirements.txt
start:
@echo Creating tmux session...
@tmux new-session -d -s ${SESSION_NAME} \
|| (echo Run \"make stop\" to close the current session.; exit 1)
@tmux rename-window -t ${SESSION_NAME}:1 main
@tmux split-window -v -t ${SESSION_NAME}:main
@tmux split-window -v -t ${SESSION_NAME}:main
@echo Launching our own ligier
@#
@tmux send-keys -t ${SESSION_NAME}:main.1 \
"${LIGIER} -d2 -P ${MONITORING_LIGIER_PORT}" Enter
@sleep 1 # wait a second for JLigier
@echo Setting up the ligier mirror
@#
@tmux send-keys -t ${SESSION_NAME}:main.2 \
"ligiermirror -m \"${STANDARD_TAGS}\"" \
" -q ${MONITORING_LIGIER_PORT}" \
" -p ${DAQ_LIGIER_PORT} ${DAQ_LIGIER_IP}" \
Enter
@echo Starting the web server on 0.0.0.0:${WEBSERVER_PORT}
@#
@tmux send-keys -t ${SESSION_NAME}:main.3 \
"gunicorn -w 4 -b 0.0.0.0:${WEBSERVER_PORT} km3mon:app" Enter
@tmux select-layout even-vertical
@echo Starting the monitoring scripts
@sleep 3
@# DOM activity and DOM rates
@#
@tmux new-window -n doms -t ${SESSION_NAME}
@tmux split-window -v -t ${SESSION_NAME}:doms
@tmux send-keys -t ${SESSION_NAME}:doms.1 \
"python scripts/dom_activity.py -d ${DETECTOR_ID} -p ${MONITORING_LIGIER_PORT}" Enter
@tmux send-keys -t ${SESSION_NAME}:doms.2 \
"python scripts/dom_rates.py -d ${DETECTOR_ID} -p ${MONITORING_LIGIER_PORT}" Enter
@tmux select-layout even-vertical
@# PMT rates and HRV
@#
@tmux new-window -n pmts -t ${SESSION_NAME}
@tmux split-window -v -t ${SESSION_NAME}:pmts
@tmux send-keys -t ${SESSION_NAME}:pmts.1 \
"python scripts/pmt_rates.py -d ${DETECTOR_ID} -p ${MONITORING_LIGIER_PORT} -i 20 -u 1" Enter
@tmux send-keys -t ${SESSION_NAME}:pmts.2 \
"python scripts/pmt_hrv.py -d ${DETECTOR_ID} -p ${MONITORING_LIGIER_PORT} -i 20 -u 1" Enter
@tmux select-layout even-vertical
@# Trigger rates
@#
@tmux new-window -n trigger -t ${SESSION_NAME}
@tmux split-window -v -t ${SESSION_NAME}:trigger
@tmux send-keys -t ${SESSION_NAME}:trigger.1 \
"python scripts/trigger_rates.py -p ${MONITORING_LIGIER_PORT}" Enter
@tmux send-keys -t ${SESSION_NAME}:trigger.2 \
"python scripts/live_triggermap.py -d ${DETECTOR_ID} -p ${MONITORING_LIGIER_PORT}" Enter
@tmux select-layout even-vertical
@# ZT-Plots
@#
@tmux new-window -n ztplots -t ${SESSION_NAME}
@tmux split-window -v -t ${SESSION_NAME}:ztplots
@tmux send-keys -t ${SESSION_NAME}:ztplots.1 \
"python scripts/ztplot.py -d ${DETECTOR_ID} -p ${MONITORING_LIGIER_PORT}" Enter
@tmux send-keys -t ${SESSION_NAME}:ztplots.2 \
"echo narf"
@tmux select-layout even-vertical
@# AHRS
@#
@tmux new-window -n ahrs -t ${SESSION_NAME}
@tmux split-window -v -t ${SESSION_NAME}:ahrs
@tmux send-keys -t ${SESSION_NAME}:ahrs.1 \
"python scripts/ahrs_calibration.py -d ${DETECTOR_ID} -p ${MONITORING_LIGIER_PORT}" Enter
@tmux select-layout even-vertical
@# Log.io
@#
@tmux new-window -n logio -t ${SESSION_NAME}
@tmux split-window -v -t ${SESSION_NAME}:logio
@tmux send-keys -t ${SESSION_NAME}:logio.1 \
"python scripts/logio.py -p ${MONITORING_LIGIER_PORT} -x ${LOGIO_IP} -q ${LOGIO_PORT}" Enter
@tmux select-layout even-vertical
stop:
tmux kill-session -t ${SESSION_NAME}
killall gunicorn
clean:
rm Makefile
.PHONY: build start stop clean