Exemplo n.º 1
0
    def _w(args):
        # FIXME.
        setup_log(log, level=logging.DEBUG)

        log.info("Registry {r}".format(r=registry))
        log.info("loading RTC from {i}".format(i=args.rtc_path))
        rtc = load_resolved_tool_contract_from(args.rtc_path)
        id_funcs = {t.task.task_id:func for t, func in registry.rtc_runners.iteritems()}
        func = id_funcs.get(rtc.task.task_id, None)
        if func is None:
            sys.stderr.write("ERROR. Unknown tool contract id {x}".format(x=rtc.task.task_id))
            return -1
        else:
            exit_code = func(rtc)
            log.info("Completed running {r} exitcode {e}".format(r=rtc, e=exit_code))
Exemplo n.º 2
0
def _pbsmrtipe_setup_log(alog, **kwargs):
    """Setup stdout log. pbsmrtpipe will setup pbsmrtpipe.log, master.log

    This should only emit 'status.*' messages.
    """
    # This is a essentially just a bootstrapping step before the job-dir/logs
    # can be created and proper log files (pbsmrtpipe.log, master.log) will
    # be setup for this to work with the new global dict setup model would have to
    # extended to support adding a custom filter.

    str_formatter = '%(message)s'

    level = kwargs.get('level', logging.INFO)
    setup_log(alog,
              level=level,
              file_name=None,
              log_filter=StdOutStatusLogFilter(),
              str_formatter=str_formatter)

    slog.info("Starting pbsmrtpipe v{v}".format(v=pbsmrtpipe.get_version()))
Exemplo n.º 3
0
    def _w(args):
        # FIXME.
        setup_log(log, level=logging.DEBUG)

        log.info("Registry {r}".format(r=registry))
        log.info("loading RTC from {i}".format(i=args.rtc_path))
        rtc = load_resolved_tool_contract_from(args.rtc_path)
        id_funcs = {
            t.task.task_id: func
            for t, func in registry.rtc_runners.iteritems()
        }
        func = id_funcs.get(rtc.task.task_id, None)
        if func is None:
            sys.stderr.write("ERROR. Unknown tool contract id {x}".format(
                x=rtc.task.task_id))
            return -1
        else:
            exit_code = func(rtc)
            log.info("Completed running {r} exitcode {e}".format(r=rtc,
                                                                 e=exit_code))
Exemplo n.º 4
0
    def _w(args):
        default_level = logging.INFO

        level = args.log_level if hasattr(args, 'log_level') else default_level

        setup_log(log, level=level)

        log.info("Loading pbcommand {v}".format(v=pbcommand.get_version()))
        log.info("Registry {r}".format(r=registry))
        log.info("loading RTC from {i}".format(i=args.rtc_path))
        rtc = load_resolved_tool_contract_from(args.rtc_path)
        id_funcs = {t.task.task_id:func for t, func in registry.rtc_runners.iteritems()}
        func = id_funcs.get(rtc.task.task_id, None)
        if func is None:
            sys.stderr.write("ERROR. Unknown tool contract id {x}".format(x=rtc.task.task_id))
            return -1
        else:
            log.info("Running id:{i} Resolved Tool Contract {r}".format(r=rtc, i=rtc.task.task_id))
            log.info("Runner func {f}".format(f=func))
            exit_code = func(rtc)
            log.info("Completed running {r} exitcode {e}".format(r=rtc, e=exit_code))
            return exit_code
Exemplo n.º 5
0
def main():

    def _log_results(name, e, m):
        log.info("Test {x} with {n} errors {e} and metrics {m}".format(
            x=name, e=errors, m=m, n=len(errors)))

    setup_log(log, level=logging.DEBUG)

    quick_ex_02 = functools.partial(example_02, ValidatorContextFirstError)
    full_ex_02 = functools.partial(example_02, ValidatorErrorContext)
    # the MaxError context is little bit more difficult to initialize
    max_errors_ex_02 = functools.partial(example_02, _to_max_errors(2))

    examples = [example_01, quick_ex_02, full_ex_02, max_errors_ex_02]

    for example in examples:
        log.info("running example {e}".format(e=example))
        errors, metrics = example()
        _log_results(example_01.__name__, errors, metrics)
        log.info("")

    log.info("exiting main.")
    return 0