continuing the try to make the MainPScript run sucessfully from the bot
authorUnknown Author <unknown>
Thu, 7 Aug 2008 00:16:19 +0000 (00:16 +0000)
committerUnknown Author <unknown>
Thu, 7 Aug 2008 00:16:19 +0000 (00:16 +0000)
htswdataprod/htswdataprod/automation/runner_s.py

index 441003afa63bb228bf5b83367020a3b4b8415f21..08ca1c7df58932878358f0c1206fe02d31ba6e4c 100644 (file)
@@ -74,9 +74,9 @@ class Runner(rpc.XmlRpcBot):
         # Start run
         elif re.match(u"start", msg):
             words = msg.split()
-            if len(words) == 2:
-                self.sequencingFinished(words[1])
-                reply = u"starting run for %s" % (words[1])
+            if len(words) == 3:
+                self.sequencingFinished(words[1],words[2])
+                reply = u"starting run for FCID: %s and RunFolder: %s" % (words[1],words[2])
             else:
                 reply = u"need runfolder name"
         else:
@@ -94,7 +94,7 @@ class Runner(rpc.XmlRpcBot):
         return 'StatusReport: Not implemented'
     
             
-    def sequencingFinished(self, flowcell):
+    def sequencingFinished(self, run_dir, flowcell):
         """
         Sequenceing (and copying) is finished, time to start pipeline
         
@@ -102,7 +102,7 @@ class Runner(rpc.XmlRpcBot):
         """
         logging.debug("received sequencing finished message")
 
-        self.launchJob(flowcell)
+        self.launchJob(run_dir, flowcell)
         return "started"
         
         
@@ -126,7 +126,7 @@ class Runner(rpc.XmlRpcBot):
                 self.send(u, msg)
 
 
-    def _runner(self, flowcell):
+    def _runner(self,run_dir,flowcell):
 
         # retrieve config step
         # example error message
@@ -144,11 +144,11 @@ class Runner(rpc.XmlRpcBot):
         ferr = open(stderr_filepath, 'w')
         
         pipe = subprocess.Popen(['./MainPipelineScript',
-                                '%s' % (flowcell)],
+                                '%s' % (flowcell),'%s' % (os.path.join(self.base_analysis_dir,run_dir))],
                                 stdout=fout,
                                 stderr=ferr)
       
-        print "Attempting run at: %s" % (time.ctime())
+        self.reportMsg("Attempting run at: %s" % (time.ctime()))
         error_code = pipe.wait()
         
         self.reportMsg("Return code is: %s" % (error_code))
@@ -157,13 +157,16 @@ class Runner(rpc.XmlRpcBot):
         fout.close()
         ferr.close()
 
-
-    def launchJob(self, flowcell):
+        fout = open(stdout_filepath, 'r')
+        self.reportMsg(fout.read())
+        fout.close()       
+    def launchJob(self, run_dir,flowcell):
         """
         Starts up a thread for running the pipeline
         """
         t = threading.Thread(target=self._runner,
-                        args=[flowcell])
+                        args=[run_dir,flowcell])
         t.setDaemon(True)
         t.start()