Skip to content

Commit

Permalink
Move the setup mehtod body to test method body
Browse files Browse the repository at this point in the history
Signed-off-by: zane-neo <[email protected]>
  • Loading branch information
zane-neo committed Oct 15, 2024
1 parent 643ce74 commit 0b33438
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ private void triggerUndeployModelsOnDataNodes(List<String> dataNodeIds) {
client.execute(MLUndeployModelAction.INSTANCE, undeployModelNodesRequest, undeployModelListener);
}
}
}, e -> { log.error("Failed to query need undeploy models, no action will be performed"); });
}, e -> { log.error("Failed to query need undeploy models, no action will be performed", e); });
queryRunningModels(listener);
}

Expand Down Expand Up @@ -259,6 +259,10 @@ private void queryRunningModels(ActionListener<SearchResponse> listener) {

@SuppressWarnings("unchecked")
private void triggerModelRedeploy(ModelAutoRedeployArrangement modelAutoRedeployArrangement) {
if (modelAutoRedeployArrangement == null) {
log.info("No more models in arrangement, skipping the redeployment");
return;
}
String modelId = modelAutoRedeployArrangement.getSearchResponse().getId();
List<String> addedNodes = modelAutoRedeployArrangement.getAddedNodes();
Map<String, Object> sourceAsMap = modelAutoRedeployArrangement.getSearchResponse().getSourceAsMap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,17 @@

import static org.opensearch.ml.common.MLTask.MODEL_ID_FIELD;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

import org.junit.Before;
import org.opensearch.ml.common.MLTaskState;
import org.opensearch.ml.rest.MLCommonsRestTestCase;

import lombok.SneakyThrows;

public class MLModelAutoReDeployerIT extends MLCommonsRestTestCase {

@Before
public void setup() throws IOException {
public void testModelAutoRedeploy() {
prepareModel();
}

Expand Down Expand Up @@ -65,9 +62,4 @@ private void prepareModel() {
});
}

public void testModelAutoRedeploy() {
// This is a tricky IT to test model auto redeploy, since model auto redeploy is not easily to test with IT, so adding this test
// to mimic a case when a cluster spin up and immediately deploy a model, the model auto redeployer also selected this deploying
// model to deploy, and the original deploy task should complete and the auto redeploy task should fail in background.
}
}

0 comments on commit 0b33438

Please sign in to comment.