Skip to content

Fix eager tasks does not populate name field#8486

Merged
auvipy merged 4 commits intocelery:mainfrom
KOliver94:eager_task_no_name_bug
Oct 8, 2023
Merged

Fix eager tasks does not populate name field#8486
auvipy merged 4 commits intocelery:mainfrom
KOliver94:eager_task_no_name_bug

Conversation

@KOliver94
Copy link
Contributor

@KOliver94 KOliver94 commented Sep 4, 2023

Note: Before submitting this pull request, please review our contributing guidelines.

Description

My previous attempt (#8383) introduced a breaking change. This PR however should only contain the bear minimum to fix the issue without interfering with the current behaviour.

Fixes #7715, fixes #8472

@codecov
Copy link

codecov bot commented Sep 4, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (b6a5bdb) 87.44% compared to head (7a34f95) 87.46%.
Report is 30 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8486      +/-   ##
==========================================
+ Coverage   87.44%   87.46%   +0.02%     
==========================================
  Files         148      148              
  Lines       18491    18512      +21     
  Branches     3156     3163       +7     
==========================================
+ Hits        16169    16192      +23     
+ Misses       2033     2032       -1     
+ Partials      289      288       -1     
Flag Coverage Δ
unittests 87.43% <100.00%> (+0.02%) ⬆️

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

Files Coverage Δ
celery/app/task.py 95.35% <100.00%> (+0.55%) ⬆️
celery/result.py 96.71% <100.00%> (+0.01%) ⬆️

... and 4 files with indirect coverage changes

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

@Nusnus Nusnus requested review from Nusnus and auvipy September 4, 2023 22:44
@auvipy auvipy added this to the 5.3.x milestone Sep 5, 2023
Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

I can see the difference here from the previous PR. but shouldn't the newer approach also got proper test coverage? You can see my comment of Integration test on the previous PR and we ignored and caught with the regression, right? so It would be better to have as much test case as possible. thanks for handling this again!

@KOliver94
Copy link
Contributor Author

I'll try to add some tests but I think essentially the problem with the first approach was that it introduced a constructor change with a new required variable. As I understand the functionality did no cause any issues it only broke custom code parts for users which was an unexpected change in a patch version and it was not documented in the release notes as I did not expect that either. I think this approach can be refactored later to be similar to the first one, which is more consistent coding style wise, in a bigger version bump.

@auvipy
Copy link
Member

auvipy commented Sep 9, 2023

OK will be waiting for the missing/additional tests

@auvipy
Copy link
Member

auvipy commented Oct 2, 2023

it would be really great if we can add some test and merge this PR ASAP :)

@KOliver94
Copy link
Contributor Author

Sorry I didn't have time, I'll try to do it as soon as possible. :)

@KOliver94 KOliver94 requested a review from auvipy October 8, 2023 00:52
@KOliver94 KOliver94 force-pushed the eager_task_no_name_bug branch from b630c2e to 120b018 Compare October 8, 2023 00:56
@KOliver94
Copy link
Contributor Author

Hey @auvipy,

Sorry it took me so long but I added some tests. As all other tests pass without modification, I think it should be a safe change now.

Let me know what you think. Thanks!

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

Looks better

@auvipy
Copy link
Member

auvipy commented Oct 8, 2023

should we consider the OLD test https://github.com/celery/celery/pull/8383/files#diff-c63df79f676057328c4244cd9d26001610598b4bc772d503e5120a89291e46fc as well in the chord test? what about integration test to check nothing breaks? these are not mandatory but nice to have

@KOliver94
Copy link
Contributor Author

The modification in the chord test was only necessary because the change was mandatory. Now I think it's better not to change it because it validates that it is now not a breaking change. The functions inside celery populates the attribute so only custom functions made by users need to be adjusted. I added one more check to make sure the name field is still populated inside EagerResults even when they are called through a normal task flow. I don't think an integration test is necessary as most aspects are covered through the unit tests and I only see a really few patterns to integration test eager tasks.

@auvipy
Copy link
Member

auvipy commented Oct 8, 2023

yeah the new extra line looks great. thanks a lot

@auvipy auvipy merged commit 0639077 into celery:main Oct 8, 2023
@KOliver94 KOliver94 deleted the eager_task_no_name_bug branch October 8, 2023 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5.3.2/3 has BREAKING change on EagerResult EagerResult doesn't seem to poplate name

2 participants