Skip to content

Commit

Permalink
Added javadocs
Browse files Browse the repository at this point in the history
Signed-off-by: Owais Kazi <[email protected]>
  • Loading branch information
owaiskazi19 committed Oct 4, 2023
1 parent 353a322 commit fe03b92
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,20 @@
import java.util.Map;
import java.util.concurrent.CompletableFuture;

/**
* Step to deploy a model
*/
public class DeployModelStep implements WorkflowStep {
private static final Logger logger = LogManager.getLogger(DeployModelStep.class);

private NodeClient nodeClient;
private static final String MODEL_ID = "model_id";
static final String NAME = "deploy_model";

/**
* Instantiate this class
* @param nodeClient client to instantiate MLClient
*/
public DeployModelStep(NodeClient nodeClient) {
this.nodeClient = nodeClient;
}
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/org/opensearch/flowframework/workflow/GetTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,29 @@
import org.opensearch.ml.common.MLTaskState;
import org.opensearch.ml.common.transport.task.MLTaskGetResponse;

/**
* Step to get modelID of a registered local model
*/
@SuppressForbidden(reason = "This class is for the future work of registering local model")
public class GetTask {

private static final Logger logger = LogManager.getLogger(GetTask.class);

Check warning on line 26 in src/main/java/org/opensearch/flowframework/workflow/GetTask.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/flowframework/workflow/GetTask.java#L26

Added line #L26 was not covered by tests
private MachineLearningNodeClient machineLearningNodeClient;
private String taskId;

/**
* Instantiate this class
* @param machineLearningNodeClient client to instantiate ml-commons APIs
* @param taskId taskID of the model
*/
public GetTask(MachineLearningNodeClient machineLearningNodeClient, String taskId) {
this.machineLearningNodeClient = machineLearningNodeClient;
this.taskId = taskId;
}

Check warning on line 38 in src/main/java/org/opensearch/flowframework/workflow/GetTask.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/flowframework/workflow/GetTask.java#L35-L38

Added lines #L35 - L38 were not covered by tests

/**
* Invokes get task API of ml-commons
*/
public void getTask() {

ActionListener<MLTask> actionListener = new ActionListener<>() {

Check warning on line 45 in src/main/java/org/opensearch/flowframework/workflow/GetTask.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/flowframework/workflow/GetTask.java#L45

Added line #L45 was not covered by tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
import java.util.concurrent.CompletableFuture;
import java.util.stream.Stream;

/**
* Step to register a remote model
*/
public class RegisterModelStep implements WorkflowStep {

private static final Logger logger = LogManager.getLogger(RegisterModelStep.class);
Expand All @@ -45,6 +48,10 @@ public class RegisterModelStep implements WorkflowStep {
private static final String MODEL_FORMAT = "model_format";
private static final String MODEL_CONFIG = "model_config";

/**
* Instantiate this class
* @param nodeClient client to instantiate MLClient
*/
public RegisterModelStep(NodeClient nodeClient) {
this.nodeClient = nodeClient;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class WorkflowStepFactory {
* Instantiate this class.
*
* @param client The OpenSearch client steps can use
* @param nodeClient NodeClient to execute transport calls
*/
public WorkflowStepFactory(Client client, NodeClient nodeClient) {
populateMap(client, nodeClient);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import static org.mockito.Mockito.*;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;

@ThreadLeakScope(ThreadLeakScope.Scope.NONE)
public class DeployModelStepTests extends OpenSearchTestCase {
Expand Down

0 comments on commit fe03b92

Please sign in to comment.