From 87b86bb3a3104df89bd9bdf99d0dae3e52e7605c Mon Sep 17 00:00:00 2001 From: David Thomas Date: Wed, 23 Oct 2024 14:12:07 -0700 Subject: [PATCH] =?UTF-8?q?[fix]=20Propagate=20predict=20output=20code=20t?= =?UTF-8?q?o=20batch=20request=20output=20codes=20in=20=E2=80=A6=20(#2481)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/ai/djl/python/engine/RollingBatch.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engines/python/src/main/java/ai/djl/python/engine/RollingBatch.java b/engines/python/src/main/java/ai/djl/python/engine/RollingBatch.java index 18266ff70..ca7c7cd7d 100644 --- a/engines/python/src/main/java/ai/djl/python/engine/RollingBatch.java +++ b/engines/python/src/main/java/ai/djl/python/engine/RollingBatch.java @@ -180,6 +180,11 @@ public void run() { BytesSupplier err = BytesSupplier.wrap(JsonUtils.GSON.toJson(out)); for (Request req : list) { req.last = true; + if (isBackportForNonStreamingHttpErrorCodes) { + // Note: This will only change the HTTP response code if the first chunk + // has not yet been sent + req.output.setCode(code); + } req.data.appendContent(err, true); } list.clear();