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

[wip] add an error in base case for file size exceeded #5725

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
maxPayloadSize int64
}

var ErrRemoteFileExceedsMaxSize = errors.New("remote file exceeds max size")

func (r RemoteFileOutputReader) IsError(ctx context.Context) (bool, error) {
metadata, err := r.store.Head(ctx, r.outPath.GetErrorPath())
if err != nil {
Expand Down Expand Up @@ -81,7 +83,7 @@
}
if md.Exists() {
if md.Size() > r.maxPayloadSize {
return false, errors.Errorf("output file @[%s] is too large [%d] bytes, max allowed [%d] bytes", r.outPath.GetOutputPath(), md.Size(), r.maxPayloadSize)
return false, errors.Wrapf(ErrRemoteFileExceedsMaxSize, "output file @[%s] is too large [%d] bytes, max allowed [%d] bytes", r.outPath.GetOutputPath(), md.Size(), r.maxPayloadSize)

Check warning on line 86 in flyteplugins/go/tasks/pluginmachinery/ioutils/remote_file_output_reader.go

View check run for this annotation

Codecov / codecov/patch

flyteplugins/go/tasks/pluginmachinery/ioutils/remote_file_output_reader.go#L86

Added line #L86 was not covered by tests
}
return true, nil
}
Expand Down
9 changes: 9 additions & 0 deletions flytepropeller/pkg/controller/nodes/task/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,15 @@
}
ok, err := r.Exists(ctx)
if err != nil {
if regErrors.Is(err, ioutils.ErrRemoteFileExceedsMaxSize) {
return &io.ExecutionError{
ExecutionError: &core.ExecutionError{
Code: "OutputSizeExceeded",
Message: fmt.Sprintf("Remote output size exceeds max, err: [%s]", err.Error()),
},
IsRecoverable: false,
}, nil

Check warning on line 744 in flytepropeller/pkg/controller/nodes/task/handler.go

View check run for this annotation

Codecov / codecov/patch

flytepropeller/pkg/controller/nodes/task/handler.go#L737-L744

Added lines #L737 - L744 were not covered by tests
}
logger.Errorf(ctx, "Failed to check if the output file exists. Error: %s", err.Error())
return nil, err
}
Expand Down
Loading