Exemple #1
0
def report(report_type, the_model, execution):
    """
    Output a report of the given type, for the given model and execution.
    """
    assert report_type in REPORT_TYPES
    if report_type != 'none':
        _LOGGER.output(get_header(" REPORTS ", "=", REPORT_HEADER_SIZE))
        if report_type == 'all' or report_type == 'model':
            _report_model(the_model)
        if report_type == 'all' or report_type == 'exec':
            _report_exec(execution)
        if report_type == 'all' or report_type == 'error':
            _report_error(execution)
        if report_type == 'all' or report_type == 'unexec':
            _report_unexec(the_model, execution)
Exemple #2
0
 def setUp(self):
     _logger.debug(get_header(" Start %s " % self.id(), "*", 120))
Exemple #3
0
def seqexec(db, config, args):
    """
    Parse the CLI arguments and invoke the 'seqexec' function.
    """
    (options, action_args) = _parse(db.basedir, config, args)

    _LOGGER.debug("Reading from: %s", options.src)
    src = options.src
    if src == '-':
        src = sys.stdin

    parser_start = time.time()
    the_parser = parser.ISEParser(src)
    parser_stop = time.time()

    # Provide the graphing capability even in the case of a
    # CycleDetectedError. Graph can be used to visualize such cycles.
    the_model = None
    dag = None
    try:
        model_start = time.time()
        the_model = model.Model(the_parser.root)
        dag = the_model.dag
        model_stop = time.time()
    except CyclesDetectedError as cde:
        # A cycle leads to an error, since it prevents the normal
        # execution.
        _LOGGER.critical(str(cde))
        dag = cde.graph

    if the_model is not None:
        exec_start = time.time()
        execution = execute(the_model, options)
        exec_stop = time.time()

        report(options.report, the_model, execution)

        if getattr(options, 'dostats', 'no') == 'yes':
            _LOGGER.output(get_header(" STATS ", "=", REPORT_HEADER_SIZE))
            for line in report_stats(execution,
                                     ('Parsing', parser_start, parser_stop),
                                     ('Modelling', model_start, model_stop),
                                     ('Execution', exec_start, exec_stop)):
                _LOGGER.output(line)




    # The DOT format graph is written out at the end for various reasons:
    #
    # - the graph model is modified by the 'write_graph_to' function.
    #
    # - the time required to make that graph should not be taken into
    # account (since it can be produced without execution using
    # --doexec option)
    #
    # - if an error occurs in next steps it does not prevent the
    # execution of anything useful
    if options.actionsgraphto is not None:
        write_graph_to(dag, options.actionsgraphto)

    return execution.rc if the_model is not None else os.EX_DATAERR