[Swift-commit] r3015 - SwiftApps/SIDGrid/scripts

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Fri Jul 17 09:33:53 CDT 2009


Author: skenny
Date: 2009-07-17 09:33:53 -0500 (Fri, 17 Jul 2009)
New Revision: 3015

Modified:
   SwiftApps/SIDGrid/scripts/Mediator.py
Log:
fixed ranger for ts batch

Modified: SwiftApps/SIDGrid/scripts/Mediator.py
===================================================================
--- SwiftApps/SIDGrid/scripts/Mediator.py	2009-07-15 20:01:42 UTC (rev 3014)
+++ SwiftApps/SIDGrid/scripts/Mediator.py	2009-07-17 14:33:53 UTC (rev 3015)
@@ -17,11 +17,14 @@
         self.db_name = ""
         self.host = ""
         self.query = ""
+        self.subquery = ""
         self.r_swift_args = ""
         self.r_script = ""
         self.r_infile = ""
         self.begin_vox = "1"
         self.end_vox = "2"
+        self.begin_ts = "-1"
+        self.end_ts = "-1"
         self.vox = -1
         self.subject = ""
         self.batchstep = "1"
@@ -114,10 +117,16 @@
                 self.batchstep = argstr[i+1]
             elif o == "--outprefix":
                 self.outprefix = argstr[i+1]
+            elif o == "--begin_ts":
+                self.begin_ts = argstr[i+1]
+            elif o == "--end_ts":
+                self.end_ts = argstr[i+1]
             elif o == "--vox_file":
                 self.voxfile = argstr[i+1]
             elif o == "--vox":
                 self.vox = argstr[i+1]
+            elif o == "--subquery":
+                self.subquery = argstr[i+1]
             elif (o.find("--")>-1):
                 print "o is this "+o
                 print "and i is this "+str(i)
@@ -130,7 +139,7 @@
     def gethelp(self,option):
         helpmsg = """
         Unknown Option: """+option+"""
-        usage:  --user, --conf, --db, --host, --query, --r_swift_args, --r_script, --r_infile, --outprefix, --begin_vox, --end_vox, --batchstep, --vox
+        usage:  --db --user --conf --host --query --r_swift_args --rscript --r_infile --begin_vox --end_vox --subject --batchstep --outprefix --vox_file --vox --begin_ts --end_ts --subquery
         """
         return helpmsg
         
@@ -158,8 +167,23 @@
         if(self.vox > -1):
             tmp = self.query.replace("VOX",str(self.vox))
             tmp2 = tmp.replace("SUBJECT", self.subject)
-            self.all_queries.append(tmp2)
-            self.qout_r_args.append(str(self.vox))
+            if(self.begin_ts < 0):
+                self.all_queries.append(tmp2)
+                self.qout_r_args.append(str(self.vox))
+            else:
+                self.query = tmp
+        if(self.begin_ts > -1):
+            bgn = int(self.begin_ts)
+            end = int(self.end_ts)
+            querystr = ""
+            for h in range(bgn,end):
+                tmp = self.subquery.replace("TSVAR", str(h))
+                querystr = querystr+tmp+", "
+            querystr = querystr+self.subquery.replace("TSVAR", str(end))
+            querystr = self.query.replace("SUBQUERY", querystr)
+            self.all_queries.append(querystr)
+            self.qout_r_args.append("NULL")
+                
         else:
             bgn = int(self.begin_vox)
             end = int(self.end_vox)




More information about the Swift-commit mailing list