question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

python tritonclient stream_infer should send end signal to callback

See original GitHub issue

this maybe a new baby question, I think we should add self._callback(result=None, error=None) after finish iteration on responses to let callback know stream response is complete and no more response will be sended. Am I right?

python triton client code

https://github.com/triton-inference-server/client/blob/d8bc5b8d4a9297e8e6b470fe96ef82a4470234a2/src/python/library/tritonclient/grpc/__init__.py#L2083

    def _process_response(self, responses):
        """Worker thread function to iterate through the response stream and
        executes the provided callbacks.

        Parameters
        ----------
        responses : iterator
            The iterator to the response from the server for the
            requests in the stream.

        """
        try:
            for response in responses:
                if self._verbose:
                    print(response)
                result = error = None
                if response.error_message != "":
                    error = InferenceServerException(msg=response.error_message)
                else:
                    result = InferResult(response.infer_response)
                self._callback(result=result, error=error)
            ############ add here ##############
            self._callback(result=None, error=None) # new code
        except grpc.RpcError as rpc_error:
            error = get_error_grpc(rpc_error)
            self._callback(result=None, error=error)

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
Tabriziancommented, Jun 24, 2022

@Jackiexiao This sounds like a reasonable request to me. I think we should deliver the flag to the client indicating whether this is the last response or not. Right now, it looks like the client must know before hand the number of responses that the model is going to send. @tanmayv25 / @jbkyang-nvi What do you think?

0reactions
dyastremskycommented, Aug 26, 2022

Not yet. It’s in our queue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Integrating NVIDIA Triton Inference Server with Kaldi ASR
4), a client connects to the gRPC server, streams audio by sending chunks to the server, and gets back the inferred text as...
Read more >
tritonclient - PyPI
Python client library and utilities for communicating with Triton Inference Server.
Read more >
gRPC AsyncIO API — gRPC Python 1.46.2 documentation
Finishes the asynchronous context manager by closing the channel. Still active RPCs will be cancelled. abstract async channel_ready() ...
Read more >
Message 331645 - Python tracker
The callback will be invoked in the thread that runs the event loop, along with other queued callbacks and runnable coroutines. Unlike signal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found