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

Remove Deck URI when OutputReader is nil #6223

Merged
Merged
Changes from 1 commit
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
20 changes: 11 additions & 9 deletions flytepropeller/pkg/controller/nodes/task/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,25 @@
}

func (p *pluginRequestedTransition) RemoveDeckURIIfDeckNotExists(ctx context.Context, tCtx *taskExecutionContext) error {
// If there's no output info, nothing to do.
if p.execInfo.OutputInfo == nil {
return nil
}

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

View check run for this annotation

Codecov / codecov/patch

flytepropeller/pkg/controller/nodes/task/handler.go#L97-L98

Added lines #L97 - L98 were not covered by tests

reader := tCtx.ow.GetReader()
if reader == nil {
p.execInfo.OutputInfo.DeckURI = nil

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

View check run for this annotation

Codecov / codecov/patch

flytepropeller/pkg/controller/nodes/task/handler.go#L102

Added line #L102 was not covered by tests
return nil
}

exists, err := reader.DeckExists(ctx)
if err != nil {
if p.execInfo.OutputInfo != nil {
p.execInfo.OutputInfo.DeckURI = nil
}
return regErrors.Wrapf(err, "failed to check existence of deck file")
}

if !exists && p.execInfo.OutputInfo != nil {
if err != nil || !exists {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider separating error and existence checks

Consider separating error handling from existence check to improve code clarity. The current combined condition if err != nil || !exists { makes the error handling less explicit.

Code suggestion
Check the AI-generated fix before applying
 -	if err != nil || !exists {
 -		p.execInfo.OutputInfo.DeckURI = nil
 -	}
 -
 -	if err != nil {
 +	if err != nil {
 +		p.execInfo.OutputInfo.DeckURI = nil
  		return regErrors.Wrapf(err, "failed to check existence of deck file")
 +	}
 +
 +	if !exists {
 +		p.execInfo.OutputInfo.DeckURI = nil
  	}

Code Review Run #54fd06


Is this a valid issue, or was it incorrectly flagged by the Agent?

  • it was incorrectly flagged

p.execInfo.OutputInfo.DeckURI = nil
}

if err != nil {
return regErrors.Wrapf(err, "failed to check existence of deck file")
}

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

View check run for this annotation

Codecov / codecov/patch

flytepropeller/pkg/controller/nodes/task/handler.go#L112-L113

Added lines #L112 - L113 were not covered by tests
return nil
}

Expand Down Expand Up @@ -775,7 +777,7 @@
return pluginTrns.FinalTransition(ctx)
}

func (t *Handler) ValidateOutput(ctx context.Context, nodeID v1alpha1.NodeID, i io.InputReader,
func (t Handler) ValidateOutput(ctx context.Context, nodeID v1alpha1.NodeID, i io.InputReader,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider keeping pointer receiver for consistency

Consider keeping the pointer receiver *Handler instead of value receiver Handler for consistency. The ValidateOutput method appears to be used in multiple places and changing to value receiver could lead to unnecessary copying.

Code suggestion
Check the AI-generated fix before applying
Suggested change
func (t Handler) ValidateOutput(ctx context.Context, nodeID v1alpha1.NodeID, i io.InputReader,
func (t *Handler) ValidateOutput(ctx context.Context, nodeID v1alpha1.NodeID, i io.InputReader,

Code Review Run #54fd06


Is this a valid issue, or was it incorrectly flagged by the Agent?

  • it was incorrectly flagged

r io.OutputReader, outputCommitter io.OutputWriter, executionConfig v1alpha1.ExecutionConfig,
tr ioutils.SimpleTaskReader) (*io.ExecutionError, error) {

Expand Down
Loading