Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure the GRPC client code #292

Merged
merged 3 commits into from
Apr 24, 2023
Merged

Restructure the GRPC client code #292

merged 3 commits into from
Apr 24, 2023

Conversation

Tabrizian
Copy link
Member

@Tabrizian Tabrizian commented Apr 19, 2023

Before

['INT32_MAX', 'InferInput', 'InferRequestedOutput', 'InferResult', 'InferenceServerClient', 'InferenceServerException', 'KeepAliveOptions', 'MAX_GRPC_MESSAGE_SIZE', 'MessageToJson', '_InferStream', '_RequestIterator', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_get_inference_request', '_grpc_compression_type', 'base64', 'deserialize_bf16_tensor', 'deserialize_bytes_tensor', 'get_error_grpc', 'grpc', 'json', 'model_config_pb2', 'np', 'np_to_triton_dtype', 'queue', 'raise_error', 'raise_error_grpc', 'serialize_bf16_tensor', 'serialize_byte_tensor', 'serialized_byte_size', 'service_pb2', 'service_pb2_grpc', 'struct', 'threading', 'triton_to_np_dtype', 'version', 'warnings']

After:

dir(tritonclient.grpc)
['InferInput', 'InferRequestedOutput', 'InferResult', 'InferenceServerClient', 'InferenceServerException', 'KeepAliveOptions', 'MAX_GRPC_MESSAGE_SIZE', 'MessageToJson', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_client', '_infer_input', '_infer_result', '_infer_stream', '_requested_output', '_utils', 'deserialize_bf16_tensor', 'deserialize_bytes_tensor', 'grpc', 'model_config_pb2', 'np', 'np_to_triton_dtype', 'raise_error', 'raise_error_grpc', 'serialize_bf16_tensor', 'serialize_byte_tensor', 'serialized_byte_size', 'service_pb2', 'service_pb2_grpc', 'struct', 'triton_to_np_dtype', 'version', 'warnings']

I've made sure the API to the user is the same before and after this change.

except ModuleNotFoundError as error:
raise RuntimeError(
'The installation does not include grpc support. '
'Specify \'grpc\' or \'all\' while installing the tritonclient '
'package to include the support') from error

import grpc

Check notice

Code scanning / CodeQL

Module is imported more than once

This import of module grpc is redundant, as it was previously imported [on line 28](1).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if these warnings points to a real issue here. Which grpc module will be imported?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I double checked. The correct gRPC is used: /usr/local/lib/python3.8/dist-packages/grpc/init.py

@Tabrizian Tabrizian marked this pull request as ready for review April 20, 2023 19:12
@Tabrizian Tabrizian requested a review from tanmayv25 April 21, 2023 22:20
@Tabrizian Tabrizian force-pushed the imant-client-plugin branch from b21fcba to 0be1c7f Compare April 24, 2023 11:46
@Tabrizian Tabrizian merged commit 47d7111 into main Apr 24, 2023
@Tabrizian Tabrizian deleted the imant-client-plugin branch April 24, 2023 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants