Runner seems to work with running the pipeline when launch from within
authorBrandon King <kingb@caltech.edu>
Fri, 4 Jan 2008 22:04:44 +0000 (22:04 +0000)
committerBrandon King <kingb@caltech.edu>
Fri, 4 Jan 2008 22:04:44 +0000 (22:04 +0000)
any directory.
 * stdout/stderr output is saved in top level of the analysis directory.
 * Requires a base_analysis_dir to be set in bot config file (stating
   where all the analysis directories are stored.

gaworkflow/pipeline/configure_run.py
gaworkflow/pipeline/run_status.py
gaworkflow/runner.py
scripts/configure_pipeline

index 448576d1ec5b846d3374a89461b06b330605b0f5..1db662cbad456e3806bfe42995b3c057b980d6a0 100644 (file)
@@ -22,11 +22,18 @@ logging.basicConfig(level=logging.DEBUG,
 class ConfigInfo:
   
   def __init__(self):
+    #run_path = firecrest analysis directory to run analysis from
     self.run_path = None
     self.bustard_path = None
     self.config_filepath = None
     self.status = None
 
+    #top level directory where all analyses are placed
+    self.base_analysis_dir = None
+    #analysis_dir, top level analysis dir...
+    # base_analysis_dir + '/070924_USI-EAS44_0022_FC12150'
+    self.analysis_dir = None
+
 
   def createStatusObject(self):
     """
@@ -434,11 +441,11 @@ def configure(conf_info):
   #                        stdout=subprocess.PIPE,
   #                        stderr=subprocess.PIPE)
 
-  # CONTINUE HERE
-  #FIXME: this only does a run on 5 tiles on lane 4
 
-  stdout_filepath = "pipeline_configure_stdout.txt"
-  stderr_filepath = "pipeline_configure_stderr.txt"
+  stdout_filepath = os.path.join(conf_info.analysis_dir,
+                                 "pipeline_configure_stdout.txt")
+  stderr_filepath = os.path.join(conf_info.analysis_dir,
+                                 "pipeline_configure_stderr.txt")
 
   fout = open(stdout_filepath, 'w')
   ferr = open(stderr_filepath, 'w')
@@ -447,7 +454,7 @@ def configure(conf_info):
                     '--GERALD=%s' % (conf_info.config_filepath),
                            #'--tiles=s_4_0100,s_4_0101,s_4_0102,s_4_0103,s_4_0104',
                            '--make',
-                           '.'],
+                           conf_info.analysis_dir],
                           stdout=fout,
                           stderr=ferr)
 
@@ -530,9 +537,8 @@ def run_pipeline(conf_info):
     return False
 
   # Change cwd to run_path
-  os.chdir(conf_info.run_path)
-  stdout_filepath = os.path.join(conf_info.run_path, 'pipeline_run_stdout.txt')
-  stderr_filepath = os.path.join(conf_info.run_path, 'pipeline_run_stderr.txt')
+  stdout_filepath = os.path.join(conf_info.analysis_dir, 'pipeline_run_stdout.txt')
+  stderr_filepath = os.path.join(conf_info.analysis_dir, 'pipeline_run_stderr.txt')
 
   # Create status object
   conf_info.createStatusObject()
@@ -559,11 +565,12 @@ def run_pipeline(conf_info):
   ferr = open(stderr_filepath, 'w')
 
   pipe = subprocess.Popen(['make',
-                             '-j8',
-                             'recursive'],
-                             stdout=fout,
-                             stderr=ferr)
-                             #shell=True)
+                           '--directory=%s' % (conf_info.run_path),
+                           '-j8',
+                           'recursive'],
+                           stdout=fout,
+                           stderr=ferr)
+                           #shell=True)
   # Wait for run to finish
   retcode = pipe.wait()
 
index 5f313a62690392a3f66c9aac482dd4cf44f46a5a..8e19c0134cfe4e4284adc2be6855b47f586554c6 100644 (file)
@@ -127,7 +127,7 @@ class GARunStatus(object):
     during a run and provides methods for retrieving
     (completed, total) for each step or entire run.
     """
-
+    #print 'self._conf_filepath = %s' % (conf_filepath)
     self._conf_filepath = conf_filepath
     self._base_dir, junk = os.path.split(conf_filepath)
     self._image_dir = os.path.join(self._base_dir, 'Images')
@@ -201,7 +201,9 @@ class GARunStatus(object):
     """
     Figures out the number of cycles that are available
     """
+    #print 'self._image_dir = %s' % (self._image_dir)
     cycle_dirs = glob.glob(os.path.join(self._image_dir, 'L001', 'C*.1'))
+    #print 'cycle_dirs = %s' % (cycle_dirs)
     cycle_list = []
     for cycle_dir in cycle_dirs:
       junk, c = os.path.split(cycle_dir)
index ce27d72ad72247de199da8c95807d6856b7b95fc..d5bde94eff90d0bb9f41ab1984b544c610ff4a52 100644 (file)
@@ -41,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 = {}
         
@@ -52,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):
@@ -99,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)
@@ -131,7 +134,8 @@ 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,
index b5126047a4e00f56d66f62abedff1097471a88c4..c70f319beeebb54baef9446e47758b1d57b41fe7 100644 (file)
@@ -17,6 +17,8 @@ GENOME_DIR = '/data-store01/compbio/genomes/'
 
 def main(args=None):
   ci = ConfigInfo()
+  ci.analysis_dir = os.getcwd()
+  ci.base_analysis_dir, junk = os.path.split(ci.analysis_dir)
 
   #FIXME: make a better command line tool
   skip_retrieve_config = False