Skip to content

Commit 623d0a5

Browse files
KrishnanPrashnnshah1GuanLuo
authored
chore: Expose TRITONSERVER_Server instance in Python In-Process API (#385)
Co-authored-by: Neelay Shah <[email protected]> Co-authored-by: GuanLuo <[email protected]>
1 parent 13b6046 commit 623d0a5

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/build
22
/.vscode
33
*.so
4+
*__pycache__/

python/tritonserver/_api/_server.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,9 @@ def stop(self) -> None:
621621
self._server.stop()
622622
self._server = Server._UnstartedServer()
623623

624+
def _ptr(self):
625+
return self._server._ptr()
626+
624627
def unregister_model_repository(self, repository_path: str) -> None:
625628
"""Unregister model repository
626629

python/tritonserver/_c/tritonserver_pybind.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,6 +2107,11 @@ PYBIND11_MODULE(triton_bindings, m)
21072107
.export_values();
21082108
py::class_<PyServer>(m, "TRITONSERVER_Server")
21092109
.def(py::init<PyServerOptions&>())
2110+
.def(
2111+
"_ptr",
2112+
[](PyServer& server) {
2113+
return reinterpret_cast<uintptr_t>(server.Ptr());
2114+
})
21102115
.def("stop", &PyServer::Stop)
21112116
.def("register_model_repository", &PyServer::RegisterModelRepository)
21122117
.def("unregister_model_repository", &PyServer::UnregisterModelRepository)

0 commit comments

Comments
 (0)