aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorn.christian@seime.no>2023-10-18 11:01:58 +0200
committerGitHub <noreply@github.com>2023-10-18 11:01:58 +0200
commit36406e8641540bc457ba98591c86309371524472 (patch)
tree08f012b8598c258cb6b4e73b062809099b0afbcf
parentf6f141bf8d983f1b7b0e057c6e225de07dbda6a5 (diff)
parentbd84e40fb7b588ca32f1fb0016ba90ff7ee04584 (diff)
Merge pull request #28998 from vespa-engine/kkraune/locale-independent
Make code locale-independent
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/JvmHeapSizeValidator.java18
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/JvmHeapSizeValidatorTest.java5
2 files changed, 12 insertions, 11 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/JvmHeapSizeValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/JvmHeapSizeValidator.java
index 510fff66c10..425a662bb2d 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/JvmHeapSizeValidator.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/JvmHeapSizeValidator.java
@@ -3,6 +3,7 @@
package com.yahoo.vespa.model.application.validation;
import com.yahoo.config.model.deploy.DeployState;
+import com.yahoo.text.Text;
import com.yahoo.vespa.model.VespaModel;
import java.util.logging.Level;
@@ -32,21 +33,20 @@ public class JvmHeapSizeValidator extends Validator {
double gbLimit = 0.6;
double availableMemoryGb = mp.availableMemoryGb().getAsDouble();
double modelCostGb = jvmModelCost / (1024D * 1024 * 1024);
- ds.getDeployLogger().log(Level.FINE, () -> "JVM: %d%% (limit: %d%%), %.2fGB (limit: %.2fGB), ONNX: %.2fGB"
- .formatted(mp.percentage(), percentLimit, availableMemoryGb, gbLimit, modelCostGb));
+ ds.getDeployLogger().log(Level.FINE, () -> Text.format("JVM: %d%% (limit: %d%%), %.2fGB (limit: %.2fGB), ONNX: %.2fGB",
+ mp.percentage(), percentLimit, availableMemoryGb, gbLimit, modelCostGb));
if (mp.percentage() < percentLimit) {
- throw new IllegalArgumentException(
- ("Allocated percentage of memory of JVM in cluster '%s' is too low (%d%% < %d%%). " +
+ throw new IllegalArgumentException(Text.format("Allocated percentage of memory of JVM in cluster '%s' is too low (%d%% < %d%%). " +
"Estimated cost of ONNX models is %.2fGB. Either use a node flavor with more memory or use less expensive models. " +
- "You may override this validation by specifying 'allocated-memory' (https://docs.vespa.ai/en/performance/container-tuning.html#jvm-heap-size).")
- .formatted(clusterId, mp.percentage(), percentLimit, modelCostGb));
+ "You may override this validation by specifying 'allocated-memory' (https://docs.vespa.ai/en/performance/container-tuning.html#jvm-heap-size).",
+ clusterId, mp.percentage(), percentLimit, modelCostGb));
}
if (availableMemoryGb < gbLimit) {
throw new IllegalArgumentException(
- ("Allocated memory to JVM in cluster '%s' is too low (%.2fGB < %.2fGB). " +
+ Text.format("Allocated memory to JVM in cluster '%s' is too low (%.2fGB < %.2fGB). " +
"Estimated cost of ONNX models is %.2fGB. Either use a node flavor with more memory or use less expensive models. " +
- "You may override this validation by specifying 'allocated-memory' (https://docs.vespa.ai/en/performance/container-tuning.html#jvm-heap-size).")
- .formatted(clusterId, availableMemoryGb, gbLimit, modelCostGb));
+ "You may override this validation by specifying 'allocated-memory' (https://docs.vespa.ai/en/performance/container-tuning.html#jvm-heap-size).",
+ clusterId, availableMemoryGb, gbLimit, modelCostGb));
}
}
});
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/JvmHeapSizeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/JvmHeapSizeValidatorTest.java
index d6da03f5b94..ebd8b5836da 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/JvmHeapSizeValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/JvmHeapSizeValidatorTest.java
@@ -15,6 +15,7 @@ import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.config.model.provision.InMemoryProvisioner;
import com.yahoo.config.model.test.MockApplicationPackage;
import com.yahoo.config.provision.NodeResources;
+import com.yahoo.text.Text;
import com.yahoo.vespa.model.VespaModel;
import org.junit.jupiter.api.Test;
import org.xml.sax.SAXException;
@@ -97,7 +98,7 @@ class JvmHeapSizeValidatorTest {
private static DeployState createDeployState(double nodeGb, long modelCostBytes) {
String servicesXml =
- """
+ Text.format("""
<?xml version="1.0" encoding="utf-8" ?>
<services version='1.0'>
<container version='1.0'>
@@ -109,7 +110,7 @@ class JvmHeapSizeValidatorTest {
<tokenizer-model path="app/tokenizer.json"/>
</component>
</container>
- </services>""".formatted(nodeGb);
+ </services>""", nodeGb);
return createDeployState(servicesXml, nodeGb, modelCostBytes);
}