diff --git a/jina/checker.py b/jina/checker.py index 55f7f1da7da6a..c56bc862c52f9 100644 --- a/jina/checker.py +++ b/jina/checker.py @@ -25,21 +25,26 @@ def __init__(self, args: 'argparse.Namespace'): try: total_time = 0 total_success = 0 + timeout = args.timeout / 1000 if args.timeout != -1 else None for j in range(args.attempts): with TimeContext( f'ping {args.target} on {args.host} at {j} round', default_logger ) as tc: if args.target == 'executor': hostname, port, protocol, _ = parse_host_scheme(args.host) - r = WorkerRuntime.is_ready(ctrl_address=f'{hostname}:{port}') + r = WorkerRuntime.is_ready( + ctrl_address=f'{hostname}:{port}', + timeout=timeout, + ) elif args.target == 'gateway': hostname, port, protocol, _ = parse_host_scheme(args.host) r = GatewayRuntime.is_ready( f'{hostname}:{port}', - protocol=GatewayProtocolType.from_string(protocol) + protocol=GatewayProtocolType.from_string(protocol), + timeout=timeout, ) elif args.target == 'flow': - r = Client(host=args.host).is_flow_ready(timeout=args.timeout / 1000) + r = Client(host=args.host).is_flow_ready(timeout=timeout) if not r: default_logger.warning( 'not responding, attempt (%d/%d) in 1s' diff --git a/jina/parsers/ping.py b/jina/parsers/ping.py index b31acb5962e29..398128763e748 100644 --- a/jina/parsers/ping.py +++ b/jina/parsers/ping.py @@ -33,7 +33,7 @@ def set_ping_parser(parser=None): default=3000, help=''' Timeout in millisecond of one check --1 for waiting forever +Use -1 for waiting forever ''', ) parser.add_argument(