Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ public void init(Client client) {
}

public void onNodeStarted() {
services.values().forEach(InferenceService::onNodeStarted);
for (var service : services.values()) {
try {
service.onNodeStarted();
} catch (Exception e) {
// ignore
}
}
}

public Map<String, InferenceService> getServices() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public class BaseMockEISAuthServerTest extends ESRestTestCase {
.setting("xpack.security.enabled", "true")
// Adding both settings unless one feature flag is disabled in a particular environment
.setting("xpack.inference.elastic.url", mockEISServer::getUrl)
// If we don't disable this there's a very small chance that the authorization code could attempt to make two
// calls which would result in a test failure because the webserver is only expecting a single request
// So to ensure we avoid that all together, this flag indicates that we'll only perform a single authorization request
.setting("xpack.inference.elastic.periodic_authorization_enabled", "false")
// This plugin is located in the inference/qa/test-service-plugin package, look for TestInferenceServicePlugin
.plugin("inference-service-test")
.user("x_pack_rest_user", "x-pack-test-password")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
import org.elasticsearch.xpack.inference.services.elastic.ElasticInferenceService;
import org.elasticsearch.xpack.inference.services.elastic.ElasticInferenceServiceComponents;
import org.elasticsearch.xpack.inference.services.elastic.ElasticInferenceServiceSettings;
import org.elasticsearch.xpack.inference.services.elastic.authorization.ElasticInferenceServiceAuthorizationHandler;
import org.elasticsearch.xpack.inference.services.elastic.authorization.ElasticInferenceServiceAuthorizationRequestHandler;
import org.elasticsearch.xpack.inference.services.elasticsearch.ElasticsearchInternalService;
import org.elasticsearch.xpack.inference.services.googleaistudio.GoogleAiStudioService;
import org.elasticsearch.xpack.inference.services.googlevertexai.GoogleVertexAiService;
Expand Down Expand Up @@ -274,23 +274,17 @@ public Collection<?> createComponents(PluginServices services) {
);
elasicInferenceServiceFactory.set(elasticInferenceServiceRequestSenderFactory);

ElasticInferenceServiceSettings inferenceServiceSettings = new ElasticInferenceServiceSettings(settings);
String elasticInferenceUrl = inferenceServiceSettings.getElasticInferenceServiceUrl();
var inferenceServiceSettings = new ElasticInferenceServiceSettings(settings);
inferenceServiceSettings.init(services.clusterService());

var elasticInferenceServiceComponentsInstance = ElasticInferenceServiceComponents.withDefaultRevokeDelay(elasticInferenceUrl);
elasticInferenceServiceComponents.set(elasticInferenceServiceComponentsInstance);

var authorizationHandler = new ElasticInferenceServiceAuthorizationHandler(
elasticInferenceServiceComponentsInstance.elasticInferenceServiceUrl(),
services.threadPool()
);
var authorizationHandler = new ElasticInferenceServiceAuthorizationRequestHandler(inferenceServiceSettings, services.threadPool());

inferenceServices.add(
() -> List.of(
context -> new ElasticInferenceService(
elasicInferenceServiceFactory.get(),
serviceComponents.get(),
elasticInferenceServiceComponentsInstance,
inferenceServiceSettings,
modelRegistry,
authorizationHandler
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

package org.elasticsearch.xpack.inference.services.elastic;

import org.elasticsearch.inference.MinimalServiceSettings;
import org.elasticsearch.inference.Model;

public record DefaultModelConfig(Model model, MinimalServiceSettings settings) {

}
Loading