Skip to content

Commit

Permalink
Address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
krishung5 committed Oct 4, 2024
1 parent 1282598 commit 8528d75
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 29 deletions.
27 changes: 6 additions & 21 deletions src/pb_stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -723,17 +723,10 @@ Stub::ProcessRequests(RequestBatch* request_batch_shm_ptr)
// the response batch. It is necessary to handle cases where the response
// sender should have already cleaned up, ensuring the backend does not
// delete the response factory again during error handling.
if (err_message.find("Response sender has been closed") !=
std::string::npos) {
response_batch_shm_ptr->is_response_factory_deleted = true;
} else if (
err_message.find("is using the decoupled mode and the execute function "
"must return None") != std::string::npos) {
for (py::handle py_request : py_request_list) {
InferRequest* request = py_request.cast<InferRequest*>();
if (request->GetResponseSender()->IsClosed()) {
response_batch_shm_ptr->is_response_factory_deleted = true;
}
for (py::handle py_request : py_request_list) {
InferRequest* request = py_request.cast<InferRequest*>();
if (request->GetResponseSender()->IsClosed()) {
response_batch_shm_ptr->is_response_factory_deleted = true;
}
}

Expand Down Expand Up @@ -846,16 +839,8 @@ Stub::ProcessReturnedResponses(
}
catch (const PythonBackendException& pb_exception) {
// Handle the exception here to catch the error when there's a response
// returned from `execute()`, and the below error message is thrown.
// In default (non-decoupled) mode, the response factory should already
// have been cleaned up when the previous response was sent by the
// response sender. However, if the model attempts to return another
// response from the `execute()` function, notify the backend NOT to
// delete the response factory again during error handling.
std::string err_message = pb_exception.what();
if (err_message.find(
"Non-decoupled model cannot send more than one response") !=
std::string::npos) {
// returned from `execute()`.
if (request->GetResponseSender()->IsClosed()) {
response_batch = std::move(shm_pool_->Construct<char>(
sizeof(ResponseBatch) + sizeof(IPCMessageShm)));
ResponseBatch* response_batch_shm_ptr =
Expand Down
8 changes: 0 additions & 8 deletions src/python_be.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,6 @@ TRITONSERVER_Error*
ModelInstanceState::SendMessageToStub(
bi::managed_external_buffer::handle_t message)
{
// Stub()->StubMessageQueue()->Push(message);
bool success = false;
while (!success) {
uint64_t timeout_miliseconds = 1000;
Expand Down Expand Up @@ -1072,13 +1071,6 @@ ModelInstanceState::SendMessageAndReceiveResponse(
std::shared_ptr<std::vector<TRITONBACKEND_Response*>>& responses,
TRITONBACKEND_Request** requests, const uint32_t request_count)
{
// SendMessageToStub(message);

// bi::managed_external_buffer::handle_t response_message;
// Stub()->ReceiveMessageFromStub(response_message);

// response = response_message;

auto error = SendMessageToStub(message);
if (error != nullptr) {
RespondErrorToAllRequests(
Expand Down

0 comments on commit 8528d75

Please sign in to comment.