-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a new workflow step to delete model group
Signed-off-by: Owais Kazi <[email protected]>
- Loading branch information
1 parent
2799107
commit f0e7630
Showing
6 changed files
with
81 additions
and
3 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
40 changes: 40 additions & 0 deletions
40
src/main/java/org/opensearch/flowframework/workflow/DeleteModelGroupStep.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,40 @@ | ||
/* | ||
* 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<WorkflowData> execute( | ||
String currentNodeId, | ||
WorkflowData currentNodeInputs, | ||
Map<String, WorkflowData> outputs, | ||
Map<String, String> previousNodeInputs | ||
) { | ||
return CompletableFuture.completedFuture(WorkflowData.EMPTY); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return NAME; | ||
} | ||
|
||
} |
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
31 changes: 31 additions & 0 deletions
31
src/test/java/org/opensearch/flowframework/workflow/DeleteModelGroupTests.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,31 @@ | ||
/* | ||
* 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<WorkflowData> future = deleteModelGroupStep.execute( | ||
"nodeId", | ||
WorkflowData.EMPTY, | ||
Collections.emptyMap(), | ||
Collections.emptyMap() | ||
); | ||
assertTrue(future.isDone()); | ||
assertFalse(future.isCompletedExceptionally()); | ||
} | ||
} |