summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/searchdefinition
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-05-11 23:49:45 +0200
committerGitHub <noreply@github.com>2022-05-11 23:49:45 +0200
commitcd75d7bd21d5e5d084c17d2831c43a14dbff8efa (patch)
treeed0ef6db7f9b348da7279dfb93234f19ec6d73e5 /config-model/src/main/java/com/yahoo/searchdefinition
parentf055594f402631c216241a123144bbe171c61e4b (diff)
Revert "Pass DeployState"
Diffstat (limited to 'config-model/src/main/java/com/yahoo/searchdefinition')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/DerivedConfiguration.java45
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/RankProfileList.java37
2 files changed, 48 insertions, 34 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/DerivedConfiguration.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/DerivedConfiguration.java
index 8dec0e8339a..0c7c507f32d 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/DerivedConfiguration.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/DerivedConfiguration.java
@@ -1,8 +1,13 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchdefinition.derived;
+import ai.vespa.rankingexpression.importer.configmodelview.ImportedMlModels;
+import com.yahoo.concurrent.InThreadExecutorService;
import com.yahoo.config.ConfigInstance;
-import com.yahoo.config.model.deploy.DeployState;
+import com.yahoo.config.model.api.ModelContext;
+import com.yahoo.config.model.application.provider.BaseDeployLogger;
+import com.yahoo.config.application.api.DeployLogger;
+import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.document.config.DocumenttypesConfig;
import com.yahoo.document.config.DocumentmanagerConfig;
import com.yahoo.io.IOUtils;
@@ -16,6 +21,7 @@ import com.yahoo.vespa.model.container.search.QueryProfiles;
import java.io.IOException;
import java.io.Writer;
+import java.util.concurrent.ExecutorService;
/**
* A set of all derived configuration of a schema. Use this as a facade to individual configurations when
@@ -56,36 +62,47 @@ public class DerivedConfiguration implements AttributesConfig.Producer {
}
DerivedConfiguration(Schema schema, RankProfileRegistry rankProfileRegistry, QueryProfileRegistry queryProfiles) {
- this(schema, new DeployState.Builder().rankProfileRegistry(rankProfileRegistry).queryProfiles(queryProfiles).build());
+ this(schema, new BaseDeployLogger(), new TestProperties(), rankProfileRegistry, queryProfiles, new ImportedMlModels(), new InThreadExecutorService());
}
/**
- * Creates a complete derived configuration snapshot from a schema.
+ * Creates a complete derived configuration snapshot from a search definition.
*
- * @param schema the schema to derive a configuration from. Derived objects will be snapshots, but this
- * argument is live. Which means that this object will be inconsistent if the given
- * schema is later modified.
+ * @param schema the search to derive a configuration from. Derived objects will be snapshots, but this
+ * argument is live. Which means that this object will be inconsistent when the given
+ * search definition is later modified.
+ * @param deployLogger a {@link DeployLogger} for logging when doing operations on this
+ * @param deployProperties properties set on deploy
+ * @param rankProfileRegistry a {@link com.yahoo.searchdefinition.RankProfileRegistry}
+ * @param queryProfiles the query profiles of this application
*/
- public DerivedConfiguration(Schema schema, DeployState deployState) {
- Validator.ensureNotNull("Schema", schema);
+ public DerivedConfiguration(Schema schema,
+ DeployLogger deployLogger,
+ ModelContext.Properties deployProperties,
+ RankProfileRegistry rankProfileRegistry,
+ QueryProfileRegistry queryProfiles,
+ ImportedMlModels importedModels,
+ ExecutorService executor) {
+ Validator.ensureNotNull("Search definition", schema);
this.schema = schema;
- this.queryProfiles = deployState.getQueryProfiles().getRegistry();
- this.maxUncommittedMemory = deployState.getProperties().featureFlags().maxUnCommittedMemory();
- this.enableBitVectors = deployState.getProperties().featureFlags().enableBitVectors();
+ this.queryProfiles = queryProfiles;
+ this.maxUncommittedMemory = deployProperties.featureFlags().maxUnCommittedMemory();
+ this.enableBitVectors = deployProperties.featureFlags().enableBitVectors();
if ( ! schema.isDocumentsOnly()) {
streamingFields = new VsmFields(schema);
streamingSummary = new VsmSummary(schema);
}
if ( ! schema.isDocumentsOnly()) {
attributeFields = new AttributeFields(schema);
- summaries = new Summaries(schema, deployState.getDeployLogger(), deployState.getProperties().featureFlags());
+ summaries = new Summaries(schema, deployLogger, deployProperties.featureFlags());
summaryMap = new SummaryMap(schema);
juniperrc = new Juniperrc(schema);
rankProfileList = new RankProfileList(schema, schema.rankingConstants(), schema.rankExpressionFiles(),
- schema.onnxModels(), attributeFields, deployState);
+ schema.onnxModels(), attributeFields, rankProfileRegistry,
+ queryProfiles, importedModels, deployProperties, executor);
indexingScript = new IndexingScript(schema);
indexInfo = new IndexInfo(schema);
- schemaInfo = new SchemaInfo(schema, deployState.rankProfileRegistry(), summaries, summaryMap);
+ schemaInfo = new SchemaInfo(schema, rankProfileRegistry, summaries, summaryMap);
indexSchema = new IndexSchema(schema);
importedFields = new ImportedFields(schema);
}
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 a55c97f4ebb..c36bd96d309 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
@@ -3,7 +3,6 @@ package com.yahoo.searchdefinition.derived;
import ai.vespa.rankingexpression.importer.configmodelview.ImportedMlModels;
import com.yahoo.config.model.api.ModelContext;
-import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.search.query.profile.QueryProfileRegistry;
import com.yahoo.searchdefinition.OnnxModel;
import com.yahoo.searchdefinition.OnnxModels;
@@ -61,12 +60,16 @@ public class RankProfileList extends Derived implements RankProfilesConfig.Produ
LargeRankExpressions largeRankExpressions,
OnnxModels onnxModels,
AttributeFields attributeFields,
- DeployState deployState) {
+ RankProfileRegistry rankProfileRegistry,
+ QueryProfileRegistry queryProfiles,
+ ImportedMlModels importedModels,
+ ModelContext.Properties deployProperties,
+ ExecutorService executor) {
setName(schema == null ? "default" : schema.getName());
this.rankingConstants = rankingConstants;
this.largeRankExpressions = largeRankExpressions;
this.onnxModels = onnxModels; // as ONNX models come from parsing rank expressions
- deriveRankProfiles(schema, attributeFields, deployState);
+ deriveRankProfiles(rankProfileRegistry, queryProfiles, importedModels, schema, attributeFields, deployProperties, executor);
}
private boolean areDependenciesReady(RankProfile rank, RankProfileRegistry registry) {
@@ -75,34 +78,28 @@ public class RankProfileList extends Derived implements RankProfilesConfig.Produ
(rank.schema() != null && rank.inheritedNames().stream().allMatch(name -> registry.resolve(rank.schema().getDocument(), name) != null));
}
- private void deriveRankProfiles(Schema schema,
+ private void deriveRankProfiles(RankProfileRegistry rankProfileRegistry,
+ QueryProfileRegistry queryProfiles,
+ ImportedMlModels importedModels,
+ Schema schema,
AttributeFields attributeFields,
- DeployState deployState) {
+ ModelContext.Properties deployProperties,
+ ExecutorService executor) {
if (schema != null) { // profiles belonging to a search have a default profile
- RawRankProfile rawRank = new RawRankProfile(deployState.rankProfileRegistry().get(schema, "default"),
- largeRankExpressions,
- deployState.getQueryProfiles().getRegistry(),
- deployState.getImportedModels(),
- attributeFields,
- deployState.getProperties());
+ RawRankProfile rawRank = new RawRankProfile(rankProfileRegistry.get(schema, "default"),
+ largeRankExpressions, queryProfiles, importedModels, attributeFields, deployProperties);
rankProfiles.put(rawRank.getName(), rawRank);
}
Map<String, RankProfile> remaining = new LinkedHashMap<>();
- deployState.rankProfileRegistry().rankProfilesOf(schema).forEach(rank -> remaining.put(rank.name(), rank));
+ rankProfileRegistry.rankProfilesOf(schema).forEach(rank -> remaining.put(rank.name(), rank));
remaining.remove("default");
while (!remaining.isEmpty()) {
List<RankProfile> ready = new ArrayList<>();
remaining.forEach((name, rank) -> {
- if (areDependenciesReady(rank, deployState.rankProfileRegistry())) ready.add(rank);
+ if (areDependenciesReady(rank, rankProfileRegistry)) ready.add(rank);
});
- processRankProfiles(ready,
- deployState.getQueryProfiles().getRegistry(),
- deployState.getImportedModels(),
- schema,
- attributeFields,
- deployState.getProperties(),
- deployState.getExecutor());
+ processRankProfiles(ready, queryProfiles, importedModels, schema, attributeFields, deployProperties, executor);
ready.forEach(rank -> remaining.remove(rank.name()));
}
}