Skip to content

Commit 03914b2

Browse files
authored
Disable async BLS support in decoupled models (triton-inference-server#157)
1 parent 6edcdd8 commit 03914b2

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/pb_stub.cc

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,6 @@ Stub::ProcessRequestsDecoupled(RequestBatch* request_batch_shm_ptr)
459459
bool has_exception = false;
460460
std::string error_string;
461461
std::unique_ptr<PbString> error_string_shm;
462-
bool is_coroutine;
463462

464463
ScopedDefer execute_finalize([this] { stub_message_queue_->Pop(); });
465464
ScopedDefer _(
@@ -480,13 +479,6 @@ Stub::ProcessRequestsDecoupled(RequestBatch* request_batch_shm_ptr)
480479

481480
py::object execute_return =
482481
model_instance_.attr("execute")(py_request_list);
483-
py::module asyncio = py::module::import("asyncio");
484-
485-
is_coroutine = asyncio.attr("iscoroutine")(execute_return).cast<bool>();
486-
if (is_coroutine) {
487-
execute_return = asyncio.attr("run")(execute_return);
488-
}
489-
490482
if (!py::isinstance<py::none>(execute_return)) {
491483
throw PythonBackendException(
492484
"Python model '" + model_instance_name_ +
@@ -748,6 +740,12 @@ PYBIND11_EMBEDDED_MODULE(c_python_backend_utils, module)
748740
.def(
749741
"async_exec",
750742
[](std::shared_ptr<InferRequest>& infer_request) {
743+
std::unique_ptr<Stub>& stub = Stub::GetOrCreateInstance();
744+
if (stub->IsDecoupled()) {
745+
throw PythonBackendException(
746+
"Async BLS request execution is not support in the decoupled "
747+
"API.");
748+
}
751749
py::object loop =
752750
py::module_::import("asyncio").attr("get_running_loop")();
753751
py::cpp_function callback = [infer_request]() {

src/python.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1714,7 +1714,6 @@ ModelInstanceState::ProcessRequests(
17141714
requests, request_count);
17151715
}
17161716

1717-
17181717
ScopedDefer execute_finalize([this, &restart] {
17191718
// Push a dummy message to the message queue so that
17201719
// the stub process is notified that it can release

src/request_executor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class RequestExecutor {
4141
std::unique_ptr<InferResponse> Infer(
4242
const std::shared_ptr<InferRequest>& infer_request,
4343
TRITONSERVER_InferenceResponse** response);
44+
4445
RequestExecutor(
4546
std::unique_ptr<SharedMemoryManager>& shm_pool,
4647
TRITONSERVER_Server* server);

0 commit comments

Comments
 (0)