-
Notifications
You must be signed in to change notification settings - Fork 12
/
run-dev.sh
executable file
·48 lines (36 loc) · 1.14 KB
/
run-dev.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# Bash script for running HDQM as
if [ "$1" == "-h" ] || [ "$1" == "--help" ];
then
echo "Runs HDQM's various services."
echo ""
echo " run.sh api: Runs the API server. Default port is $PORT Select another one by passing it"
echo " as an argument after the command (e.g. run.sh api 6000)"
echo ""
echo " run.sh extract: Runs the dqm_extractor.py script."
exit
fi
source .env
# Activate venv
if [ ! -d venv ]; then
echo "Virtual environment not found! Run update.sh first."
exit
fi
if [ "$1" = "api" ]; then
source venv/bin/activate
PORT=5000
if [ "$2" ]; then
PORT=$2
fi
# No need to bind to 0.0.0.0, we have an nginx to take care of
# exposing the port.
gunicorn --workers=`nproc` 'backend.api:create_app()' --bind=127.0.0.1:$PORT
elif [ "$1" = "extract" ]; then
source venv/bin/activate
# Source ROOT activation script from CVMFS
. /cvmfs/sft.cern.ch/lcg/app/releases/ROOT/6.24.08/x86_64-centos7-gcc48-opt/bin/thisroot.sh
# Authenticate with kerberos to access EOS
kinit -kt /data/hdqm/.keytab cmsdqm
/usr/bin/eosfusebind -g
python3 backend/dqm_extractor.py
fi