Skip to content

Commit 60a9091

Browse files
authored
* Fllow up with error msg * Setting decoupled after autocomplete in ModelState:Create * Refactor * Refactor according to Tanmay discussion
1 parent 0f12211 commit 60a9091

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

src/python_be.cc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,6 +2005,29 @@ ModelState::ValidateModelConfig()
20052005
return nullptr;
20062006
}
20072007

2008+
TRITONSERVER_Error*
2009+
ModelState::SetModelConfig()
2010+
{
2011+
BackendModel::SetModelConfig();
2012+
// `Update model_transaction_policy` if setting was set
2013+
// with `set_model_transaction_policy`
2014+
triton::common::TritonJson::Value model_transaction_policy;
2015+
bool is_decoupled = false;
2016+
if (ModelConfig().Find(
2017+
"model_transaction_policy", &model_transaction_policy)) {
2018+
triton::common::TritonJson::Value decoupled;
2019+
if (model_transaction_policy.Find("decoupled", &decoupled)) {
2020+
auto error = decoupled.AsBool(&is_decoupled);
2021+
if (error != nullptr) {
2022+
throw BackendModelException(error);
2023+
}
2024+
SetDecoupled(is_decoupled);
2025+
}
2026+
}
2027+
2028+
return nullptr;
2029+
}
2030+
20082031

20092032
extern "C" {
20102033

src/python_be.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ class ModelState : public BackendModel {
238238
// Is decoupled API being used.
239239
bool IsDecoupled() { return decoupled_; }
240240

241+
// Set decoupled mode
242+
void SetDecoupled(bool decoupled) { decoupled_ = decoupled; }
243+
241244
// Returns the value in the `runtime_modeldir_` field
242245
std::string RuntimeModelDir() { return runtime_modeldir_; }
243246

@@ -247,6 +250,10 @@ class ModelState : public BackendModel {
247250
// Validate Model Configuration
248251
TRITONSERVER_Error* ValidateModelConfig();
249252

253+
// Overrides `BackendModel::SetModelConfig` to also
254+
// set `ModelState::decoupled_`
255+
TRITONSERVER_Error* SetModelConfig();
256+
250257
// Auto-complete stub
251258
std::unique_ptr<StubLauncher>& Stub() { return auto_complete_stub_; }
252259

src/resources/triton_python_backend_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def add_input(self, input):
394394
+ input["name"]
395395
+ "' in auto-complete-config function for model '"
396396
+ self._model_config["name"]
397-
+ "' contains property other than 'name', 'data_type' and 'dims'."
397+
+ "' contains property other than 'name', 'data_type', 'dims' and 'optional'."
398398
)
399399

400400
if "name" not in input:

0 commit comments

Comments
 (0)