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

feat: add retry API for archived workflows. Fixes #7906 #7988

Merged
merged 30 commits into from
Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
40475a1
feat: add retry API for archived workflows
dpadhiar Feb 23, 2022
4d74854
chore: fixed lint errors and removed comments
dpadhiar Feb 24, 2022
95a88c0
fix: retryArchive flag check was set incorrectly
dpadhiar Feb 24, 2022
bbb1465
test: added test cases for retry wfarchive and wfarchiveserver
dpadhiar Feb 26, 2022
949ab6c
fix: changed method signature and removed comments
dpadhiar Feb 26, 2022
e419499
Merge branch 'master' into issue-5405
dpadhiar Feb 26, 2022
b46324c
fix: removed validateWorkflow() from WorkflowArchive
dpadhiar Feb 28, 2022
fe493ac
feat: refactored retryWorkflow into prepareWorkflowForRetry
dpadhiar Mar 1, 2022
15a2f77
refactor: remove RetryArchiveWorkflow and move wfClient update/create…
dpadhiar Mar 2, 2022
be9b1d9
chore: remove comments
dpadhiar Mar 2, 2022
cee8d76
fix: ignored AlreadyExists err for idempotence
dpadhiar Mar 2, 2022
aede75e
fix: dehydrate workflow in RetryWorkflow
dpadhiar Mar 2, 2022
a8d10b7
test: add e2e test for RetryArchiveWorkflow
dpadhiar Mar 3, 2022
7f41a18
test: fix syntax error for RetryArchiveWorkflow test
dpadhiar Mar 3, 2022
1eff8ed
test: update test for RetryArchivedWorkflow
dpadhiar Mar 3, 2022
3eb2c94
fix: change request for RetryArchivedWorkflow
dpadhiar Mar 3, 2022
0efff12
test: edited RetryArchivedWorkflow test
dpadhiar Mar 3, 2022
349aa9a
test: moved retry test before delete
dpadhiar Mar 4, 2022
bc29411
test: added failed workflow for testing RetryWorkflowArchive
dpadhiar Mar 5, 2022
0611e74
test: delete workflow before retrying from archive
dpadhiar Mar 7, 2022
4cf79b0
fix: resourceVersion must be set to nil to retry archivedWf
dpadhiar Mar 8, 2022
19b48ef
refactor: set resourceVersion to nil in util/RetryArchivedWorkflow
dpadhiar Mar 8, 2022
3fc7eaf
chore: merge master to resolve conflicts with resubmit commit
dpadhiar Mar 9, 2022
4a4493e
test: added RetryArchivedWorkflow test
dpadhiar Mar 10, 2022
51c4b5d
chore: remove wfClient from RetryWorkflow/RetryArchivedWorkflow methods
dpadhiar Mar 10, 2022
7fba704
chore: rerun codegen -B
dpadhiar Mar 10, 2022
8add77e
refactor: move pod deletion to server side and rename prepareWorkflow…
dpadhiar Mar 16, 2022
d619ebb
test: clean up
dpadhiar Mar 16, 2022
9cd4ab7
refactor: added structured logging and changed error check
dpadhiar Mar 17, 2022
68caea6
refactor: remove RetryWorkflow
dpadhiar Mar 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions api/jsonschema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6604,6 +6604,26 @@
},
"type": "object"
},
"io.argoproj.workflow.v1alpha1.RetryArchivedWorkflowRequest": {
"properties": {
"name": {
"type": "string"
},
"namespace": {
"type": "string"
},
"nodeFieldSelector": {
"type": "string"
},
"restartSuccessful": {
"type": "boolean"
},
"uid": {
"type": "string"
}
},
"type": "object"
},
"io.argoproj.workflow.v1alpha1.RetryNodeAntiAffinity": {
"description": "RetryNodeAntiAffinity is a placeholder for future expansion, only empty nodeAntiAffinity is allowed. In order to prevent running steps on the same host, it uses \"kubernetes.io/hostname\".",
"type": "object"
Expand Down
58 changes: 58 additions & 0 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,44 @@
}
}
},
"/api/v1/archived-workflows/{uid}/retry": {
"put": {
"tags": [
"ArchivedWorkflowService"
],
"operationId": "ArchivedWorkflowService_RetryArchivedWorkflow",
"parameters": [
{
"type": "string",
"name": "uid",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.RetryArchivedWorkflowRequest"
}
}
],
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.Workflow"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/grpc.gateway.runtime.Error"
}
}
}
}
},
"/api/v1/cluster-workflow-templates": {
"get": {
"tags": [
Expand Down Expand Up @@ -10904,6 +10942,26 @@
}
}
},
"io.argoproj.workflow.v1alpha1.RetryArchivedWorkflowRequest": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"namespace": {
"type": "string"
},
"nodeFieldSelector": {
"type": "string"
},
"restartSuccessful": {
"type": "boolean"
},
"uid": {
"type": "string"
}
}
},
"io.argoproj.workflow.v1alpha1.RetryNodeAntiAffinity": {
"description": "RetryNodeAntiAffinity is a placeholder for future expansion, only empty nodeAntiAffinity is allowed. In order to prevent running steps on the same host, it uses \"kubernetes.io/hostname\".",
"type": "object"
Expand Down
5 changes: 5 additions & 0 deletions pkg/apiclient/http1/archived-workflows-service-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ func (h ArchivedWorkflowsServiceClient) ListArchivedWorkflowLabelValues(_ contex
return out, h.Get(in, out, "/api/v1/archived-workflows-label-values")
}

func (h ArchivedWorkflowsServiceClient) RetryArchivedWorkflow(_ context.Context, in *workflowarchivepkg.RetryArchivedWorkflowRequest, _ ...grpc.CallOption) (*wfv1.Workflow, error) {
out := &wfv1.Workflow{}
return out, h.Put(in, out, "/api/v1/archived-workflows/{uid}/retry")
}

func (h ArchivedWorkflowsServiceClient) ResubmitArchivedWorkflow(_ context.Context, in *workflowarchivepkg.ResubmitArchivedWorkflowRequest, _ ...grpc.CallOption) (*wfv1.Workflow, error) {
out := &wfv1.Workflow{}
return out, h.Put(in, out, "/api/v1/archived-workflows/{uid}/resubmit")
Expand Down
504 changes: 460 additions & 44 deletions pkg/apiclient/workflowarchive/workflow-archive.pb.go

Large diffs are not rendered by default.

117 changes: 117 additions & 0 deletions pkg/apiclient/workflowarchive/workflow-archive.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions pkg/apiclient/workflowarchive/workflow-archive.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ message ListArchivedWorkflowLabelKeysRequest {
message ListArchivedWorkflowLabelValuesRequest {
k8s.io.apimachinery.pkg.apis.meta.v1.ListOptions listOptions = 1;
}
message RetryArchivedWorkflowRequest {
alexec marked this conversation as resolved.
Show resolved Hide resolved
string uid = 1;
string name = 2;
string namespace = 3;
bool restartSuccessful = 4;
string nodeFieldSelector = 5;
}

message ResubmitArchivedWorkflowRequest {
string uid = 1;
string name = 2;
Expand All @@ -47,6 +55,12 @@ service ArchivedWorkflowService {
rpc ListArchivedWorkflowLabelValues (ListArchivedWorkflowLabelValuesRequest) returns (github.com.argoproj.argo_workflows.v3.pkg.apis.workflow.v1alpha1.LabelValues) {
option (google.api.http).get = "/api/v1/archived-workflows-label-values";
}
rpc RetryArchivedWorkflow (RetryArchivedWorkflowRequest) returns (github.com.argoproj.argo_workflows.v3.pkg.apis.workflow.v1alpha1.Workflow) {
option (google.api.http) = {
put: "/api/v1/archived-workflows/{uid}/retry"
body: "*"
};
}
rpc ResubmitArchivedWorkflow (ResubmitArchivedWorkflowRequest) returns (github.com.argoproj.argo_workflows.v3.pkg.apis.workflow.v1alpha1.Workflow) {
option (google.api.http) = {
put: "/api/v1/archived-workflows/{uid}/resubmit"
Expand Down
64 changes: 64 additions & 0 deletions sdks/java/client/docs/ArchivedWorkflowServiceApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Method | HTTP request | Description
[**archivedWorkflowServiceListArchivedWorkflowLabelValues**](ArchivedWorkflowServiceApi.md#archivedWorkflowServiceListArchivedWorkflowLabelValues) | **GET** /api/v1/archived-workflows-label-values |
[**archivedWorkflowServiceListArchivedWorkflows**](ArchivedWorkflowServiceApi.md#archivedWorkflowServiceListArchivedWorkflows) | **GET** /api/v1/archived-workflows |
[**archivedWorkflowServiceResubmitArchivedWorkflow**](ArchivedWorkflowServiceApi.md#archivedWorkflowServiceResubmitArchivedWorkflow) | **PUT** /api/v1/archived-workflows/{uid}/resubmit |
[**archivedWorkflowServiceRetryArchivedWorkflow**](ArchivedWorkflowServiceApi.md#archivedWorkflowServiceRetryArchivedWorkflow) | **PUT** /api/v1/archived-workflows/{uid}/retry |


<a name="archivedWorkflowServiceDeleteArchivedWorkflow"></a>
Expand Down Expand Up @@ -410,3 +411,66 @@ No authorization required
**200** | A successful response. | - |
**0** | An unexpected error response. | - |

<a name="archivedWorkflowServiceRetryArchivedWorkflow"></a>
# **archivedWorkflowServiceRetryArchivedWorkflow**
> IoArgoprojWorkflowV1alpha1Workflow archivedWorkflowServiceRetryArchivedWorkflow(uid, body)


### Example
```java
// Import classes:
import io.argoproj.workflow.ApiClient;
import io.argoproj.workflow.ApiException;
import io.argoproj.workflow.Configuration;
import io.argoproj.workflow.models.*;
import io.argoproj.workflow.apis.ArchivedWorkflowServiceApi;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:2746");

ArchivedWorkflowServiceApi apiInstance = new ArchivedWorkflowServiceApi(defaultClient);
String uid = "uid_example"; // String |
IoArgoprojWorkflowV1alpha1RetryArchivedWorkflowRequest body = new IoArgoprojWorkflowV1alpha1RetryArchivedWorkflowRequest(); // IoArgoprojWorkflowV1alpha1RetryArchivedWorkflowRequest |
try {
IoArgoprojWorkflowV1alpha1Workflow result = apiInstance.archivedWorkflowServiceRetryArchivedWorkflow(uid, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ArchivedWorkflowServiceApi#archivedWorkflowServiceRetryArchivedWorkflow");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**uid** | **String**| |
**body** | [**IoArgoprojWorkflowV1alpha1RetryArchivedWorkflowRequest**](IoArgoprojWorkflowV1alpha1RetryArchivedWorkflowRequest.md)| |

### Return type

[**IoArgoprojWorkflowV1alpha1Workflow**](IoArgoprojWorkflowV1alpha1Workflow.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | A successful response. | - |
**0** | An unexpected error response. | - |

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@


# IoArgoprojWorkflowV1alpha1RetryArchivedWorkflowRequest


## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | | [optional]
**namespace** | **String** | | [optional]
**nodeFieldSelector** | **String** | | [optional]
**restartSuccessful** | **Boolean** | | [optional]
**uid** | **String** | | [optional]



Loading