Skip to content

Commit

Permalink
Throw warning in case of Triton API minor version mismatch (#90)
Browse files Browse the repository at this point in the history
* Graceful handling of Triton API minor version mismatch

* Modify conditons
  • Loading branch information
lkomali committed Oct 2, 2024
1 parent be1a4da commit 98c2e2a
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/client_backend/triton_c_api/triton_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,29 @@ TritonLoader::StartTriton()
REPORT_TRITONSERVER_ERROR(
api_version_fn_(&api_version_major, &api_version_minor),
"unable to get api version");
if ((TRITONSERVER_API_VERSION_MAJOR != api_version_major) ||
(TRITONSERVER_API_VERSION_MINOR > api_version_minor)) {
std::stringstream sstream;
sstream << "triton server API version mismatch. \n"
<< "Expected version major:" << TRITONSERVER_API_VERSION_MAJOR
<< ", minor:" << TRITONSERVER_API_VERSION_MINOR << "\n"
<< " Actual version major:" << api_version_major
<< ", minor:" << api_version_minor;
return Error(sstream.str());

auto createErrorMessage = [](const std::string& message, int expected,
int actual) {
return message + "Expected version: " + std::to_string(expected) + "\n" +
"Actual version: " + std::to_string(actual) + "\n";
};

if (TRITONSERVER_API_VERSION_MAJOR != api_version_major) {
std::string errorMessage = createErrorMessage(
"Error: Triton server API major version mismatch.\n",
TRITONSERVER_API_VERSION_MAJOR, api_version_major);
return Error(errorMessage);
}

if (TRITONSERVER_API_VERSION_MINOR != api_version_minor) {
std::string warningMessage = createErrorMessage(
"Warning: Triton server API minor version mismatch.\n",
TRITONSERVER_API_VERSION_MINOR, api_version_minor);
warningMessage +=
"Attempting to proceed, but undefined behavior may occur.\n";
std::cerr << warningMessage;
}

// Create the server...
TRITONSERVER_ServerOptions* server_options = nullptr;
RETURN_IF_TRITONSERVER_ERROR(
Expand Down

0 comments on commit 98c2e2a

Please sign in to comment.