From 1af10ae05786e698985bd6ff0329d2325f2a44e9 Mon Sep 17 00:00:00 2001 From: Bhavana Goud Ramaram Date: Wed, 27 Nov 2024 11:57:45 -0600 Subject: [PATCH 1/2] fix for sync up job not working in 2.17 when upgraded from previous versions Signed-off-by: Bhavana Goud Ramaram --- .../org/opensearch/ml/autoredeploy/MLModelAutoReDeployer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugin/src/main/java/org/opensearch/ml/autoredeploy/MLModelAutoReDeployer.java b/plugin/src/main/java/org/opensearch/ml/autoredeploy/MLModelAutoReDeployer.java index ac38ce24c6..9f8bfa7374 100644 --- a/plugin/src/main/java/org/opensearch/ml/autoredeploy/MLModelAutoReDeployer.java +++ b/plugin/src/main/java/org/opensearch/ml/autoredeploy/MLModelAutoReDeployer.java @@ -261,6 +261,7 @@ private void queryRunningModels(ActionListener listener) { private void triggerModelRedeploy(ModelAutoRedeployArrangement modelAutoRedeployArrangement) { if (modelAutoRedeployArrangement == null) { log.info("No more models in arrangement, skipping the redeployment"); + redeployAModel(); return; } String modelId = modelAutoRedeployArrangement.getSearchResponse().getId(); @@ -275,10 +276,12 @@ private void triggerModelRedeploy(ModelAutoRedeployArrangement modelAutoRedeploy "Model function_name or algorithm is null, model is not in correct status, please check the model, model id is: {}", modelId ); + redeployAModel(); return; } if (FunctionName.REMOTE == FunctionName.from(functionName)) { log.info("Skipping redeploying remote model {} as remote model deployment can be done at prediction time.", modelId); + redeployAModel(); return; } List planningWorkerNodes = (List) sourceAsMap.get(MLModel.PLANNING_WORKER_NODES_FIELD); @@ -302,6 +305,7 @@ private void triggerModelRedeploy(ModelAutoRedeployArrangement modelAutoRedeploy .info( "Allow custom deployment plan is true and deploy to all nodes is false and added nodes are not in planning worker nodes list, not to auto redeploy the model to the new nodes!" ); + redeployAModel(); return; } From 2d4e64a01842b5d38b4813a9b342940f3b4dd6ba Mon Sep 17 00:00:00 2001 From: Bhavana Goud Ramaram Date: Thu, 5 Dec 2024 12:26:00 -0600 Subject: [PATCH 2/2] add sync-up job in missing places Signed-off-by: Bhavana Goud Ramaram --- .../opensearch/ml/autoredeploy/MLModelAutoReDeployer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/org/opensearch/ml/autoredeploy/MLModelAutoReDeployer.java b/plugin/src/main/java/org/opensearch/ml/autoredeploy/MLModelAutoReDeployer.java index 9f8bfa7374..0b885ac9ab 100644 --- a/plugin/src/main/java/org/opensearch/ml/autoredeploy/MLModelAutoReDeployer.java +++ b/plugin/src/main/java/org/opensearch/ml/autoredeploy/MLModelAutoReDeployer.java @@ -186,6 +186,10 @@ private void triggerAutoDeployModels(List addedNodes) { modelAutoRedeployArrangements.add(modelAutoRedeployArrangement); }); redeployAModel(); + } else { + log.info("Could not find any models in the index, not performing auto reloading!"); + startCronjobAndClearListener(); + return; } }, e -> { if (e instanceof IndexNotFoundException) { @@ -261,7 +265,7 @@ private void queryRunningModels(ActionListener listener) { private void triggerModelRedeploy(ModelAutoRedeployArrangement modelAutoRedeployArrangement) { if (modelAutoRedeployArrangement == null) { log.info("No more models in arrangement, skipping the redeployment"); - redeployAModel(); + startCronjobAndClearListener(); return; } String modelId = modelAutoRedeployArrangement.getSearchResponse().getId();