示例#1
0
def id2bytes(value: str) -> bytes:
    try:
        return unhexlify(value)
    except:
        default_logger.critical('Customized ``id`` is only acceptable when: \
            - it only contains the symbols "0"–"9" to represent values 0 to 9, \
            and "A"–"F" (or alternatively "a"–"f"). \
            - it has an even length.')
        raise BadDocID(f'{value} is not a valid id for DocumentProto')
示例#2
0
文件: api.py 项目: yuanl/jina
def flow(args: 'Namespace'):
    """Start a Flow from a YAML file or a docker image"""
    from jina.flow import Flow
    if args.uses:
        f = Flow.load_config(args.uses)
        with f:
            f.block()
    else:
        from jina.logging import default_logger
        default_logger.critical(
            'start a flow from CLI requires a valid "--uses"')
示例#3
0
文件: api.py 项目: smartadpole/jina
def flow(args):
    """Start a Flow from a YAML file or a docker image"""
    from ..flow import Flow
    if args.yaml_path:
        f = Flow.load_config(args.uses)
        f._update_args(args)
        with f:
            f.block()
    else:
        from jina.logging import default_logger
        default_logger.critical('start a flow from CLI requires a valid "--yaml-path"')
示例#4
0
def flow(args):
    """Start a Flow from a YAML file"""
    from ..flow import Flow
    if args.yaml_path:
        from threading import Event
        f = Flow.load_config(args.yaml_path)
        f._update_args(args)
        with f:
            try:
                Event().wait()
            except KeyboardInterrupt:
                pass
    else:
        from jina.logging import default_logger
        default_logger.critical(
            'start a flow from CLI requires a valid "--yaml-path"')