Example #1
0
def run(options, **extra_options):
    """
    Take action depending on options
    extra_options are passed (as appropriate to the underlying functions
    Returns True if pipeline_run
    """

    if options.just_print:
        appropriate_options = get_extra_options_appropriate_for_command(
            extra_pipeline_printout_options, extra_options)
        task.pipeline_printout(sys.stdout,
                               options.target_tasks,
                               options.forced_tasks,
                               verbose=options.verbose,
                               **appropriate_options)
        return False

    elif options.flowchart:
        appropriate_options = get_extra_options_appropriate_for_command(
            extra_pipeline_printout_graph_options, extra_options)
        task.pipeline_printout_graph(
            open(options.flowchart, "w"),
            options.flowchart_format,
            options.target_tasks,
            options.forced_tasks,
            draw_vertically=not options.draw_horizontally,
            no_key_legend=not options.key_legend_in_graph,
            **appropriate_options)
        return False
    else:
        if not "logger" in extra_options:
            extra_options["logger"] = None
        if extra_options["logger"] == False:
            extra_options["logger"] = task.black_hole_logger
        elif extra_options["logger"] == None:
            extra_options["logger"] = task.stderr_logger
        appropriate_options = get_extra_options_appropriate_for_command(
            extra_pipeline_run_options, extra_options)
        task.pipeline_run(options.target_tasks,
                          options.forced_tasks,
                          multiprocess=options.jobs,
                          verbose=options.verbose,
                          **appropriate_options)
        return True
Example #2
0
def run (options, **extra_options):
    """
    Take action depending on options
    extra_options are passed (as appropriate to the underlying functions
    Returns True if pipeline_run
    """


    if options.just_print:
        appropriate_options = get_extra_options_appropriate_for_command (extra_pipeline_printout_options, extra_options)
        task.pipeline_printout(sys.stdout, options.target_tasks, options.forced_tasks,
                                verbose=options.verbose, **appropriate_options)
        return False

    elif options.flowchart:
        appropriate_options = get_extra_options_appropriate_for_command (extra_pipeline_printout_graph_options, extra_options)
        task.pipeline_printout_graph (   open(options.flowchart, "w"),
                                        options.flowchart_format,
                                        options.target_tasks,
                                        options.forced_tasks,
                                        draw_vertically = not options.draw_horizontally,
                                        no_key_legend   = not options.key_legend_in_graph,
                                        **appropriate_options)
        return False
    else:
        if not "logger" in extra_options:
            extra_options["logger"] = None
        if extra_options["logger"] == False:
           extra_options["logger"] = task.black_hole_logger
        elif extra_options["logger"] == None:
            extra_options["logger"] = task.stderr_logger
        appropriate_options = get_extra_options_appropriate_for_command (extra_pipeline_run_options, extra_options)
        task.pipeline_run(  options.target_tasks,
                            options.forced_tasks,
                            multiprocess    = options.jobs,
                            verbose         = options.verbose,
                            **appropriate_options)
        return True
Example #3
0
def run (options, **extra_options):
    """
    Take action depending on options
    extra_options are passed (as appropriate to the underlying functions
    Returns True if pipeline_run
    """

    #
    #   be very defensive: these options names are use below. Make sure they already
    #       exist in ``options`` , even if they have a value of None
    #
    for attr_name in [  "just_print",
                        "verbose",
                        "flowchart",
                        "flowchart_format",
                        "target_tasks",
                        "forced_tasks",
                        "draw_horizontally",
                        "key_legend_in_graph",
                        "use_threads",
                        "jobs",
                        "recreate_database",
                        "touch_files_only",
                        "history_file" ]:
        if not hasattr(options, attr_name):
            setattr(options, attr_name, None)


    #
    #   touch files or not
    #
    if options.recreate_database:
        touch_files_only = CHECKSUM_REGENERATE
    elif options.touch_files_only:
        touch_files_only = True
    else:
        touch_files_only = False

    if options.just_print:
        appropriate_options = get_extra_options_appropriate_for_command (extra_pipeline_printout_options, extra_options)
        task.pipeline_printout(sys.stdout, options.target_tasks, options.forced_tasks,
                               history_file = options.history_file,
                                verbose=options.verbose, **appropriate_options)
        return False

    elif options.flowchart:
        appropriate_options = get_extra_options_appropriate_for_command (extra_pipeline_printout_graph_options, extra_options)
        task.pipeline_printout_graph (   open(options.flowchart, "w"),
                                        options.flowchart_format,
                                        options.target_tasks,
                                        options.forced_tasks,
                                         history_file = options.history_file,
                                        draw_vertically = not options.draw_horizontally,
                                        no_key_legend   = not options.key_legend_in_graph,
                                        **appropriate_options)
        return False
    else:

        #
        #   turn on multithread if --use_threads specified and --jobs > 1
        #       ignore if manually specified
        #
        if  (   options.use_threads
                # ignore if manual override
                and not "multithread" in extra_options
                and options.jobs and options.jobs > 1):
            multithread = options.jobs
        elif "multithread" in extra_options:
            multithread = extra_options["multithread"]
            del extra_options["multithread"]
        else:
            multithread = None


        if not "logger" in extra_options:
            extra_options["logger"] = None
        if extra_options["logger"] == False:
           extra_options["logger"] = task.black_hole_logger
        elif extra_options["logger"] == None:
            extra_options["logger"] = task.stderr_logger
        appropriate_options = get_extra_options_appropriate_for_command (extra_pipeline_run_options, extra_options)
        task.pipeline_run(  options.target_tasks,
                            options.forced_tasks,
                            multiprocess    = options.jobs,
                            multithread     = multithread,
                            verbose         = options.verbose,
                            touch_files_only= touch_files_only,
                            history_file = options.history_file,
                            **appropriate_options)
        return True