diff --git a/.gitignore b/.gitignore index 0e9f099a2..9948de3b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /build /.vscode *.so +*__pycache__/ diff --git a/python/tritonserver/_api/_server.py b/python/tritonserver/_api/_server.py index 9e78f8ac2..b85d2e5c6 100644 --- a/python/tritonserver/_api/_server.py +++ b/python/tritonserver/_api/_server.py @@ -621,6 +621,9 @@ def stop(self) -> None: self._server.stop() self._server = Server._UnstartedServer() + def _ptr(self): + return self._server._ptr() + def unregister_model_repository(self, repository_path: str) -> None: """Unregister model repository diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index 6017b3d7e..e7cd4b53b 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -2107,6 +2107,11 @@ PYBIND11_MODULE(triton_bindings, m) .export_values(); py::class_(m, "TRITONSERVER_Server") .def(py::init()) + .def( + "_ptr", + [](PyServer& server) { + return reinterpret_cast(server.Ptr()); + }) .def("stop", &PyServer::Stop) .def("register_model_repository", &PyServer::RegisterModelRepository) .def("unregister_model_repository", &PyServer::UnregisterModelRepository)