diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-09-08 11:05:30 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-09-08 11:05:30 +0200 |
commit | f86828a933b4d356d0f3eefc0cc7a145a4e7297b (patch) | |
tree | 68a70ac8f8015f3835dcdc0bb813e7e5819fbf2e /config-model | |
parent | 561703e6a24afae1d5a08c76832eceaecb5acb12 (diff) |
GC dry-run-onnx-on-setup flag
Diffstat (limited to 'config-model')
3 files changed, 10 insertions, 22 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java index 34d5533364f..b42686406b5 100644 --- a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java +++ b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java @@ -2,7 +2,6 @@ package com.yahoo.config.model.deploy; import com.google.common.collect.ImmutableList; -import com.yahoo.config.model.api.ApplicationRoles; import com.yahoo.config.model.api.ConfigServerSpec; import com.yahoo.config.model.api.ContainerEndpoint; import com.yahoo.config.model.api.EndpointCertificateSecrets; @@ -60,7 +59,6 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea private int maxMergeQueueSize = 1024; private int largeRankExpressionLimit = 8192; private boolean allowDisableMtls = true; - private boolean dryRunOnnxOnSetup = false; private List<X509Certificate> operatorCertificates = Collections.emptyList(); private double resourceLimitDisk = 0.8; private double resourceLimitMemory = 0.8; @@ -105,17 +103,12 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea @Override public int largeRankExpressionLimit() { return largeRankExpressionLimit; } @Override public int maxConcurrentMergesPerNode() { return maxConcurrentMergesPerNode; } @Override public int maxMergeQueueSize() { return maxMergeQueueSize; } - @Override public boolean dryRunOnnxOnSetup() { return dryRunOnnxOnSetup; } @Override public double resourceLimitDisk() { return resourceLimitDisk; } @Override public double resourceLimitMemory() { return resourceLimitMemory; } @Override public double minNodeRatioPerGroup() { return minNodeRatioPerGroup; } @Override public int metricsproxyNumThreads() { return 1; } @Override public boolean enforceRankProfileInheritance() { return true; } - public TestProperties setDryRunOnnxOnSetup(boolean value) { - dryRunOnnxOnSetup = value; - return this; - } public TestProperties useExternalRankExpression(boolean value) { useExternalRankExpression = value; return this; diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/RankProfileList.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/RankProfileList.java index 6528c9195d4..122c39f440f 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/RankProfileList.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/RankProfileList.java @@ -40,7 +40,6 @@ public class RankProfileList extends Derived implements RankProfilesConfig.Produ private final RankingConstants rankingConstants; private final LargeRankExpressions largeRankExpressions; private final OnnxModels onnxModels; - private final boolean dryRunOnnxOnSetup; public static RankProfileList empty = new RankProfileList(); @@ -48,7 +47,6 @@ public class RankProfileList extends Derived implements RankProfilesConfig.Produ rankingConstants = new RankingConstants(null); largeRankExpressions = new LargeRankExpressions(null); onnxModels = new OnnxModels(null); - dryRunOnnxOnSetup = true; } /** @@ -71,7 +69,6 @@ public class RankProfileList extends Derived implements RankProfilesConfig.Produ this.rankingConstants = rankingConstants; this.largeRankExpressions = largeRankExpressions; this.onnxModels = onnxModels; // as ONNX models come from parsing rank expressions - dryRunOnnxOnSetup = deployProperties.featureFlags().dryRunOnnxOnSetup(); deriveRankProfiles(rankProfileRegistry, queryProfiles, importedModels, search, attributeFields, deployProperties, executor); } @@ -154,7 +151,7 @@ public class RankProfileList extends Derived implements RankProfilesConfig.Produ log.warning("Illegal file reference " + model); // Let tests pass ... we should find a better way else { OnnxModelsConfig.Model.Builder modelBuilder = new OnnxModelsConfig.Model.Builder(); - modelBuilder.dry_run_on_setup(dryRunOnnxOnSetup); + modelBuilder.dry_run_on_setup(true); modelBuilder.name(model.getName()); modelBuilder.fileref(model.getFileReference()); model.getInputMap().forEach((name, source) -> modelBuilder.input(new OnnxModelsConfig.Model.Input.Builder().name(name).source(source))); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxModelTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxModelTestCase.java index ab148130a7d..f1f6860c197 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxModelTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxModelTestCase.java @@ -2,10 +2,8 @@ package com.yahoo.searchdefinition.processing; import com.yahoo.config.application.api.ApplicationPackage; -import com.yahoo.config.model.api.ModelContext; import com.yahoo.config.model.application.provider.FilesApplicationPackage; import com.yahoo.config.model.deploy.DeployState; -import com.yahoo.config.model.deploy.TestProperties; import com.yahoo.io.IOUtils; import com.yahoo.path.Path; import com.yahoo.vespa.config.search.RankProfilesConfig; @@ -17,6 +15,7 @@ import org.junit.After; import org.junit.Test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; public class RankingExpressionWithOnnxModelTestCase { @@ -29,9 +28,9 @@ public class RankingExpressionWithOnnxModelTestCase { @Test public void testOnnxModelFeature() throws Exception { - VespaModel model = loadModel(applicationDir, false); + VespaModel model = loadModel(applicationDir); assertTransformedFeature(model); - assertGeneratedConfig(model, false); + assertGeneratedConfig(model); Path storedApplicationDir = applicationDir.append("copy"); try { @@ -41,30 +40,29 @@ public class RankingExpressionWithOnnxModelTestCase { IOUtils.copyDirectory(applicationDir.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile(), storedApplicationDir.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile()); - VespaModel storedModel = loadModel(storedApplicationDir, true); + VespaModel storedModel = loadModel(storedApplicationDir); assertTransformedFeature(storedModel); - assertGeneratedConfig(storedModel, true); + assertGeneratedConfig(storedModel); } finally { IOUtils.recursiveDeleteDir(storedApplicationDir.toFile()); } } - private VespaModel loadModel(Path path, boolean dryRunOnnx) throws Exception { + private VespaModel loadModel(Path path) throws Exception { FilesApplicationPackage applicationPackage = FilesApplicationPackage.fromFile(path.toFile()); - ModelContext.Properties properties = new TestProperties().setDryRunOnnxOnSetup(dryRunOnnx); - DeployState state = new DeployState.Builder().applicationPackage(applicationPackage).properties(properties).build(); + DeployState state = new DeployState.Builder().applicationPackage(applicationPackage).build(); return new VespaModel(state); } - private void assertGeneratedConfig(VespaModel vespaModel, boolean expectDryRunOnnx) { + private void assertGeneratedConfig(VespaModel vespaModel) { DocumentDatabase db = ((IndexedSearchCluster)vespaModel.getSearchClusters().get(0)).getDocumentDbs().get(0); OnnxModelsConfig.Builder builder = new OnnxModelsConfig.Builder(); ((OnnxModelsConfig.Producer) db).getConfig(builder); OnnxModelsConfig config = new OnnxModelsConfig(builder); assertEquals(6, config.model().size()); for (OnnxModelsConfig.Model model : config.model()) { - assertEquals(expectDryRunOnnx, model.dry_run_on_setup()); + assertTrue(model.dry_run_on_setup()); } OnnxModelsConfig.Model model = config.model(0); |