-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Start, stop and infer with deployment ID (#95168)
A trained model deployment can be started with an optional deployment Id. Deployment Ids and model Ids considered to be in the same namespace and unique, a deployment id cannot be the same as any other deployment or model Id unless it is the same as the model being deployed. When creating a new model, the id cannot match any models or deployments
- Loading branch information
Showing
17 changed files
with
405 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 95168 | ||
summary: "Start, stop and infer of a trained model can now optionally use a deployment ID that is different to the model ID" | ||
area: Machine Learning | ||
type: enhancement | ||
issues: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...s/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MultipleDeploymentsIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* 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.ml.integration; | ||
|
||
import org.elasticsearch.client.Response; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
public class MultipleDeploymentsIT extends PyTorchModelRestTestCase { | ||
|
||
@SuppressWarnings("unchecked") | ||
public void testDeployModelMultipleTimes() throws IOException { | ||
String baseModelId = "base-model"; | ||
createPassThroughModel(baseModelId); | ||
putModelDefinition(baseModelId); | ||
putVocabulary(List.of("these", "are", "my", "words"), baseModelId); | ||
|
||
String forSearch = "for-search"; | ||
startWithDeploymentId(baseModelId, forSearch); | ||
|
||
Response inference = infer("my words", forSearch); | ||
assertOK(inference); | ||
|
||
String forIngest = "for-ingest"; | ||
startWithDeploymentId(baseModelId, forIngest); | ||
|
||
inference = infer("my words", forIngest); | ||
assertOK(inference); | ||
inference = infer("my words", forIngest); | ||
assertOK(inference); | ||
|
||
// TODO | ||
// assertInferenceCount(1, forSearch); | ||
// assertInferenceCount(2, forIngest); | ||
|
||
stopDeployment(forSearch); | ||
stopDeployment(forIngest); | ||
} | ||
|
||
private void putModelDefinition(String modelId) throws IOException { | ||
putModelDefinition(modelId, PyTorchModelIT.BASE_64_ENCODED_MODEL, PyTorchModelIT.RAW_MODEL_SIZE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.