-
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.
Initial implementation of MLClient and workflow interface (#25)
* Initial implementation of MLClient and interface Signed-off-by: Owais Kazi <[email protected]> * Addressed PR Comments Signed-off-by: Owais Kazi <[email protected]> --------- Signed-off-by: Owais Kazi <[email protected]>
- Loading branch information
1 parent
a1bf2c0
commit b1bc703
Showing
4 changed files
with
84 additions
and
0 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
34 changes: 34 additions & 0 deletions
34
src/main/java/org/opensearch/flowframework/client/MLClient.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,34 @@ | ||
/* | ||
* 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.client; | ||
|
||
import org.opensearch.client.node.NodeClient; | ||
import org.opensearch.ml.client.MachineLearningNodeClient; | ||
|
||
/** | ||
Class to initiate an instance of MLClient | ||
*/ | ||
public class MLClient { | ||
private static MachineLearningNodeClient INSTANCE; | ||
|
||
private MLClient() {} | ||
|
||
/** | ||
* Creates machine learning client. | ||
* | ||
* @param nodeClient node client of OpenSearch. | ||
* @return machine learning client from ml-commons. | ||
*/ | ||
public static MachineLearningNodeClient createMLClient(NodeClient nodeClient) { | ||
if (INSTANCE == null) { | ||
INSTANCE = new MachineLearningNodeClient(nodeClient); | ||
} | ||
return INSTANCE; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/org/opensearch/flowframework/workflow/Workflow.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,26 @@ | ||
/* | ||
* 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.concurrent.CompletableFuture; | ||
|
||
/** | ||
* Interface for the workflow setup of different building blocks. | ||
*/ | ||
public interface Workflow { | ||
|
||
/** | ||
* Triggers the processing of the building block. | ||
* | ||
* @return CompletableFuture of the building block. | ||
* @throws Exception if execution fails | ||
*/ | ||
CompletableFuture<Workflow> execute() throws Exception; | ||
|
||
} |
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,7 @@ | ||
grant { | ||
//ml-commons client | ||
permission java.lang.RuntimePermission "getClassLoader"; | ||
permission java.lang.RuntimePermission "accessDeclaredMembers"; | ||
permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; | ||
permission java.lang.RuntimePermission "setContextClassLoader"; | ||
}; |