From 33668518805dadb7b08771ee5f0f22187271c45f Mon Sep 17 00:00:00 2001 From: colethienes <55771951+colethienes@users.noreply.github.com> Date: Sun, 20 Oct 2019 23:54:33 -0400 Subject: [PATCH 1/3] fix(flow): improve the error logging --- gnes/flow/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gnes/flow/__init__.py b/gnes/flow/__init__.py index fdabf87b..36b55f6f 100644 --- a/gnes/flow/__init__.py +++ b/gnes/flow/__init__.py @@ -416,7 +416,7 @@ def _get_client(self, bytes_gen: Iterator[bytes] = None, **kwargs): from ..cli.parser import set_client_cli_parser from ..client.cli import CLIClient - args, p_args, unk_args = self._get_parsed_args(self, set_client_cli_parser, kwargs) + args, p_args, _ = self._get_parsed_args(self, 'CLIClient', set_client_cli_parser, kwargs) p_args.grpc_port = self._service_nodes[self._frontend]['parsed_args'].grpc_port p_args.grpc_host = self._service_nodes[self._frontend]['parsed_args'].grpc_host c = CLIClient(p_args, start_at_init=False) @@ -534,7 +534,7 @@ def set(self, name: str, recv_from: Union[str, Tuple[str], List[str], 'Service'] if not clear_old_attr: node['kwargs'].update(kwargs) kwargs = node['kwargs'] - args, p_args, unk_args = op_flow._get_parsed_args(op_flow, service_map[service]['parser'], kwargs) + args, p_args, unk_args = op_flow._get_parsed_args(op_flow, name, service_map[service]['parser'], kwargs) node.update({ 'args': args, 'parsed_args': p_args, @@ -635,7 +635,7 @@ def add(self, service: Union['Service', str], recv_from = op_flow._parse_service_endpoints(op_flow, name, recv_from, connect_to_last_service=True) send_to = op_flow._parse_service_endpoints(op_flow, name, send_to, connect_to_last_service=False) - args, p_args, unk_args = op_flow._get_parsed_args(op_flow, service_map[service]['parser'], kwargs) + args, p_args, unk_args = op_flow._get_parsed_args(op_flow, name, service_map[service]['parser'], kwargs) op_flow._service_nodes[name] = { 'service': service, @@ -686,7 +686,7 @@ def _parse_service_endpoints(op_flow, cur_service_name, service_endpoint, connec return set(service_endpoint) @staticmethod - def _get_parsed_args(op_flow, service_arg_parser, kwargs): + def _get_parsed_args(op_flow, name, service_arg_parser, kwargs): kwargs.update(op_flow._common_kwargs) args = [] for k, v in kwargs.items(): @@ -709,7 +709,7 @@ def _get_parsed_args(op_flow, service_arg_parser, kwargs): op_flow.logger.warning('not sure what these arguments are: %s' % unknown_args) except SystemExit: raise ValueError('bad arguments for service "%s", ' - 'you may want to double check your args "%s"' % (service_arg_parser, args)) + 'you may want to double check your args "%s"' % (name, args)) return args, p_args, unknown_args def _build_graph(self, copy_flow: bool) -> 'Flow': From fd1ea8f6bba5b44a409d98f60ba7968caaca589a Mon Sep 17 00:00:00 2001 From: colethienes <55771951+colethienes@users.noreply.github.com> Date: Mon, 21 Oct 2019 00:02:28 -0400 Subject: [PATCH 2/3] fix(flow): improve the error logging --- gnes/flow/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnes/flow/__init__.py b/gnes/flow/__init__.py index 36b55f6f..cc0958c6 100644 --- a/gnes/flow/__init__.py +++ b/gnes/flow/__init__.py @@ -416,7 +416,7 @@ def _get_client(self, bytes_gen: Iterator[bytes] = None, **kwargs): from ..cli.parser import set_client_cli_parser from ..client.cli import CLIClient - args, p_args, _ = self._get_parsed_args(self, 'CLIClient', set_client_cli_parser, kwargs) + _, p_args, _ = self._get_parsed_args(self, 'CLIClient', set_client_cli_parser, kwargs) p_args.grpc_port = self._service_nodes[self._frontend]['parsed_args'].grpc_port p_args.grpc_host = self._service_nodes[self._frontend]['parsed_args'].grpc_host c = CLIClient(p_args, start_at_init=False) From 2c1490d8fb10388086059669db7eccbdbb13131b Mon Sep 17 00:00:00 2001 From: Han Xiao Date: Wed, 23 Oct 2019 09:47:33 +0800 Subject: [PATCH 3/3] fix(flow): remove magic string --- gnes/flow/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnes/flow/__init__.py b/gnes/flow/__init__.py index cc0958c6..36787463 100644 --- a/gnes/flow/__init__.py +++ b/gnes/flow/__init__.py @@ -416,7 +416,7 @@ def _get_client(self, bytes_gen: Iterator[bytes] = None, **kwargs): from ..cli.parser import set_client_cli_parser from ..client.cli import CLIClient - _, p_args, _ = self._get_parsed_args(self, 'CLIClient', set_client_cli_parser, kwargs) + _, p_args, _ = self._get_parsed_args(self, CLIClient.__name__, set_client_cli_parser, kwargs) p_args.grpc_port = self._service_nodes[self._frontend]['parsed_args'].grpc_port p_args.grpc_host = self._service_nodes[self._frontend]['parsed_args'].grpc_host c = CLIClient(p_args, start_at_init=False)