-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunFastDP.py
More file actions
executable file
·66 lines (57 loc) · 1.98 KB
/
runFastDP.py
File metadata and controls
executable file
·66 lines (57 loc) · 1.98 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/opt/conda_envs/lsdc_dev3/bin/python
##!/usr/bin/python
import time
import os
import sys
import db_lib
import xmltodict
import daq_utils
def generateSpotsFileFromXMLObsolete(fastdpXmlFilename="fast_dp.xml"): #no idea what this is - 6/16
tree = ET.parse(fastdpXmlFilename)
root = tree.getroot()
for i in range (0,len(root)):
dataFileName = root[i].find("image").text
spots = int(root[i].find("spot_count").text)
grid_spots_file.write("%d %s\n" % (spots,dataFileName))
grid_spots_file.close()
directory = sys.argv[1]
runningDir = directory+"/fastDPOutput"
comm_s = "mkdir -p " + runningDir
os.system(comm_s)
os.chdir(runningDir)
filePrefix = sys.argv[2]
numstart = int(sys.argv[3])
numimages = int(sys.argv[4])
request_id = int(sys.argv[5])
runFastEP = int(sys.argv[6])
expectedFilenameList = []
timeoutLimit = 600 #for now
prefix_long = directory+"/"+filePrefix
for i in range (numstart,numstart+numimages):
filename = daq_utils.create_filename(prefix_long,i)
expectedFilenameList.append(filename)
#for i in range (0,len(expectedFilenameList)):
# print expectedFilenameList[i]
timeout_check = 0
while(not os.path.exists(expectedFilenameList[len(expectedFilenameList)-1])): #this waits for images
timeout_check = timeout_check + 1
time.sleep(1.0)
if (timeout_check > timeoutLimit):
break
node = "cpu-004"
comm_s = "ssh -q " + node + " \"cd " + runningDir +";source /nfs/skinner/wrappers/fastDPWrap;fast_dp -1 3 " + expectedFilenameList[0] + "\""
#comm_s = "fast_dp " + expectedFilenameList[0] #note this the first image
print(comm_s)
os.system(comm_s)
fd = open("fast_dp.xml")
#nresult = {}
#result["timestamp"] = time.time()
#result["type"] = "fastDP"
resultObj = xmltodict.parse(fd.read())
#result["resultObj"] = resultObj
db_lib.addResultforRequest("fastDP",request_id,resultObj)
print("finished fast_dp")
if (runFastEP):
comm_s = "ssh -q " + node + " \"cd " + runningDir +";source /nfs/skinner/wrappers/fastDPWrap;fast_ep"
print("running fast_ep")
os.system(comm_s)