forked from NSLS-II/lsdc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
daq_main2.py
executable file
·47 lines (42 loc) · 1.37 KB
/
daq_main2.py
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
#!/opt/conda_envs/lsdc-server-2021-1.3/bin/ipython -i
"""
The main server for the LSDC system
"""
import sys
import os
from daq_main_common import pybass_init, run_server
#TODO understand why imports are required here - GUI requires imports in daq_main_common
from daq_macros import *
from daq_lib import *
from robot_lib import *
from beamline_lib import *
import logging
from logging import handlers
logger = logging.getLogger()
logging.getLogger().setLevel(logging.INFO)
logging.getLogger('ophyd').setLevel(logging.WARN)
logging.getLogger('caproto').setLevel(logging.WARN)
handler1 = handlers.RotatingFileHandler('lsdcServerLog.txt', maxBytes=5000000, backupCount=100)
handler2 = handlers.RotatingFileHandler('/var/log/dama/%slsdcServerLog.txt' % os.environ['BEAMLINE_ID'], maxBytes=5000000, backupCount=100)
myformat = logging.Formatter('%(asctime)s %(name)-8s %(levelname)-8s %(message)s')
handler1.setFormatter(myformat)
handler2.setFormatter(myformat)
logger.addHandler(handler1)
logger.addHandler(handler2)
sitefilename = ""
global command_list,immediate_command_list,z
command_list = []
immediate_command_list = []
z = 25
def main(mode):
pybass_init()
if (mode=="gui"):
run_server()
else:
lsdcHome = os.environ["LSDCHOME"]
os.system(lsdcHome+"/daq_main2.py gui&")
if (len(sys.argv)>1):
if (sys.argv[1] == "gui"):
main(mode="gui")
else:
main(mode="shell")