--- /dev/null
+import urllib
+import urllib2
+import re
+import os
+
+def getWebPage(url,params):
+ pdata = urllib.urlencode(params)
+ req = urllib2.Request(url,pdata)
+ wpage = urllib2.urlopen(req)
+ restext = wpage.read()
+ wpage.close()
+ return restext
+
+
+def getConfigFile(fcid,runfolder):
+ #This function serves as well as a sync check between the datarun server and exp track web server
+ #By retrieving a valid config params set with valid input: fcid and runfolder we ensure that both servers are synch-ed
+
+ varStatus = 'getting conf file from exp trac server'
+ url = 'http://myerslab.stanford.edu/exp_track/getConfile'
+
+ params = {'user':'rami','fcid':fcid,'runf':runfolder}
+ readw = getWebPage(url,params)
+ #Check web response
+ tempstr = re.sub(pattern="\n",repl=", ",string=readw)
+ #match_str = re.compile(r"READ_LENGTH.+$")
+ match_str = re.compile('^READ_LENGTH.+')
+ if match_str.search(tempstr):
+ # create file in curret folder
+ folder = './'
+ file_path = os.path.join(folder,'config.txt')
+ f = open(file_path, 'w')
+ f.write(readw.replace(',','\n'))
+ f.close()
+ varStatus = 'OK. "config.txt" created. You can check it now.'
+ else:
+ varStatus = 'Failed reading valid Config Params in server reply:\n'+readw
+
+ return varStatus
+
+
+def getLanesNames(fcid):
+ varStatus = 'getting Lane Names'
+ url = 'http://myerslab.stanford.edu/exp_track/getLanesNames'
+
+ params = {'user':'rami','fcid':fcid}
+ readw = getWebPage(url,params)
+ #Check web response
+ tempstr = re.sub(pattern="\n",repl="",string=readw)
+ #match_str = re.compile(r"^<\?xml.+$")
+ match_str = re.compile('^<\?xml.+$')
+ if match_str.search(tempstr):
+ # create file in curret folder
+ folder = './'
+ file_path = os.path.join(folder,'LaneNames.xml')
+ f = open(file_path, 'w')
+ f.write(readw)
+ f.close()
+ varStatus = 'OK. LaneNames.xml created. CollectReads can use it now.'
+ else:
+ varStatus = 'Failed retrieving valid LaneNames.xml data. Server returned:\n'+readw
+
+ return varStatus
+
+def updExpTrack(fcid,runfolder,updStatus,updMsg):
+ url = 'http://myerslab.stanford.edu/exp_track/updStatus'
+
+ if len(updMsg) > 0:
+ params = {'user':'rami','fcid':fcid,'runf':runfolder,'updst':updStatus,'m\
+sg':updMsg}
+ print "Msg: "+updMsg
+ else:
+ params = {'user':'rami','fcid':fcid,'runf':runfolder,'updst':updStatus}
+ print "No Msg: "+len(updMsg).__str__()
+
+ readw = getWebPage(url,params)
+ return readw
+++ /dev/null
-import urllib
-import urllib2
-import re
-import os
-
-def getWebPage(url,params):
- pdata = urllib.urlencode(params)
- req = urllib2.Request(url,pdata)
- wpage = urllib2.urlopen(req)
- restext = wpage.read()
- wpage.close()
- return restext
-
-
-def getConfigFile(fcid,runfolder):
- #This function serves as well as a sync check between the datarun server and exp track web server
- #By retrieving a valid config params set with valid input: fcid and runfolder we ensure that both servers are synch-ed
-
- varStatus = 'getting conf file from exp trac server'
- url = 'http://myerslab.stanford.edu/exp_track/getConfile'
-
- params = {'user':'rami','fcid':fcid,'runf':runfolder}
- readw = getWebPage(url,params)
- #Check web response
- tempstr = re.sub(pattern="\n",repl=", ",string=readw)
- #match_str = re.compile(r"READ_LENGTH.+$")
- match_str = re.compile('^READ_LENGTH.+')
- if match_str.search(tempstr):
- # create file in curret folder
- folder = './'
- file_path = os.path.join(folder,'config.txt')
- f = open(file_path, 'w')
- f.write(readw.replace(',','\n'))
- f.close()
- varStatus = 'OK. "config.txt" created. You can check it now.'
- else:
- varStatus = 'Failed reading valid Config Params in server reply:\n'+readw
-
- return varStatus
-
-
-def getLanesNames(fcid):
- varStatus = 'getting Lane Names'
- url = 'http://myerslab.stanford.edu/exp_track/getLanesNames'
-
- params = {'user':'rami','fcid':fcid}
- readw = getWebPage(url,params)
- #Check web response
- tempstr = re.sub(pattern="\n",repl="",string=readw)
- #match_str = re.compile(r"^<\?xml.+$")
- match_str = re.compile('^<\?xml.+$')
- if match_str.search(tempstr):
- # create file in curret folder
- folder = './'
- file_path = os.path.join(folder,'LaneNames.xml')
- f = open(file_path, 'w')
- f.write(readw)
- f.close()
- varStatus = 'OK. LaneNames.xml created. CollectReads can use it now.'
- else:
- varStatus = 'Failed retrieving valid LaneNames.xml data. Server returned:\n'+readw
-
- return varStatus
-
-def updExpTrack(fcid,runfolder,updStatus,updMsg):
- url = 'http://myerslab.stanford.edu/exp_track/updStatus'
-
- if len(updMsg) > 0:
- params = {'user':'rami','fcid':fcid,'runf':runfolder,'updst':updStatus,'m\
-sg':updMsg}
- print "Msg: "+updMsg
- else:
- params = {'user':'rami','fcid':fcid,'runf':runfolder,'updst':updStatus}
- print "No Msg: "+len(updMsg).__str__()
-
- readw = getWebPage(url,params)
- return readw
import sys
try:
- from exp_track_comm import *
+ from htswdataprod.exp_track_comm import *
except ImportError:
sys.stderr.write("\nError: Can't find the file 'exp_track_comm.py' in the directory containing %r.")
sys.exit(1);