aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-11-05 11:24:06 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2021-11-05 11:24:06 +0100
commit8709b88bb1ab50242687706217cf843fb9f6452c (patch)
tree03b9016df6561f912f61b195b66083a27e5b350b /config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java
parent6b48d8014e6284f67a5291f18fdbd233771dcd53 (diff)
LargeExpressions are not needed in the vespa-model after construction, so do not keep it alive for nothing
Diffstat (limited to 'config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java21
1 files changed, 7 insertions, 14 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java b/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java
index 92e1226ddf6..362b3f3a75c 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java
@@ -128,11 +128,6 @@ public final class VespaModel extends AbstractConfigProducerRoot implements Seri
/** The global ranking constants of this model */
private final RankingConstants rankingConstants;
- /** Large rank expression files of this */
- private final LargeRankExpressions largeRankExpressions;
-
- private final FileRegistry fileRegistry;
-
/** The validation overrides of this. This is never null. */
private final ValidationOverrides validationOverrides;
@@ -176,8 +171,6 @@ public final class VespaModel extends AbstractConfigProducerRoot implements Seri
throws IOException, SAXException {
super("vespamodel");
version = deployState.getVespaVersion();
- fileRegistry = deployState.getFileRegistry();
- largeRankExpressions = new LargeRankExpressions(deployState.getFileRegistry());
rankingConstants = new RankingConstants(deployState.getFileRegistry(), Optional.empty());
validationOverrides = deployState.validationOverrides();
applicationPackage = deployState.getApplicationPackage();
@@ -185,10 +178,10 @@ public final class VespaModel extends AbstractConfigProducerRoot implements Seri
VespaModelBuilder builder = new VespaDomBuilder();
root = builder.getRoot(VespaModel.ROOT_CONFIGID, deployState, this);
- createGlobalRankProfiles(deployState);
+ createGlobalRankProfiles(deployState, rankingConstants, deployState.getFileRegistry());
rankProfileList = new RankProfileList(null, // null search -> global
rankingConstants,
- largeRankExpressions,
+ new LargeRankExpressions(deployState.getFileRegistry()),
new OnnxModels(deployState.getFileRegistry(), Optional.empty()),
AttributeFields.empty,
deployState.rankProfileRegistry(),
@@ -289,7 +282,7 @@ public final class VespaModel extends AbstractConfigProducerRoot implements Seri
* Creates a rank profile not attached to any search definition, for each imported model in the application package,
* and adds it to the given rank profile registry.
*/
- private void createGlobalRankProfiles(DeployState deployState) {
+ private void createGlobalRankProfiles(DeployState deployState, RankingConstants rankingConstants, FileRegistry fileRegistry) {
var importedModels = deployState.getImportedModels().all();
DeployLogger deployLogger = deployState.getDeployLogger();
RankProfileRegistry rankProfileRegistry = deployState.rankProfileRegistry();
@@ -298,7 +291,7 @@ public final class VespaModel extends AbstractConfigProducerRoot implements Seri
if ( ! importedModels.isEmpty()) { // models/ directory is available
for (ImportedMlModel model : importedModels) {
// Due to automatic naming not guaranteeing unique names, there must be a 1-1 between OnnxModels and global RankProfiles.
- OnnxModels onnxModels = onnxModelInfoFromSource(model);
+ OnnxModels onnxModels = onnxModelInfoFromSource(model, fileRegistry);
RankProfile profile = new RankProfile(model.name(), applicationPackage, deployLogger, rankProfileRegistry, rankingConstants, onnxModels);
rankProfileRegistry.add(profile);
futureModels.add(deployState.getExecutor().submit(() -> {
@@ -315,7 +308,7 @@ public final class VespaModel extends AbstractConfigProducerRoot implements Seri
String modelName = generatedModelDir.getPath().last();
if (modelName.contains(".")) continue; // Name space: Not a global profile
// Due to automatic naming not guaranteeing unique names, there must be a 1-1 between OnnxModels and global RankProfiles.
- OnnxModels onnxModels = onnxModelInfoFromStore(modelName);
+ OnnxModels onnxModels = onnxModelInfoFromStore(modelName, fileRegistry);
RankProfile profile = new RankProfile(modelName, applicationPackage, deployLogger, rankProfileRegistry, rankingConstants, onnxModels);
rankProfileRegistry.add(profile);
futureModels.add(deployState.getExecutor().submit(() -> {
@@ -335,7 +328,7 @@ public final class VespaModel extends AbstractConfigProducerRoot implements Seri
new Processing().processRankProfiles(deployLogger, rankProfileRegistry, queryProfiles, true, false);
}
- private OnnxModels onnxModelInfoFromSource(ImportedMlModel model) {
+ private OnnxModels onnxModelInfoFromSource(ImportedMlModel model, FileRegistry fileRegistry) {
OnnxModels onnxModels = new OnnxModels(fileRegistry, Optional.empty());
if (model.modelType().equals(ImportedMlModel.ModelType.ONNX)) {
String path = model.source();
@@ -348,7 +341,7 @@ public final class VespaModel extends AbstractConfigProducerRoot implements Seri
return onnxModels;
}
- private OnnxModels onnxModelInfoFromStore(String modelName) {
+ private OnnxModels onnxModelInfoFromStore(String modelName, FileRegistry fileRegistry) {
String path = ApplicationPackage.MODELS_DIR.append(modelName + ".onnx").toString();
OnnxModels onnxModels = new OnnxModels(fileRegistry, Optional.empty());
loadOnnxModelInfo(onnxModels, modelName, path);