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

[Bug] correctly set task execution phase for terminal array node #5136

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

pvditt
Copy link
Contributor

@pvditt pvditt commented Mar 29, 2024

Tracking issue

#5135

Why are the changes needed?

Task execution phases are not set correctly for successful nor failed ArrayNodes

What changes were proposed in this pull request?

  • ensure correct phase is set in task execution events

How was this patch tested?

Setup process

ran a workflow with a map task that failed and one that succeeded. Confirmed that the taskExecution closure phase was correctly set.

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Summary by Bito

This PR addresses a bug in the array node handler related to task execution phase settings. The changes implement proper phase setting in task execution events, specifically improving the abort handler to distinguish between aborted and failed states. The modifications enhance state reporting accuracy for both successful and failed terminal states.

Unit tests added: False

Estimated effort to review (1-5, lower is better): 1

Signed-off-by: Paul Dittamo <pvdittamo@gmail.com>
Copy link

codecov bot commented Mar 29, 2024

Codecov Report

Attention: Patch coverage is 26.31579% with 14 lines in your changes missing coverage. Please review.

Project coverage is 37.02%. Comparing base (b010747) to head (6cc769f).

Files with missing lines Patch % Lines
...ytepropeller/pkg/controller/nodes/array/handler.go 26.31% 11 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5136   +/-   ##
=======================================
  Coverage   37.02%   37.02%           
=======================================
  Files        1317     1317           
  Lines      132523   132537   +14     
=======================================
+ Hits        49066    49075    +9     
- Misses      79211    79215    +4     
- Partials     4246     4247    +1     
Flag Coverage Δ
unittests-datacatalog 51.58% <ø> (ø)
unittests-flyteadmin 54.25% <ø> (ø)
unittests-flytecopilot 30.99% <ø> (ø)
unittests-flytectl 62.29% <ø> (ø)
unittests-flyteidl 7.23% <ø> (ø)
unittests-flyteplugins 53.85% <ø> (ø)
unittests-flytepropeller 42.65% <26.31%> (+0.01%) ⬆️
unittests-flytestdlib 55.17% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pvditt added 3 commits August 23, 2024 13:18
Signed-off-by: Paul Dittamo <pvdittamo@gmail.com>
Signed-off-by: Paul Dittamo <pvdittamo@gmail.com>
Signed-off-by: Paul Dittamo <pvdittamo@gmail.com>
@pvditt pvditt marked this pull request as ready for review January 10, 2025 06:45
@pvditt pvditt requested a review from hamersaw January 10, 2025 06:51
@flyte-bot
Copy link
Collaborator

flyte-bot commented Jan 10, 2025

Code Review Agent Run #e4c107

Actionable Suggestions - 2
  • flytepropeller/pkg/controller/nodes/array/handler.go - 2
Review Details
  • Files reviewed - 1 · Commit Range: 344bde3..6cc769f
    • flytepropeller/pkg/controller/nodes/array/handler.go
  • Files skipped - 0
  • Tools
    • Golangci-lint (Linter) - ✖︎ Failed
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

AI Code Review powered by Bito Logo

@flyte-bot
Copy link
Collaborator

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted
Bug Fix - Fix Task Execution Phase for Array Nodes

handler.go - Updated task execution phase handling for array nodes in abort, failure, and success scenarios

Comment on lines +132 to +134
if !eventsErr.IsAlreadyExists(err) {
logger.Errorf(ctx, "ArrayNode event recording failed: [%s]", err.Error())
return err
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider more graceful error handling

Consider handling the error case more gracefully by logging the error and continuing execution rather than returning early. The current implementation may cause unnecessary aborts.

Code suggestion
Check the AI-generated fix before applying
Suggested change
if !eventsErr.IsAlreadyExists(err) {
logger.Errorf(ctx, "ArrayNode event recording failed: [%s]", err.Error())
return err
if eventsErr.IsAlreadyExists(err) {
return nil
}

Code Review Run #e4c107


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

  • it was incorrectly flagged

Comment on lines +473 to +474
// ensure task_execution set to failed - this should already be sent by the abort handler
if err := eventRecorder.finalize(ctx, nCtx, idlcore.TaskExecution_FAILED, 0, a.eventConfig); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider validating eventRecorder before use

Consider checking if eventRecorder is not nil before calling finalize(). The current code assumes eventRecorder is always initialized.

Code suggestion
Check the AI-generated fix before applying
Suggested change
// ensure task_execution set to failed - this should already be sent by the abort handler
if err := eventRecorder.finalize(ctx, nCtx, idlcore.TaskExecution_FAILED, 0, a.eventConfig); err != nil {
// ensure task_execution set to failed - this should already be sent by the abort handler
if eventRecorder == nil {
logger.Errorf(ctx, "ArrayNode eventRecorder is nil")
return handler.UnknownTransition, fmt.Errorf("eventRecorder is nil")
}
if err := eventRecorder.finalize(ctx, nCtx, idlcore.TaskExecution_FAILED, 0, a.eventConfig); err != nil {

Code Review Run #e4c107


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

  • it was incorrectly flagged

Copy link
Contributor

@hamersaw hamersaw left a comment

Choose a reason for hiding this comment

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

Any unit tests we should be adding? It looks like we will send some new events now right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants