Runner seems to work with running the pipeline when launch from within
[htsworkflow.git] / gaworkflow / runner.py
index 5eb625b863933b4dd5ffa43f1c934211b0126eb1..d5bde94eff90d0bb9f41ab1984b544c610ff4a52 100644 (file)
@@ -11,7 +11,8 @@ from benderjab import rpc
 from gaworkflow.pipeline.configure_run import *
 from gaworkflow.pipeline.monitors import startCmdLineStatusMonitor
 
-s_fc = re.compile('FC[0-9]+')
+#s_fc = re.compile('FC[0-9]+')
+s_fc = re.compile('_[0-9a-zA-Z]*$')
 
 
 def _get_flowcell_from_rundir(run_dir):
@@ -25,7 +26,7 @@ def _get_flowcell_from_rundir(run_dir):
         logging.error('RunDir 2 FlowCell error: %s' % (run_dir))
         return None
 
-    return dirname[mo.start():]
+    return dirname[mo.start()+1:]
     
 
 
@@ -40,6 +41,7 @@ class Runner(rpc.XmlRpcBot):
         
         self.cfg['notify_users'] = None
         self.cfg['genome_dir'] = None
+        self.cfg['base_analysis_dir'] = None
 
         self.conf_info_dict = {}
         
@@ -51,6 +53,7 @@ class Runner(rpc.XmlRpcBot):
         super(Runner, self).read_config(section, configfile)
 
         self.genome_dir = self._check_required_option('genome_dir')
+        self.base_analysis_dir = self._check_required_option('base_analysis_dir')
         
     
     def _parser(self, msg, who):
@@ -98,7 +101,8 @@ class Runner(rpc.XmlRpcBot):
 
         # Setup config info object
         ci = ConfigInfo()
-        ci.run_path = run_dir
+        ci.base_analysis_dir = self.base_analysis_dir
+        ci.analysis_dir = os.path.join(self.base_analysis_dir, run_dir)        
 
         # get flowcell from run_dir name
         flowcell = _get_flowcell_from_rundir(run_dir)
@@ -128,8 +132,10 @@ class Runner(rpc.XmlRpcBot):
 
 
     def _runner(self, run_dir, flowcell, conf_info):
+
         # retrieve config step
-        cfg_filepath = os.path.abspath('config32auto.txt')
+        cfg_filepath = os.path.join(conf_info.analysis_dir,
+                                    'config32auto.txt')
         status_retrieve_cfg = retrieve_config(conf_info,
                                           flowcell,
                                           cfg_filepath,
@@ -142,7 +148,7 @@ class Runner(rpc.XmlRpcBot):
         
         # configure step
         if status_retrieve_cfg:
-            status = configure(ci)
+            status = configure(conf_info)
             if status:
                 logging.info("Runner: Configure: success")
             else:
@@ -155,7 +161,7 @@ class Runner(rpc.XmlRpcBot):
                 
                 # running step
                 print 'Running pipeline now!'
-                run_status = run_pipeline(ci)
+                run_status = run_pipeline(conf_info)
                 if run_status is True:
                     logging.info('Runner: Pipeline: success')
                     self.piplineFinished(run_dir)
@@ -175,7 +181,7 @@ class Runner(rpc.XmlRpcBot):
 
         
 def main(args=None):
-    bot = Runner()
+    bot = Runner('demobot')
     bot.cfg['loglevel'] = 'DEBUG'
     return bot.main(args)