From 20a5ca6edcecd5f73a03811ae37061a8cbe0e70a Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Wed, 27 Nov 2024 13:54:56 -0800 Subject: [PATCH 1/2] Always print traceback Signed-off-by: Kevin Su --- flytekit/clients/raw.py | 1 + flytekit/clis/sdk_in_container/utils.py | 15 ++++----------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/flytekit/clients/raw.py b/flytekit/clients/raw.py index df643d554d..06364ce0bb 100644 --- a/flytekit/clients/raw.py +++ b/flytekit/clients/raw.py @@ -363,6 +363,7 @@ def create_execution(self, create_execution_request): :param flyteidl.admin.execution_pb2.ExecutionCreateRequest create_execution_request: :rtype: flyteidl.admin.execution_pb2.ExecutionCreateResponse """ + raise grpc.RpcError("123123123123123123") return self._stub.CreateExecution(create_execution_request, metadata=self._metadata) def recover_execution(self, recover_execution_request): diff --git a/flytekit/clis/sdk_in_container/utils.py b/flytekit/clis/sdk_in_container/utils.py index 9a5fdaa890..f515315061 100644 --- a/flytekit/clis/sdk_in_container/utils.py +++ b/flytekit/clis/sdk_in_container/utils.py @@ -82,7 +82,8 @@ def pretty_print_grpc_error(e: grpc.RpcError): if isinstance(e, grpc._channel._InactiveRpcError): # noqa click.secho(f"RPC Failed, with Status: {e.code()}", fg="red", bold=True) click.secho(f"\tDetails: {e.details()}", fg="magenta", bold=True) - return + else: + click.secho(f"RPC Failed, with Error: {e}", fg="red", bold=True) def remove_unwanted_traceback_frames( @@ -161,19 +162,11 @@ def pretty_print_exception(e: Exception, verbosity: int = 1): if isinstance(e, FlyteException): if isinstance(e, FlyteInvalidInputException): click.secho("Request rejected by the API, due to Invalid input.", fg="red") - cause = e.__cause__ - if cause: - if isinstance(cause, grpc.RpcError): - pretty_print_grpc_error(cause) - else: - pretty_print_traceback(e, verbosity) - else: - pretty_print_traceback(e, verbosity) - return + if e.__cause__ and isinstance(e.__cause__, grpc.RpcError): + pretty_print_grpc_error(e.__cause__) if isinstance(e, grpc.RpcError): pretty_print_grpc_error(e) - return pretty_print_traceback(e, verbosity) From 8cf8c6d7485d0ec3936c559294cb30f2d1cb8144 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Wed, 27 Nov 2024 13:58:19 -0800 Subject: [PATCH 2/2] Always print traceback Signed-off-by: Kevin Su --- flytekit/clients/raw.py | 1 - 1 file changed, 1 deletion(-) diff --git a/flytekit/clients/raw.py b/flytekit/clients/raw.py index 06364ce0bb..df643d554d 100644 --- a/flytekit/clients/raw.py +++ b/flytekit/clients/raw.py @@ -363,7 +363,6 @@ def create_execution(self, create_execution_request): :param flyteidl.admin.execution_pb2.ExecutionCreateRequest create_execution_request: :rtype: flyteidl.admin.execution_pb2.ExecutionCreateResponse """ - raise grpc.RpcError("123123123123123123") return self._stub.CreateExecution(create_execution_request, metadata=self._metadata) def recover_execution(self, recover_execution_request):