Beispiel #1
0
def _normalize_cuda_args(args):
    """normalize cuda arguments"""
    if args.bin:
        args.bin = os.path.abspath(args.bin)
        if not os.path.isdir(args.bin):
            LOG.error('invalid bin path specified')
            return None
    if args.include:
        args.include = os.path.abspath(args.include)
        if not os.path.isdir(args.include):
            LOG.error('invalid include path specified')
            return None
    return args
Beispiel #2
0
def _normalize_server_args(args):
    """normalize server arguments"""
    # ensure port number is valid
    if args.port > 65535:
        LOG.error('port number invalid: %s', args.port)
        return None
    elif args.port < 1024:
        LOG.warning('port number requires root priv: %s', args.port)

    # NOTE: does not support ipv6 bind addrs and may allow some invalid addrs
    if len(args.host.split('.')) != 4:
        LOG.error('invalid bind addr: %s', args.host)
        return None

    return args