Search in sources :

Example 1 with MLExecuteTaskResponse

use of org.opensearch.ml.common.transport.execute.MLExecuteTaskResponse in project ml-commons by opensearch-project.

the class MLExecuteTaskRunner method executeTask.

/**
 * Execute algorithm and return result.
 * TODO: 1. support backend task run; 2. support dispatch task to remote node
 * @param request MLExecuteTaskRequest
 * @param transportService transport service
 * @param listener Action listener
 */
@Override
public void executeTask(MLExecuteTaskRequest request, TransportService transportService, ActionListener<MLExecuteTaskResponse> listener) {
    threadPool.executor(TASK_THREAD_POOL).execute(() -> {
        Input input = request.getInput();
        Output output = MLEngine.execute(input);
        MLExecuteTaskResponse response = MLExecuteTaskResponse.builder().output(output).build();
        listener.onResponse(response);
    });
}
Also used : MLExecuteTaskResponse(org.opensearch.ml.common.transport.execute.MLExecuteTaskResponse) Input(org.opensearch.ml.common.parameter.Input) Output(org.opensearch.ml.common.parameter.Output)

Aggregations

Input (org.opensearch.ml.common.parameter.Input)1 Output (org.opensearch.ml.common.parameter.Output)1 MLExecuteTaskResponse (org.opensearch.ml.common.transport.execute.MLExecuteTaskResponse)1