-
Notifications
You must be signed in to change notification settings - Fork 4
SDK-60: update endpoints in WorkflowResource.java #45
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
Open
IvanKulik-sm
wants to merge
8
commits into
main
Choose a base branch
from
SDK-60-update-workflow-resource
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3f73f28
SDK-60: update endpoints in WorkflowResource.java
IvanKulik-sm 950e7a3
SDK-60: add tests; remove startWorkflow duplicate; remove jumpToTask …
IvanKulik-sm 9499f4b
SDK-60: fix tests in CI; remove executeWorkflowAsAPI duplicate;
IvanKulik-sm 29565b6
SDK-60: spotlessApply
IvanKulik-sm b2904f4
SDK-60: add timeouts, because clearly when startWorkflow returned 200…
IvanKulik-sm 8c455fb
SDK-60: draft: add more tests based on orkes source code
IvanKulik-sm 1ffc9f4
SDK-60: fix the tests; remove getExecutionStatus duplicate
IvanKulik-sm 74a4b77
Merge remote-tracking branch 'origin/main' into SDK-60-update-workflo…
IvanKulik-sm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -14,14 +14,21 @@ | |
|
|
||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Objects; | ||
|
|
||
| import com.netflix.conductor.client.http.ConductorClient; | ||
| import com.netflix.conductor.client.http.ConductorClientRequest; | ||
| import com.netflix.conductor.client.http.ConductorClientRequest.Method; | ||
| import com.netflix.conductor.client.http.ConductorClientResponse; | ||
| import com.netflix.conductor.common.metadata.tasks.Task; | ||
| import com.netflix.conductor.common.metadata.workflow.RerunWorkflowRequest; | ||
| import com.netflix.conductor.common.metadata.workflow.SkipTaskRequest; | ||
| import com.netflix.conductor.common.metadata.workflow.StartWorkflowRequest; | ||
| import com.netflix.conductor.common.metadata.workflow.UpgradeWorkflowRequest; | ||
| import com.netflix.conductor.common.run.SearchResult; | ||
| import com.netflix.conductor.common.run.Workflow; | ||
| import com.netflix.conductor.common.run.WorkflowSummary; | ||
| import com.netflix.conductor.common.run.WorkflowTestRequest; | ||
|
|
||
| import io.orkes.conductor.client.enums.Consistency; | ||
| import io.orkes.conductor.client.enums.ReturnStrategy; | ||
|
|
@@ -135,6 +142,25 @@ WorkflowStatus getWorkflowStatusSummary(String workflowId, Boolean includeOutput | |
| return resp.getData(); | ||
| } | ||
|
|
||
| SearchResult<Task> getExecutionStatusTaskList(String workflowId, | ||
| Integer start, | ||
| Integer count, | ||
| List<Task.Status> status) { | ||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.GET) | ||
| .path("/workflow/{workflowId}/tasks") | ||
| .addPathParam("workflowId", workflowId) | ||
| .addQueryParam("start", start) | ||
| .addQueryParam("count", count) | ||
| .addQueryParams("status", status.stream().map(Objects::toString).toList()) | ||
| .build(); | ||
|
|
||
| ConductorClientResponse<SearchResult<Task>> resp = client.execute(request, new TypeReference<>() { | ||
| }); | ||
|
|
||
| return resp.getData(); | ||
| } | ||
|
|
||
| Map<String, List<Workflow>> getWorkflowsByNamesAndCorrelationIds(CorrelationIdsSearchRequest searchRequest, | ||
| Boolean includeClosed, | ||
| Boolean includeTasks) { | ||
|
|
@@ -152,6 +178,44 @@ Map<String, List<Workflow>> getWorkflowsByNamesAndCorrelationIds(CorrelationIdsS | |
| return resp.getData(); | ||
| } | ||
|
|
||
| Map<String, List<Workflow>> getWorkflows(String name, | ||
| List<String> correlationIds, | ||
| Boolean includeClosed, | ||
| Boolean includeTasks) { | ||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.POST) | ||
| .path("/workflow/{name}/correlated") | ||
| .addPathParam("name", name) | ||
| .addQueryParam("includeClosed", includeClosed) | ||
| .addQueryParam("includeTasks", includeTasks) | ||
| .body(correlationIds) | ||
| .build(); | ||
|
|
||
| ConductorClientResponse<Map<String, List<Workflow>>> resp = client.execute(request, new TypeReference<>() { | ||
| }); | ||
|
|
||
| return resp.getData(); | ||
| } | ||
|
|
||
| List<Workflow> getWorkflows(String name, | ||
| String correlationId, | ||
| Boolean includeClosed, | ||
| Boolean includeTasks) { | ||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.GET) | ||
| .path("/workflow/{name}/correlated/{correlationId}") | ||
| .addPathParam("name", name) | ||
| .addPathParam("correlationId", correlationId) | ||
| .addQueryParam("includeClosed", includeClosed) | ||
| .addQueryParam("includeTasks", includeTasks) | ||
| .build(); | ||
|
|
||
| ConductorClientResponse<List<Workflow>> resp = client.execute(request, new TypeReference<>() { | ||
| }); | ||
|
|
||
| return resp.getData(); | ||
| } | ||
|
|
||
| void uploadCompletedWorkflows() { | ||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.POST) | ||
|
|
@@ -252,4 +316,174 @@ SignalResponse executeWorkflowWithReturnStrategy(StartWorkflowRequest req, | |
|
|
||
| return resp.getData(); | ||
| } | ||
|
|
||
| void decide(String workflowId) { | ||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.PUT) | ||
| .path("/workflow/decide/{workflowId}") | ||
| .addPathParam("workflowId", workflowId) | ||
| .build(); | ||
|
|
||
| client.execute(request); | ||
| } | ||
|
|
||
| String startWorkflow(StartWorkflowRequest req) { | ||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.POST) | ||
| .path("/workflow") | ||
| .body(req) | ||
| .build(); | ||
|
|
||
| ConductorClientResponse<String> resp = client.execute(request, new TypeReference<>() { | ||
| }); | ||
|
|
||
| return resp.getData(); | ||
| } | ||
|
|
||
| List<String> getRunningWorkflow(String name, Integer version, Long startTime, Long endTime) { | ||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.GET) | ||
| .path("/workflow/running/{name}") | ||
| .addPathParam("name", name) | ||
| .addQueryParam("version", version) | ||
| .addQueryParam("startTime", startTime) | ||
| .addQueryParam("endTime", endTime) | ||
| .build(); | ||
|
|
||
| ConductorClientResponse<List<String>> resp = client.execute(request, new TypeReference<>() { | ||
| }); | ||
|
|
||
| return resp.getData(); | ||
| } | ||
|
|
||
| SearchResult<WorkflowSummary> search(Integer start, | ||
| Integer size, | ||
| String sort, | ||
| String freeText, | ||
| String query, | ||
| Boolean skipCache) { | ||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.GET) | ||
| .path("/workflow/search") | ||
| .addQueryParam("start", start) | ||
| .addQueryParam("size", size) | ||
| .addQueryParam("sort", sort) | ||
| .addQueryParam("freeText", freeText) | ||
| .addQueryParam("query", query) | ||
| .addQueryParam("skipCache", skipCache) | ||
| .build(); | ||
|
|
||
| ConductorClientResponse<SearchResult<WorkflowSummary>> resp = client.execute(request, new TypeReference<>() { | ||
| }); | ||
|
|
||
| return resp.getData(); | ||
| } | ||
|
|
||
| Workflow testWorkflow(WorkflowTestRequest req) { | ||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.POST) | ||
| .path("/workflow/test") | ||
| .body(req) | ||
| .build(); | ||
|
|
||
| ConductorClientResponse<Workflow> resp = client.execute(request, new TypeReference<>() { | ||
| }); | ||
|
|
||
| return resp.getData(); | ||
| } | ||
|
|
||
| void deleteWorkflow(String workflowId, Boolean archiveWorkflow) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. already existed in OrkesWorkflowClient |
||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.DELETE) | ||
| .path("/workflow/{workflowId}/remove") | ||
| .addPathParam("workflowId", workflowId) | ||
| .addQueryParam("archiveWorkflow", archiveWorkflow) | ||
| .build(); | ||
|
|
||
| client.execute(request); | ||
| } | ||
|
|
||
| String rerun(String workflowId, RerunWorkflowRequest rerunRequest) { | ||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.POST) | ||
| .path("/workflow/{workflowId}/rerun") | ||
| .addPathParam("workflowId", workflowId) | ||
| .body(rerunRequest) | ||
| .build(); | ||
|
|
||
| ConductorClientResponse<String> resp = client.execute(request, new TypeReference<>() { | ||
| }); | ||
|
|
||
| return resp.getData(); | ||
| } | ||
|
|
||
| /** | ||
| * Resets callback times of all non-terminal SIMPLE tasks to 0 | ||
| * @param workflowId the workflow id to reset callbacks for | ||
| */ | ||
| void resetWorkflow(String workflowId) { | ||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.POST) | ||
| .path("/workflow/{workflowId}/resetcallbacks") | ||
| .addPathParam("workflowId", workflowId) | ||
| .build(); | ||
|
|
||
| client.execute(request); | ||
| } | ||
|
|
||
| void retryWorkflow(String workflowId, Boolean resumeSubworkflowTasks, Boolean retryIfRetriedByParent) { | ||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.POST) | ||
| .path("/workflow/{workflowId}/retry") | ||
| .addPathParam("workflowId", workflowId) | ||
| .addQueryParam("resumeSubworkflowTasks", resumeSubworkflowTasks) | ||
| .addQueryParam("retryIfRetriedByParent", retryIfRetriedByParent) | ||
| .build(); | ||
|
|
||
| client.execute(request); | ||
| } | ||
|
|
||
| void restartWorkflow(String workflowId, Boolean useLatestDefinitions) { | ||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.POST) | ||
| .path("/workflow/{workflowId}/restart") | ||
| .addPathParam("workflowId", workflowId) | ||
| .addQueryParam("useLatestDefinitions", useLatestDefinitions) | ||
| .build(); | ||
|
|
||
| client.execute(request); | ||
| } | ||
|
|
||
| void resumeWorkflow(String workflowId) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. already exists in OrkesWorkflowClient |
||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.PUT) | ||
| .path("/workflow/{workflowId}/resume") | ||
| .addPathParam("workflowId", workflowId) | ||
| .build(); | ||
|
|
||
| client.execute(request); | ||
| } | ||
|
|
||
| void pauseWorkflow(String workflowId) { | ||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.PUT) | ||
| .path("/workflow/{workflowId}/pause") | ||
| .addPathParam("workflowId", workflowId) | ||
| .build(); | ||
|
|
||
| client.execute(request); | ||
| } | ||
|
|
||
| void skipTaskFromWorkflow(String workflowId, String taskReferenceName, SkipTaskRequest requestBody) { | ||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.PUT) | ||
| .path("/workflow/{workflowId}/skiptask/{taskReferenceName}") | ||
| .addPathParam("workflowId", workflowId) | ||
| .addPathParam("taskReferenceName", taskReferenceName) | ||
| .body(requestBody) | ||
| .build(); | ||
|
|
||
| client.execute(request); | ||
| } | ||
|
|
||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in OrkesWorkflowClient it was already there. Using Conductor WorkflowClient.