Commit 9d592c4d authored by Manuela Kuhn's avatar Manuela Kuhn
Browse files

TangoServer writes config file

parent 2f3f06f4
#!/usr/bin/env python
import socket
import sys
port = 50900
msgs = [
"set localTarget /space/projects/zeromq-data-transfer/data/target",
"get localTarget",
"set detectorDevice haspp06:10000/p06/eigerdectris/exp.01",
"set filewriterDevice haspp06:10000/p06/eigerfilewriter/exp.01",
"set historySize 0",
"set storeData True",
"set removeData True",
"set whitelist ['localhost',zitpcx19282]",
"do start",
"exit",
]
host = socket.gethostname()
sckt = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
sckt.connect((host, port))
except Exception, e:
print "connect() failed", e
sckt.close()
sys.exit()
for msg in msgs:
sckt.send( msg)
print "sent (len %2d): %s" % (len(msg), msg)
reply = sckt.recv(1024)
print "recv (len %2d): %s " % (len( reply), reply)
sckt.close()
......@@ -2,16 +2,17 @@
#
import thread, os, socket
PORT = 7651
PORT = 50900
#
# assume that the server listening to 7651 serves p09
#
port2BL = {
"7650": "P08"
"7651": "P09",
"7652": "P10",
"7653": "P11"}
"50900": "P08",
"50901": "P09",
"50902": "P10",
"50903": "P11"
}
class ZmqDT():
......@@ -196,36 +197,68 @@ class ZmqDT():
#
# see, if all required params are there.
#
if self.FileDir
and self.FilePrefix
and self.FilePostfix:
if self.detectorDevice
and self.filewriterDevice
# TODO replace TangoDevices with the following
#and self.eigerIp
and self.historySize
and self.localTarget
and self.storeData
and self.removeData
and self.whitelist:
#
# execute the start action ...
#
# if (self.detectorDevice
# and self.filewriterDevice
# # TODO replace TangoDevices with the following
# #and self.eigerIp
# and self.historySize
# and self.localTarget
# and self.storeData
# and self.removeData
# and self.whitelist ):
# write configfile
# /etc/zeromq-data-transfer/P01.conf
#
# execute the start action ...
#
# start service
#systemctl start zeromq-data-transfer@P01.service
# write configfile
# /etc/zeromq-data-transfer/P01.conf
configFile = "/space/projects/zeromq-data-transfer/conf/" + self.beamline + ".conf"
with open(configFile, 'w') as f:
f.write("logfilePath = /space/projects/zeromq-data-transfer/logs" + "\n")
f.write("logfileName = dataManager.log" + "\n")
f.write("logfileSize = 10485760" + "\n")
f.write("procname = zeromq-data-transfer" + "\n")
f.write("comPort = 50000" + "\n")
f.write("requestPort = 50001" + "\n")
# f.write("eventDetectorType = HttpDetector" + "\n")
f.write("eventDetectorType = InotifyxDetector" + "\n")
f.write("fixSubdirs = ['commissioning', 'current', 'local']" + "\n")
f.write("monitoredDir = /space/projects/zeromq-data-transfer/data/source" + "\n")
f.write("monitoredEventType = IN_CLOSE_WRITE" + "\n")
f.write("monitoredFormats = ['.tif', '.cbf']" + "\n")
f.write("useCleanUp = False" + "\n")
f.write("actionTime = 150" + "\n")
f.write("timeTillClosed = 2" + "\n")
# f.write("dataFetcherType = getFromHttp" + "\n")
f.write("dataFetcherType = getFromFile" + "\n")
f.write("chunkSize = 10485760" + "\n")
f.write("detectorDevice = " + str(self.detectorDevice) + "\n")
f.write("filewriterDevice = " + str(self.filewriterDevice) + "\n")
# TODO replace TangoDevices with the following
#f.write("eigerIp = " + str(self.eigerIp) + "\n")
f.write("historySize = " + str(self.historySize) + "\n")
f.write("localTarget = " + str(self.localTarget) + "\n")
f.write("storeData = " + str(self.storeData) + "\n")
f.write("removeData = " + str(self.removeData) + "\n")
f.write("whitelist = " + str(self.whitelist) + "\n")
# start service
#systemctl start zeromq-data-transfer@P01.service
# python src/sender/DataManager.py --verbose --procname self.procname --detectorDevice self.detectorDevice --filewriterDevice self.filewriterDevice --historySize self.historySize --localTarget self.localTarget --storeData self.storeData --removeData self.removeData --whitelist self.whitelist
return "DONE"
return "DONE"
else:
return "ERROR"
# else:
# print "if failed"
# return "ERROR"
def stop (self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment