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

Add retry button in Pipeline UI #1782

Merged
merged 21 commits into from
Aug 15, 2019
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
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
39 changes: 27 additions & 12 deletions backend/src/apiserver/resource/resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,23 +369,38 @@ func (r *ResourceManager) RetryRun(runId string) error {
return util.NewInternalServerError(err, "Retry run failed. Failed to clean up the failed pods from previous run.")
}

_, updateErr := r.workflowClient.Update(newWorkflow.Workflow)
if updateErr == nil {
return nil
// First try to update workflow
updateError := r.updateWorkflow(newWorkflow)
if updateError != nil {
// Remove resource version
newWorkflow.ResourceVersion = ""
newCreatedWorkflow, createError := r.workflowClient.Create(newWorkflow.Workflow)
if createError != nil {
return util.NewInternalServerError(createError,
"Retry run failed. Failed to create or update the run. Update Error: %s, Create Error: %s",
updateError.Error(), createError.Error())
}
newWorkflow = util.NewWorkflow(newCreatedWorkflow)
}

// Remove resource version
newWorkflow.ResourceVersion = ""
_, createError := r.workflowClient.Create(newWorkflow.Workflow)
if createError != nil {
return util.NewInternalServerError(createError,
"Retry run failed. Failed to create or update the run. Update Error: %s, Create Error: %s",
updateErr.Error(), createError.Error())
err = r.runStore.UpdateRun(runId, newWorkflow.Condition(), 0, newWorkflow.ToStringForStore())
if err != nil {
return util.NewInternalServerError(err, "Failed to update the database entry.")
}

return nil
}

func (r *ResourceManager) updateWorkflow(newWorkflow *util.Workflow) error {
// If fail to get the workflow, return error.
latestWorkflow, err := r.workflowClient.Get(newWorkflow.Name, v1.GetOptions{})
if err != nil {
return err
}
// Update the workflow's resource version to latest.
newWorkflow.ResourceVersion = latestWorkflow.ResourceVersion
_, err = r.workflowClient.Update(newWorkflow.Workflow)
return err
}

func (r *ResourceManager) GetJob(id string) (*model.Job, error) {
return r.jobStore.GetJob(id)
}
Expand Down
4 changes: 4 additions & 0 deletions backend/src/apiserver/resource/resource_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,10 @@ func TestRetryRun(t *testing.T) {

err = manager.RetryRun(runDetail.UUID)
assert.Nil(t, err)

actualRunDetail, err = manager.GetRun(runDetail.UUID)
assert.Nil(t, err)
assert.Contains(t, actualRunDetail.WorkflowRuntimeManifest, "Running")
}

func TestRetryRun_RunNotExist(t *testing.T) {
Expand Down
32 changes: 16 additions & 16 deletions frontend/src/apis/experiment/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,19 @@ export interface ApiExperiment {
*/
export interface ApiListExperimentsResponse {
/**
*
* A list of experiments returned.
* @type {Array<ApiExperiment>}
* @memberof ApiListExperimentsResponse
*/
experiments?: Array<ApiExperiment>;
/**
*
* The total number of experiments for the given query.
* @type {number}
* @memberof ApiListExperimentsResponse
*/
total_size?: number;
/**
*
* The token to list the next page of experiments.
* @type {string}
* @memberof ApiListExperimentsResponse
*/
Expand Down Expand Up @@ -169,7 +169,7 @@ export interface ApiStatus {
*/
export interface ProtobufAny {
/**
* A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics.
* A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics.
* @type {string}
* @memberof ProtobufAny
*/
Expand All @@ -191,7 +191,7 @@ export const ExperimentServiceApiFetchParamCreator = function (configuration?: C
return {
/**
*
* @param {ApiExperiment} body
* @param {ApiExperiment} body The experiment to be created
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
Expand Down Expand Up @@ -230,7 +230,7 @@ export const ExperimentServiceApiFetchParamCreator = function (configuration?: C
},
/**
*
* @param {string} id
* @param {string} id The ID of the experiment to be deleted.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
Expand Down Expand Up @@ -266,7 +266,7 @@ export const ExperimentServiceApiFetchParamCreator = function (configuration?: C
},
/**
*
* @param {string} id
* @param {string} id The ID of the experiment to be retrieved
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
Expand Down Expand Up @@ -361,7 +361,7 @@ export const ExperimentServiceApiFp = function(configuration?: Configuration) {
return {
/**
*
* @param {ApiExperiment} body
* @param {ApiExperiment} body The experiment to be created
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
Expand All @@ -379,7 +379,7 @@ export const ExperimentServiceApiFp = function(configuration?: Configuration) {
},
/**
*
* @param {string} id
* @param {string} id The ID of the experiment to be deleted.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
Expand All @@ -397,7 +397,7 @@ export const ExperimentServiceApiFp = function(configuration?: Configuration) {
},
/**
*
* @param {string} id
* @param {string} id The ID of the experiment to be retrieved
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
Expand Down Expand Up @@ -445,7 +445,7 @@ export const ExperimentServiceApiFactory = function (configuration?: Configurati
return {
/**
*
* @param {ApiExperiment} body
* @param {ApiExperiment} body The experiment to be created
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
Expand All @@ -454,7 +454,7 @@ export const ExperimentServiceApiFactory = function (configuration?: Configurati
},
/**
*
* @param {string} id
* @param {string} id The ID of the experiment to be deleted.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
Expand All @@ -463,7 +463,7 @@ export const ExperimentServiceApiFactory = function (configuration?: Configurati
},
/**
*
* @param {string} id
* @param {string} id The ID of the experiment to be retrieved
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
Expand Down Expand Up @@ -494,7 +494,7 @@ export const ExperimentServiceApiFactory = function (configuration?: Configurati
export class ExperimentServiceApi extends BaseAPI {
/**
*
* @param {} body
* @param {} body The experiment to be created
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ExperimentServiceApi
Expand All @@ -505,7 +505,7 @@ export class ExperimentServiceApi extends BaseAPI {

/**
*
* @param {} id
* @param {} id The ID of the experiment to be deleted.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ExperimentServiceApi
Expand All @@ -516,7 +516,7 @@ export class ExperimentServiceApi extends BaseAPI {

/**
*
* @param {} id
* @param {} id The ID of the experiment to be retrieved
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ExperimentServiceApi
Expand Down
35 changes: 18 additions & 17 deletions frontend/src/apis/filter/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: version not set
*
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/


import * as portableFetch from "portable-fetch";
import { Configuration } from "./configuration";

Expand All @@ -38,7 +39,7 @@ export interface FetchAPI {
}

/**
*
*
* @export
* @interface FetchArgs
*/
Expand All @@ -48,7 +49,7 @@ export interface FetchArgs {
}

/**
*
*
* @export
* @class BaseAPI
*/
Expand All @@ -64,7 +65,7 @@ export class BaseAPI {
};

/**
*
*
* @export
* @class RequiredError
* @extends {Error}
Expand All @@ -91,27 +92,27 @@ export interface ApiFilter {
}

/**
*
*
* @export
* @interface ApiIntValues
*/
export interface ApiIntValues {
/**
*
*
* @type {Array&lt;number&gt;}
* @memberof ApiIntValues
*/
values?: Array<number>;
}

/**
*
*
* @export
* @interface ApiLongValues
*/
export interface ApiLongValues {
/**
*
*
* @type {Array&lt;string&gt;}
* @memberof ApiLongValues
*/
Expand All @@ -125,31 +126,31 @@ export interface ApiLongValues {
*/
export interface ApiPredicate {
/**
*
*
* @type {PredicateOp}
* @memberof ApiPredicate
*/
op?: PredicateOp;
/**
*
*
* @type {string}
* @memberof ApiPredicate
*/
key?: string;
/**
*
*
* @type {number}
* @memberof ApiPredicate
*/
int_value?: number;
/**
*
*
* @type {string}
* @memberof ApiPredicate
*/
long_value?: string;
/**
*
*
* @type {string}
* @memberof ApiPredicate
*/
Expand All @@ -167,27 +168,27 @@ export interface ApiPredicate {
*/
int_values?: ApiIntValues;
/**
*
*
* @type {ApiLongValues}
* @memberof ApiPredicate
*/
long_values?: ApiLongValues;
/**
*
*
* @type {ApiStringValues}
* @memberof ApiPredicate
*/
string_values?: ApiStringValues;
}

/**
*
*
* @export
* @interface ApiStringValues
*/
export interface ApiStringValues {
/**
*
*
* @type {Array&lt;string&gt;}
* @memberof ApiStringValues
*/
Expand Down
Loading