Skip to content

Commit

Permalink
chore: Expose TRITONSERVER_Server instance in Python In-Process API (
Browse files Browse the repository at this point in the history
…#385)

Co-authored-by: Neelay Shah <neelays@nvidia.com>
Co-authored-by: GuanLuo <41310872+GuanLuo@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 30, 2024
1 parent 13b6046 commit 623d0a5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/build
/.vscode
*.so
*__pycache__/
3 changes: 3 additions & 0 deletions python/tritonserver/_api/_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions python/tritonserver/_c/tritonserver_pybind.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2107,6 +2107,11 @@ PYBIND11_MODULE(triton_bindings, m)
.export_values();
py::class_<PyServer>(m, "TRITONSERVER_Server")
.def(py::init<PyServerOptions&>())
.def(
"_ptr",
[](PyServer& server) {
return reinterpret_cast<uintptr_t>(server.Ptr());
})
.def("stop", &PyServer::Stop)
.def("register_model_repository", &PyServer::RegisterModelRepository)
.def("unregister_model_repository", &PyServer::UnregisterModelRepository)
Expand Down

0 comments on commit 623d0a5

Please sign in to comment.