Skip to content

Commit

Permalink
Enable decoupled bls async exec
Browse files Browse the repository at this point in the history
  • Loading branch information
kthui committed Apr 1, 2024
1 parent 3f724db commit b8a7a40
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/pb_stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,9 @@ Stub::GetAsyncEventLoop()
{
if (py::isinstance<py::none>(async_event_loop_)) {
// Create the event loop if not already.
async_event_loop_ = py::module_::import("asyncio").attr("new_event_loop")();
py::module asyncio = py::module_::import("asyncio");
async_event_loop_ = asyncio.attr("new_event_loop")();
asyncio.attr("set_event_loop")(async_event_loop_);
py::object py_thread =
py::module_::import("threading")
.attr("Thread")(
Expand Down Expand Up @@ -1802,11 +1804,6 @@ PYBIND11_EMBEDDED_MODULE(c_python_backend_utils, module)
[](std::shared_ptr<InferRequest>& infer_request,
const bool decoupled) {
std::unique_ptr<Stub>& stub = Stub::GetOrCreateInstance();
if (stub->IsDecoupled()) {
throw PythonBackendException(
"Async BLS request execution is not support in the decoupled "
"API.");
}
py::object loop =
py::module_::import("asyncio").attr("get_running_loop")();
py::cpp_function callback = [&stub, infer_request, decoupled]() {
Expand Down

0 comments on commit b8a7a40

Please sign in to comment.