Beispiel #1
0
def main(ctx, **kwargs):
    """Training supervisor."""
    if kwargs['verbose'] is True:
        LOG_LEVEL = logging.DEBUG
        logging.getLogger('matplotlib').setLevel(logging.WARNING)
    else:
        LOG_LEVEL = logging.INFO
    logger.setLevel(LOG_LEVEL)

    if kwargs['file_log'] is True:
        lib.logger.start_file_log()

    ctx.obj['verbose'] = kwargs['verbose']
    ctx.obj['file_log'] = kwargs['file_log']
Beispiel #2
0
def main():
    """Parse argv and run the appropriate action."""
    # Configure argument parser
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--debug',
        action='store_true',
        help='Print additional debug information while running.',
    )
    parser.add_argument(
        '--debug-straces',
        action='store_true',
        help='Print strace information before each comparison. Implies '
        '--debug.')
    parser.add_argument(
        '--syscall-format',
        choices=(
            'standard',
            'canonical',
        ),
        help='Strace debug format. Standard prints syscalls using their '
        'default representation. Canonical prints syscalls using their '
        'canonical representation. This option only has an effect with '
        '--debug-straces.')
    subcommands.init_argparse_action(
        parser.add_subparsers(
            dest='subcommand',
            title='Cartographer Subcommands',
            description='These commands expose portions of '
            'Cartographer\'s functionality.',
            help='Run one of these commands to get started.',
            required=True,
        ))

    # Parse args
    args = parser.parse_args()

    # Run (requires subparsers to set a default run function)
    if args.debug or args.debug_straces:
        logger.setLevel(logging.DEBUG)
    if args.debug_straces:
        logger.debug_straces = True
    if args.syscall_format == 'canonical':
        logger.debug_straces_context = canonical_repr
    args.run(args)
Beispiel #3
0
def main(ctx, **kwargs):
    """Dataset preprocessing tools."""
    import logging
    import lib.logger

    logger = lib.logger.logger

    if kwargs['verbose'] is True:
        LOG_LEVEL = logging.DEBUG
    else:
        LOG_LEVEL = logging.INFO
    logger.setLevel(LOG_LEVEL)

    lib.logger.start_stream_log()

    if kwargs['file_log'] is True:
        lib.logger.start_file_log()

    ctx.obj['verbose'] = kwargs['verbose']
    ctx.obj['file_log'] = kwargs['file_log']
    ctx.obj['logger'] = logger