Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions include/triton/core/tritonserver.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// Copyright 2020-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -2377,7 +2377,10 @@ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error* TRITONSERVER_ServerIsReady(
/// \param model_version The version of the model to get readiness
/// for. If -1 then the server will choose a version based on the
/// model's policy.
/// \param ready Returns true if server is ready, false otherwise.
/// \param ready Returns true if the model is ready, false otherwise. A model
/// that cannot be found, or that is unavailable because the server is not
/// ready, is reported as not ready (false) rather than as an error; any other
/// lookup failure is returned as an error.
/// \return a TRITONSERVER_Error indicating success or failure.
TRITONSERVER_DECLSPEC struct TRITONSERVER_Error*
TRITONSERVER_ServerModelIsReady(
Expand Down
20 changes: 13 additions & 7 deletions src/tritonserver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2730,14 +2730,20 @@ TRITONSERVER_ServerModelIsReady(
{
tc::InferenceServer* lserver = reinterpret_cast<tc::InferenceServer*>(server);

// A model that cannot be resolved (never loaded, unloaded, or unregistered)
// is simply not ready. Before the ModelIdentifier readiness refactor the
// lookup failure was swallowed and this returned ready=false; preserve that
// public contract instead of surfacing the lookup error to the caller.
std::shared_ptr<tc::Model> model;
if (!lserver->GetModel(model_name, model_version, &model).IsOk()) {
*ready = false;
return nullptr; // Success -- not ready, not an error
tc::Status get_model_status =
lserver->GetModel(model_name, model_version, &model);
if (!get_model_status.IsOk()) {
// When the server is not ready or the model cannot be found, the model
// cannot be ready either, so report ready=false without treating it as an
// error. Any other lookup failure is a real error and is surfaced to the
// caller.
if (get_model_status.StatusCode() == tc::Status::Code::UNAVAILABLE ||
get_model_status.StatusCode() == tc::Status::Code::NOT_FOUND) {
*ready = false;
return nullptr;
}
RETURN_IF_STATUS_ERROR(get_model_status);
}
RETURN_IF_STATUS_ERROR(lserver->ModelIsReady(*model, ready));
return nullptr; // Success
Expand Down
Loading