From 1dcf1377b6137d5b6310dccea24fbe44913595da Mon Sep 17 00:00:00 2001 From: Owais Kazi Date: Fri, 19 Jan 2024 17:20:55 -0800 Subject: [PATCH] Removed noop DeleteModelGroup step Signed-off-by: Owais Kazi --- .../common/WorkflowResources.java | 4 +- .../workflow/DeleteModelGroupStep.java | 40 ------------------- .../workflow/WorkflowStepFactory.java | 2 +- .../resources/mappings/workflow-steps.json | 5 --- .../workflow/DeleteModelGroupTests.java | 31 -------------- 5 files changed, 3 insertions(+), 79 deletions(-) delete mode 100644 src/main/java/org/opensearch/flowframework/workflow/DeleteModelGroupStep.java delete mode 100644 src/test/java/org/opensearch/flowframework/workflow/DeleteModelGroupTests.java diff --git a/src/main/java/org/opensearch/flowframework/common/WorkflowResources.java b/src/main/java/org/opensearch/flowframework/common/WorkflowResources.java index 47b9a686b..50c37b2ca 100644 --- a/src/main/java/org/opensearch/flowframework/common/WorkflowResources.java +++ b/src/main/java/org/opensearch/flowframework/common/WorkflowResources.java @@ -17,9 +17,9 @@ import org.opensearch.flowframework.workflow.CreateIngestPipelineStep; import org.opensearch.flowframework.workflow.DeleteAgentStep; import org.opensearch.flowframework.workflow.DeleteConnectorStep; -import org.opensearch.flowframework.workflow.DeleteModelGroupStep; import org.opensearch.flowframework.workflow.DeleteModelStep; import org.opensearch.flowframework.workflow.DeployModelStep; +import org.opensearch.flowframework.workflow.NoOpStep; import org.opensearch.flowframework.workflow.RegisterAgentStep; import org.opensearch.flowframework.workflow.RegisterLocalCustomModelStep; import org.opensearch.flowframework.workflow.RegisterLocalPretrainedModelStep; @@ -48,7 +48,7 @@ public enum WorkflowResources { /** Workflow steps for registering/deleting a local OpenSearch provided pretrained model and associated created resource */ REGISTER_LOCAL_PRETRAINED_MODEL(RegisterLocalPretrainedModelStep.NAME, WorkflowResources.MODEL_ID, DeleteModelStep.NAME), /** Workflow steps for registering/deleting a model group and associated created resource */ - REGISTER_MODEL_GROUP(RegisterModelGroupStep.NAME, WorkflowResources.MODEL_GROUP_ID, DeleteModelGroupStep.NAME), + REGISTER_MODEL_GROUP(RegisterModelGroupStep.NAME, WorkflowResources.MODEL_GROUP_ID, NoOpStep.NAME), /** Workflow steps for deploying/undeploying a model and associated created resource */ DEPLOY_MODEL(DeployModelStep.NAME, WorkflowResources.MODEL_ID, UndeployModelStep.NAME), /** Workflow steps for creating an ingest-pipeline and associated created resource */ diff --git a/src/main/java/org/opensearch/flowframework/workflow/DeleteModelGroupStep.java b/src/main/java/org/opensearch/flowframework/workflow/DeleteModelGroupStep.java deleted file mode 100644 index 5edea653f..000000000 --- a/src/main/java/org/opensearch/flowframework/workflow/DeleteModelGroupStep.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ -package org.opensearch.flowframework.workflow; - -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -/** - * Step to delete a model group - */ -public class DeleteModelGroupStep implements WorkflowStep { - - /** Instantiate this class */ - public DeleteModelGroupStep() {} - - /** The name of this step, used as a key in the template and the {@link WorkflowStepFactory} */ - public static final String NAME = "delete_model_group"; - - @Override - public CompletableFuture execute( - String currentNodeId, - WorkflowData currentNodeInputs, - Map outputs, - Map previousNodeInputs - ) { - return CompletableFuture.completedFuture(WorkflowData.EMPTY); - } - - @Override - public String getName() { - return NAME; - } - -} diff --git a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java index afd5faac7..a220b53c7 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java +++ b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java @@ -69,7 +69,7 @@ public WorkflowStepFactory( stepMap.put(CreateConnectorStep.NAME, () -> new CreateConnectorStep(mlClient, flowFrameworkIndicesHandler)); stepMap.put(DeleteConnectorStep.NAME, () -> new DeleteConnectorStep(mlClient)); stepMap.put(RegisterModelGroupStep.NAME, () -> new RegisterModelGroupStep(mlClient, flowFrameworkIndicesHandler)); - stepMap.put(DeleteModelGroupStep.NAME, DeleteModelGroupStep::new); + stepMap.put(NoOpStep.NAME, NoOpStep::new); stepMap.put(ToolStep.NAME, ToolStep::new); stepMap.put(RegisterAgentStep.NAME, () -> new RegisterAgentStep(mlClient, flowFrameworkIndicesHandler)); stepMap.put(DeleteAgentStep.NAME, () -> new DeleteAgentStep(mlClient)); diff --git a/src/main/resources/mappings/workflow-steps.json b/src/main/resources/mappings/workflow-steps.json index 198edb7cd..c46dd3982 100644 --- a/src/main/resources/mappings/workflow-steps.json +++ b/src/main/resources/mappings/workflow-steps.json @@ -145,11 +145,6 @@ "opensearch-ml" ] }, - "delete_model_group": { - "inputs":[], - "outputs":[], - "required_plugins":[] - }, "register_agent": { "inputs":[ "name", diff --git a/src/test/java/org/opensearch/flowframework/workflow/DeleteModelGroupTests.java b/src/test/java/org/opensearch/flowframework/workflow/DeleteModelGroupTests.java deleted file mode 100644 index e55eaea70..000000000 --- a/src/test/java/org/opensearch/flowframework/workflow/DeleteModelGroupTests.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ -package org.opensearch.flowframework.workflow; - -import org.opensearch.test.OpenSearchTestCase; - -import java.io.IOException; -import java.util.Collections; -import java.util.concurrent.CompletableFuture; - -public class DeleteModelGroupTests extends OpenSearchTestCase { - - public void testDeleteModelGroup() throws IOException { - DeleteModelGroupStep deleteModelGroupStep = new DeleteModelGroupStep(); - assertEquals(DeleteModelGroupStep.NAME, deleteModelGroupStep.getName()); - CompletableFuture future = deleteModelGroupStep.execute( - "nodeId", - WorkflowData.EMPTY, - Collections.emptyMap(), - Collections.emptyMap() - ); - assertTrue(future.isDone()); - assertFalse(future.isCompletedExceptionally()); - } -}