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

fix(executor):Failure node failed to get archived log #5671

Merged
merged 2 commits into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
23 changes: 6 additions & 17 deletions cmd/argoexec/commands/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,46 +39,35 @@ func waitContainer(ctx context.Context) error {
}()

// Wait for main container to complete
waitErr := wfExecutor.Wait(ctx)
if waitErr != nil {
wfExecutor.AddError(waitErr)
// do not return here so we can still try to kill sidecars & save outputs
err := wfExecutor.Wait(ctx)
if err != nil {
wfExecutor.AddError(err)
}

// Capture output script result
err := wfExecutor.CaptureScriptResult(ctx)
err = wfExecutor.CaptureScriptResult(ctx)
if err != nil {
wfExecutor.AddError(err)
return err
}
// Saving logs
logArt, err := wfExecutor.SaveLogs(ctx)
if err != nil {
wfExecutor.AddError(err)
return err
}
// Saving output parameters
err = wfExecutor.SaveParameters(ctx)
if err != nil {
wfExecutor.AddError(err)
return err
}
// Saving output artifacts
err = wfExecutor.SaveArtifacts(ctx)
if err != nil {
wfExecutor.AddError(err)
return err
}
// Annotating pod with output
err = wfExecutor.AnnotateOutputs(ctx, logArt)
if err != nil {
wfExecutor.AddError(err)
return err
}

// To prevent the workflow step from completing successfully, return the error occurred during wait.
if waitErr != nil {
return waitErr
}

return nil
return wfExecutor.HasError()
}
10 changes: 9 additions & 1 deletion workflow/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,12 +728,20 @@ func (we *WorkflowExecutor) AnnotateOutputs(ctx context.Context, logArt *wfv1.Ar
return we.AddAnnotation(ctx, common.AnnotationKeyOutputs, string(outputBytes))
}

// AddError adds an error to the list of encountered errors durign execution
// AddError adds an error to the list of encountered errors during execution
func (we *WorkflowExecutor) AddError(err error) {
log.Errorf("executor error: %+v", err)
we.errors = append(we.errors, err)
}

// HasError return the first error if exist
func (we *WorkflowExecutor) HasError() error {
if len(we.errors) > 0 {
return we.errors[0]
}
return nil
}

// AddAnnotation adds an annotation to the workflow pod
func (we *WorkflowExecutor) AddAnnotation(ctx context.Context, key, value string) error {
return common.AddPodAnnotation(ctx, we.ClientSet, we.PodName, we.Namespace, key, value, ExecutorRetry)
Expand Down