diff options
author | gjoranv <gv@verizonmedia.com> | 2021-07-01 02:30:53 +0200 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2021-07-02 15:56:17 +0200 |
commit | fcb699ac64db02e455a43c9397437158c47d2d21 (patch) | |
tree | 5f0e8c098c53015af19d368d9b9efe13ffef638d /config-model/src/main/java/com/yahoo | |
parent | 910fbc28f104b7203ae123801b51b9a7cd03b886 (diff) |
Install model-evaluation + integration via config-model.
- Only for application container clusters.
Diffstat (limited to 'config-model/src/main/java/com/yahoo')
2 files changed, 18 insertions, 3 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModelEvaluation.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModelEvaluation.java index 37bfb8821c3..65247f29281 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModelEvaluation.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModelEvaluation.java @@ -10,7 +10,9 @@ import com.yahoo.vespa.config.search.core.RankingConstantsConfig; import com.yahoo.vespa.config.search.core.RankingExpressionsConfig; import com.yahoo.vespa.model.container.component.Handler; import com.yahoo.vespa.model.container.component.SystemBindingPattern; +import com.yahoo.vespa.model.container.xml.PlatformBundles; +import java.nio.file.Path; import java.util.List; import java.util.Objects; @@ -26,17 +28,21 @@ public class ContainerModelEvaluation implements OnnxModelsConfig.Producer, RankingExpressionsConfig.Producer { - private final static String BUNDLE_NAME = "model-evaluation"; + private final static String EVALUATION_BUNDLE_NAME = "model-evaluation"; + private final static String INTEGRATION_BUNDLE_NAME = "model-integration"; private final static String EVALUATOR_NAME = ModelsEvaluator.class.getName(); private final static String REST_HANDLER_NAME = "ai.vespa.models.handler.ModelsEvaluationHandler"; private final static String REST_BINDING_PATH = "/model-evaluation/v1"; + public static final Path MODEL_EVALUATION_BUNDLE_FILE = PlatformBundles.absoluteBundlePath(EVALUATION_BUNDLE_NAME); + public static final Path MODEL_INTEGRATION_BUNDLE_FILE = PlatformBundles.absoluteBundlePath(INTEGRATION_BUNDLE_NAME); + /** Global rank profiles, aka models */ private final RankProfileList rankProfileList; public ContainerModelEvaluation(ApplicationContainerCluster cluster, RankProfileList rankProfileList) { this.rankProfileList = Objects.requireNonNull(rankProfileList, "rankProfileList cannot be null"); - cluster.addSimpleComponent(EVALUATOR_NAME, null, BUNDLE_NAME); + cluster.addSimpleComponent(EVALUATOR_NAME, null, EVALUATION_BUNDLE_NAME); cluster.addComponent(ContainerModelEvaluation.getHandler()); } @@ -64,7 +70,7 @@ public class ContainerModelEvaluation implements } public static Handler<?> getHandler() { - Handler<?> handler = new Handler<>(new ComponentModel(REST_HANDLER_NAME, null, BUNDLE_NAME)); + Handler<?> handler = new Handler<>(new ComponentModel(REST_HANDLER_NAME, null, EVALUATION_BUNDLE_NAME)); handler.addServerBindings( SystemBindingPattern.fromHttpPath(REST_BINDING_PATH), SystemBindingPattern.fromHttpPath(REST_BINDING_PATH + "/*")); diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java index 3b04d536300..5bf8aa5228e 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java @@ -187,6 +187,7 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> { throwUponRestApi(spec); // TODO: remove addServlets(deployState, spec, cluster); addModelEvaluation(spec, cluster, context); + addModelEvaluationBundles(cluster); addProcessing(deployState, spec, cluster); addSearch(deployState, spec, cluster); @@ -565,6 +566,14 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> { cluster.setModelEvaluation(new ContainerModelEvaluation(cluster, profiles)); } + protected void addModelEvaluationBundles(ApplicationContainerCluster cluster) { + /* These bundles are added to all application container clusters, even if they haven't + * declared 'model-evaluation' in services.xml, because there are many public API packages + * in the model-evaluation bundle that could be used by customer code. */ + cluster.addPlatformBundle(ContainerModelEvaluation.MODEL_EVALUATION_BUNDLE_FILE); + cluster.addPlatformBundle(ContainerModelEvaluation.MODEL_INTEGRATION_BUNDLE_FILE); + } + private void addProcessing(DeployState deployState, Element spec, ApplicationContainerCluster cluster) { Element processingElement = XML.getChild(spec, "processing"); if (processingElement == null) return; |