Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task search api #156

Merged
merged 13 commits into from
Mar 12, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import com.netflix.conductor.common.metadata.tasks.TaskExecLog;
import com.netflix.conductor.common.metadata.tasks.TaskResult;
import com.netflix.conductor.common.run.SearchResult;
import com.netflix.conductor.common.run.TaskSummary;
import com.netflix.conductor.common.utils.ExternalPayloadStorage;
import io.orkes.conductor.client.model.TaskSummary;

/** Client for conductor task management including polling for task, updating task status etc. */
public abstract class TaskClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.netflix.conductor.common.metadata.tasks.TaskExecLog;
import com.netflix.conductor.common.metadata.tasks.TaskResult;
import com.netflix.conductor.common.run.SearchResult;
import com.netflix.conductor.common.run.TaskSummary;
import com.netflix.conductor.common.run.Workflow;

import io.orkes.conductor.client.ApiClient;
Expand All @@ -32,6 +31,7 @@
import io.orkes.conductor.client.http.api.TaskResourceApi;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.orkes.conductor.client.model.TaskSummary;

public class OrkesTaskClient extends TaskClient implements AutoCloseable {

Expand Down Expand Up @@ -224,7 +224,7 @@ public SearchResult<Task> searchV2(String query) {

@Override
public SearchResult<TaskSummary> search(Integer start, Integer size, String sort, String freeText, String query) {
throw new UnsupportedOperationException("search operation on tasks is not supported");
return taskResourceApi.searchTasks(start, size, sort, freeText, query);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@
import com.netflix.conductor.common.metadata.tasks.Task;
import com.netflix.conductor.common.metadata.tasks.TaskExecLog;
import com.netflix.conductor.common.metadata.tasks.TaskResult;
import com.netflix.conductor.common.run.SearchResult;
import com.netflix.conductor.common.run.Workflow;

import io.orkes.conductor.client.ApiClient;
import io.orkes.conductor.client.http.*;
import io.orkes.conductor.client.model.ExternalStorageLocation;
import io.orkes.conductor.client.model.SearchResultTask;
import io.orkes.conductor.client.model.SearchResultTaskSummary;
import io.orkes.conductor.client.model.*;

import com.amazonaws.util.EC2MetadataUtils;
import com.fasterxml.jackson.core.type.TypeReference;
Expand Down Expand Up @@ -1412,7 +1411,7 @@ private ApiResponse<String> requeuePendingTaskWithHttpInfo(String taskType)
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call search1Call(
public com.squareup.okhttp.Call searchTasksCall(
Integer start,
Integer size,
String sort,
Expand Down Expand Up @@ -1484,7 +1483,7 @@ public com.squareup.okhttp.Response intercept(
progressRequestListener);
}

private com.squareup.okhttp.Call search1ValidateBeforeCall(
private com.squareup.okhttp.Call searchTasksValidateBeforeCall(
Integer start,
Integer size,
String sort,
Expand All @@ -1495,7 +1494,7 @@ private com.squareup.okhttp.Call search1ValidateBeforeCall(
throws ApiException {

com.squareup.okhttp.Call call =
search1Call(
searchTasksCall(
start,
size,
sort,
Expand All @@ -1520,11 +1519,11 @@ private com.squareup.okhttp.Call search1ValidateBeforeCall(
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the
* response body
*/
public SearchResultTaskSummary search1(
public SearchResult<TaskSummary> searchTasks(
Integer start, Integer size, String sort, String freeText, String query)
throws ApiException {
ApiResponse<SearchResultTaskSummary> resp =
search1WithHttpInfo(start, size, sort, freeText, query);
ApiResponse<SearchResult<TaskSummary>> resp =
searchTasksWithHttpInfo(start, size, sort, freeText, query);
return resp.getData();
}

Expand All @@ -1542,12 +1541,12 @@ public SearchResultTaskSummary search1(
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the
* response body
*/
private ApiResponse<SearchResultTaskSummary> search1WithHttpInfo(
private ApiResponse<SearchResult<TaskSummary>> searchTasksWithHttpInfo(
Integer start, Integer size, String sort, String freeText, String query)
throws ApiException {
com.squareup.okhttp.Call call =
search1ValidateBeforeCall(start, size, sort, freeText, query, null, null);
Type localVarReturnType = new TypeReference<SearchResultTaskSummary>() {}.getType();
searchTasksValidateBeforeCall(start, size, sort, freeText, query, null, null);
Type localVarReturnType = new TypeReference<SearchResult<TaskSummary>>() {}.getType();
return apiClient.execute(call, localVarReturnType);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,117 +1,102 @@
/*
* Copyright 2022 Orkes, Inc.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package io.orkes.conductor.client.model;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import com.netflix.conductor.common.run.TaskSummary;

import com.google.gson.annotations.SerializedName;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.ArrayList;
import java.util.List;
/**
* SearchResultTaskSummary
*/

/** SearchResultTaskSummary */
public class SearchResultTaskSummary {
@SerializedName("results")
private List<TaskSummary> results = null;

@SerializedName("totalHits")
private Long totalHits = null;

public SearchResultTaskSummary results(List<TaskSummary> results) {
this.results = results;
return this;
}

public SearchResultTaskSummary addResultsItem(TaskSummary resultsItem) {
if (this.results == null) {
this.results = new ArrayList<TaskSummary>();
}
this.results.add(resultsItem);
return this;
}

/**
* Get results
*
* @return results
*/
@Schema(description = "")
public List<TaskSummary> getResults() {
return results;
}
private List<TaskSummary> results = null;

public void setResults(List<TaskSummary> results) {
this.results = results;
}

public SearchResultTaskSummary totalHits(Long totalHits) {
this.totalHits = totalHits;
return this;
}
private Long totalHits = null;

/**
* Get totalHits
*
* @return totalHits
*/
@Schema(description = "")
public Long getTotalHits() {
return totalHits;
}
public SearchResultTaskSummary results(List<TaskSummary> results) {
this.results = results;
return this;
}

public void setTotalHits(Long totalHits) {
this.totalHits = totalHits;
public SearchResultTaskSummary addResultsItem(TaskSummary resultsItem) {
if (this.results == null) {
this.results = new ArrayList<TaskSummary>();
}

@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SearchResultTaskSummary searchResultTaskSummary = (SearchResultTaskSummary) o;
return Objects.equals(this.results, searchResultTaskSummary.results)
&& Objects.equals(this.totalHits, searchResultTaskSummary.totalHits);
this.results.add(resultsItem);
return this;
}

/**
* Get results
* @return results
**/
@Schema(description = "")
public List<TaskSummary> getResults() {
return results;
}

public void setResults(List<TaskSummary> results) {
this.results = results;
}

public SearchResultTaskSummary totalHits(Long totalHits) {
this.totalHits = totalHits;
return this;
}

/**
* Get totalHits
* @return totalHits
**/
@Schema(description = "")
public Long getTotalHits() {
return totalHits;
}

public void setTotalHits(Long totalHits) {
this.totalHits = totalHits;
}


@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}

@Override
public int hashCode() {
return Objects.hash(results, totalHits);
if (o == null || getClass() != o.getClass()) {
return false;
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SearchResultTaskSummary {\n");

sb.append(" results: ").append(toIndentedString(results)).append("\n");
sb.append(" totalHits: ").append(toIndentedString(totalHits)).append("\n");
sb.append("}");
return sb.toString();
SearchResultTaskSummary searchResultTaskSummary = (SearchResultTaskSummary) o;
return Objects.equals(this.results, searchResultTaskSummary.results) &&
Objects.equals(this.totalHits, searchResultTaskSummary.totalHits);
}

@Override
public int hashCode() {
return Objects.hash(results, totalHits);
}


@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SearchResultTaskSummary {\n");

sb.append(" results: ").append(toIndentedString(results)).append("\n");
sb.append(" totalHits: ").append(toIndentedString(totalHits)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}

/**
* Convert the given object to string with each line indented by 4 spaces (except the first
* line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
Loading
Loading