예제 #1
0
 def setUp(self):
     templated.template_dir=os.path.normpath(os.path.abspath(__file__)+"/../../fixtures/templates")
     RnaseqGlobals.initialize(__file__, testing=True)
     RnaseqGlobals.set_conf_value('force',True)
     RnaseqGlobals.set_conf_value('silent',True)
     readset=Readset.load(RnaseqGlobals.root_dir()+'/t/fixtures/readsets/readset1.syml')[0]
     self.pipeline=Pipeline(name='filter', readset=readset)
예제 #2
0
    def make_run_objects(self, session):
        #self=self.store_db()
        try: verbose=os.environ['DEBUG']
        except: debug=False
        
        # create the pipeline_run object:
        try: 
            label=RnaseqGlobals.conf_value('label') or self.readset.label
        except AttributeError as ae:
            raise UserError("No label defined.  Please specify a label for the pipeline run, either in the readset or using the '--label' command line option")

        pipeline_run=PipelineRun(status='standby',
                                 input_file=', '.join(self.readset.reads_files),
                                 user=RnaseqGlobals.conf_value('user'),
                                 label=label,
                                 working_dir=self.readset.working_dir)

        self.pipeline_runs.append(pipeline_run)
#        print "mro: self.pipeline_runs is %s" % ", ".join(str(x.id) for x in self.pipeline_runs)
#        try: warn("pipeline.id is %s" % pipeline.id)
#        except: warn("pipeline has no id")
        self=session.merge(self)
        session.commit()                
        if pipeline_run.id==None:
            raise ProgrammerGoof("no id in %s" % pipeline_run)

        self.context.pipeline_run_id=pipeline_run.id
        RnaseqGlobals.set_conf_value('pipeline_run_id',pipeline_run.id)
        
        # create step_run objects:
        step_runs={}
        for step in self.steps:
            if step.is_prov_step: continue
            step_run=StepRun(step_name=step.name, status='standby')
            for output in step.output_list():
                output=evoque_template(output, step, self.readset)
                step_run.file_outputs.append(FileOutput(path=output))

            if step.skip:               # as set by self.set_steps_current()
                if debug: print "step %s is current, skipping" % step.name
                step_run.status='skipped'
                step_run.success=True

            pipeline_run.step_runs.append(step_run)
            session.commit()
            pipeline_run.step_runs.append(step_run) # maintains list in db as well
            step_runs[step.name]=step_run
            self.context.step_runs[step.name]=step_run

        session.commit()
        return (pipeline_run, step_runs)