Skip to content

Commit 75dbd17

Browse files
committed
Correct err msg/status for custom batch init
1 parent f3d950b commit 75dbd17

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

src/backend_model.cc

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -316,19 +316,19 @@ TritonModel::ResolveBackendConfigs(
316316
std::map<std::string, std::string> lconfig;
317317
if (global_itr != backend_cmdline_config_map.end()) {
318318
// Accumulate all global settings
319-
for (auto& setting : global_itr->second){
319+
for (auto& setting : global_itr->second) {
320320
lconfig[setting.first] = setting.second;
321321
}
322322
}
323323
if (specific_itr != backend_cmdline_config_map.end()) {
324324
// Accumulate backend specific settings and override
325-
// global settings with specific configs if needed
326-
for (auto& setting : specific_itr->second){
325+
// global settings with specific configs if needed
326+
for (auto& setting : specific_itr->second) {
327327
lconfig[setting.first] = setting.second;
328328
}
329-
}
330-
for (auto& final_setting : lconfig){
331-
config.emplace_back(final_setting);
329+
}
330+
for (auto& final_setting : lconfig) {
331+
config.emplace_back(final_setting);
332332
}
333333

334334
return Status::Success;
@@ -591,9 +591,11 @@ TritonModel::SetBatchingStrategy(const std::string& batch_libpath)
591591
TRITONSERVER_Error* err = batcher_init_fn_(
592592
Batcher(), reinterpret_cast<TRITONBACKEND_Model*>(this));
593593
if (err) {
594-
auto err_message = TRITONSERVER_ErrorMessage(err);
594+
auto status = Status(
595+
TritonCodeToStatusCode(TRITONSERVER_ErrorCode(err)),
596+
TRITONSERVER_ErrorMessage(err));
595597
TRITONSERVER_ErrorDelete(err);
596-
return Status(Status::Code::INVALID_ARG, err_message);
598+
return status;
597599
}
598600
}
599601

@@ -1312,8 +1314,9 @@ TRITONBACKEND_RequestParameter(
13121314
return TRITONSERVER_ErrorNew(
13131315
TRITONSERVER_ERROR_INVALID_ARG,
13141316
("out of bounds index " + std::to_string(index) +
1315-
std::string(": request has ") + std::to_string(parameters.size()) +
1316-
" parameters").c_str());
1317+
std::string(": request has ") + std::to_string(parameters.size()) +
1318+
" parameters")
1319+
.c_str());
13171320
}
13181321

13191322
const InferenceParameter& param = parameters[index];
@@ -1405,7 +1408,8 @@ TRITONBACKEND_InputBuffer(
14051408
InferenceRequest::Input* ti =
14061409
reinterpret_cast<InferenceRequest::Input*>(input);
14071410
Status status = ti->DataBuffer(
1408-
index, buffer, reinterpret_cast<size_t*>(buffer_byte_size), memory_type, memory_type_id);
1411+
index, buffer, reinterpret_cast<size_t*>(buffer_byte_size), memory_type,
1412+
memory_type_id);
14091413
if (!status.IsOk()) {
14101414
*buffer = nullptr;
14111415
*buffer_byte_size = 0;
@@ -1445,10 +1449,11 @@ TRITONBACKEND_InputBufferForHostPolicy(
14451449
Status status =
14461450
(host_policy_name == nullptr)
14471451
? ti->DataBuffer(
1448-
index, buffer, reinterpret_cast<size_t*>(buffer_byte_size), memory_type, memory_type_id)
1452+
index, buffer, reinterpret_cast<size_t*>(buffer_byte_size),
1453+
memory_type, memory_type_id)
14491454
: ti->DataBufferForHostPolicy(
1450-
index, buffer, reinterpret_cast<size_t*>(buffer_byte_size), memory_type, memory_type_id,
1451-
host_policy_name);
1455+
index, buffer, reinterpret_cast<size_t*>(buffer_byte_size),
1456+
memory_type, memory_type_id, host_policy_name);
14521457
if (!status.IsOk()) {
14531458
*buffer = nullptr;
14541459
*buffer_byte_size = 0;

0 commit comments

Comments
 (0)