Exemple #1
0
import logging
import os
import sys

from utils.pipeline_builder import PipelineBuilder


if __name__ == "__main__":

	try:
		# get the 'home' location of this file (the pipeline's 'home' location)
		pipeline_home = os.path.dirname(os.path.realpath(__file__))
	
		# build the pipeline:
		builder = PipelineBuilder(pipeline_home)
		builder.setup()
		builder.configure()
		configured_pipeline = builder.build()
		configured_pipeline.run()

	except Exception as ex:
		logging.error("Exception thrown.  Message: %s", ex.message)
		sys.exit(1)
	


        elif cmd_line_params.get('continue_pickle', None):
            append_to_syspath(pipeline_home)
            configured_pipeline = pickle.load(
                open(cmd_line_params.get('continue_pickle'), 'rb'))
            create_logger(
                configured_pipeline.project.parameters.get('output_location'))

            # alter the pipeline for the pending analysis:
            utils.continue_analysis.configure_for_restart(
                configured_pipeline,
                cmd_line_params.get('annotation_file', None),
                cmd_line_params.get('contrast_file', None))
        else:
            # build the pipeline:
            builder = PipelineBuilder(pipeline_home)
            builder.setup(cmd_line_params)
            create_logger(builder.builder_params.get('output_location'))
            builder.configure()
            configured_pipeline = builder.build()

        configured_pipeline.run()

        # if we are restarting, then it's possible that this component was already previously added.  If that is the case, then it was already executed when we called the run() method above.
        if not any(
            ['pdf_report' == c.name for c in configured_pipeline.components]):
            latex_report_component = Component(
                'pdf_report',
                os.path.join(
                    configured_pipeline.project.parameters.get(
                        'components_dir'), 'pdf_report'))
            latex_report_component.add_project_data(