Skip to content

Commit 56d60cc

Browse files
kthuinnshah1
andauthored
HTTP live connections on server shutdown (#335)
* Add TRITONSERVER_ServerStopWithTimeout API * Use TRITONSERVER_ServerSetExitTimeout() API * TRITONSERVER_API_VERSION * Enhance c api descriptions Co-authored-by: Neelay Shah <[email protected]> * Fix pre-commit for 'Enhance c api descriptions' --------- Co-authored-by: Neelay Shah <[email protected]>
1 parent a534580 commit 56d60cc

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

include/triton/core/tritonserver.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ struct TRITONSERVER_MetricFamily;
9191
/// }
9292
///
9393
#define TRITONSERVER_API_VERSION_MAJOR 1
94-
#define TRITONSERVER_API_VERSION_MINOR 29
94+
#define TRITONSERVER_API_VERSION_MINOR 30
9595

9696
/// Get the TRITONBACKEND API version supported by the Triton shared
9797
/// library. This value can be compared against the
@@ -2258,6 +2258,17 @@ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error* TRITONSERVER_ServerDelete(
22582258
TRITONSERVER_DECLSPEC struct TRITONSERVER_Error* TRITONSERVER_ServerStop(
22592259
struct TRITONSERVER_Server* server);
22602260

2261+
/// Set the exit timeout on the server object. This value overrides the value
2262+
/// initially set through server options and provides a mechanism to update the
2263+
/// exit timeout while the serving is running.
2264+
///
2265+
/// \param server The inference server object.
2266+
/// \param timeout The exit timeout, in seconds.
2267+
/// \return a TRITONSERVER_Error indicating success or failure.
2268+
TRITONSERVER_DECLSPEC struct TRITONSERVER_Error*
2269+
TRITONSERVER_ServerSetExitTimeout(
2270+
struct TRITONSERVER_Server* server, unsigned int timeout);
2271+
22612272
/// Register a new model repository. Not available in polling mode.
22622273
///
22632274
/// \param server The inference server object.

src/tritonserver.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2572,6 +2572,17 @@ TRITONSERVER_ServerStop(TRITONSERVER_Server* server)
25722572
return nullptr; // Success
25732573
}
25742574

2575+
TRITONAPI_DECLSPEC TRITONSERVER_Error*
2576+
TRITONSERVER_ServerSetExitTimeout(
2577+
TRITONSERVER_Server* server, unsigned int timeout)
2578+
{
2579+
tc::InferenceServer* lserver = reinterpret_cast<tc::InferenceServer*>(server);
2580+
if (lserver != nullptr) {
2581+
lserver->SetExitTimeoutSeconds(timeout);
2582+
}
2583+
return nullptr; // Success
2584+
}
2585+
25752586
TRITONSERVER_DECLSPEC TRITONSERVER_Error*
25762587
TRITONSERVER_ServerRegisterModelRepository(
25772588
TRITONSERVER_Server* server, const char* repository_path,

src/tritonserver_stub.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,10 @@ TRITONSERVER_ServerStop()
559559
{
560560
}
561561
TRITONAPI_DECLSPEC void
562+
TRITONSERVER_ServerSetExitTimeout()
563+
{
564+
}
565+
TRITONAPI_DECLSPEC void
562566
TRITONSERVER_ServerPollModelRepository()
563567
{
564568
}

0 commit comments

Comments
 (0)