From: Brandon King Date: Fri, 4 Jan 2008 22:04:44 +0000 (+0000) Subject: Runner seems to work with running the pipeline when launch from within X-Git-Tag: 0.1.0~21 X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=62f2de44d1f32f3ed336d5334cee0bf17f3b97ba Runner seems to work with running the pipeline when launch from within 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. --- diff --git a/gaworkflow/pipeline/configure_run.py b/gaworkflow/pipeline/configure_run.py index 448576d..1db662c 100644 --- a/gaworkflow/pipeline/configure_run.py +++ b/gaworkflow/pipeline/configure_run.py @@ -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() diff --git a/gaworkflow/pipeline/run_status.py b/gaworkflow/pipeline/run_status.py index 5f313a6..8e19c01 100644 --- a/gaworkflow/pipeline/run_status.py +++ b/gaworkflow/pipeline/run_status.py @@ -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) diff --git a/gaworkflow/runner.py b/gaworkflow/runner.py index ce27d72..d5bde94 100644 --- a/gaworkflow/runner.py +++ b/gaworkflow/runner.py @@ -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, diff --git a/scripts/configure_pipeline b/scripts/configure_pipeline index b512604..c70f319 100644 --- a/scripts/configure_pipeline +++ b/scripts/configure_pipeline @@ -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