Skip to content

Stamping Mechanism Refactoring#8045

Merged
thedrow merged 67 commits intocelery:mainfrom
Katz-Consulting-Group:blm-191_stamping_mechanism_refactoring
Feb 8, 2023
Merged

Stamping Mechanism Refactoring#8045
thedrow merged 67 commits intocelery:mainfrom
Katz-Consulting-Group:blm-191_stamping_mechanism_refactoring

Conversation

@Nusnus
Copy link
Copy Markdown
Member

@Nusnus Nusnus commented Feb 1, 2023

W.I.P at the moment

@Nusnus Nusnus added this to the 5.3 milestone Feb 1, 2023
@Nusnus Nusnus self-assigned this Feb 1, 2023
@Nusnus Nusnus force-pushed the blm-191_stamping_mechanism_refactoring branch 2 times, most recently from 4a3fcdc to 34b2fc7 Compare February 1, 2023 17:37
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 1, 2023

Codecov Report

Base: 87.00% // Head: 87.01% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (700f5ba) compared to base (cb83eaf).
Patch coverage: 97.22% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8045      +/-   ##
==========================================
+ Coverage   87.00%   87.01%   +0.01%     
==========================================
  Files         148      148              
  Lines       18486    18440      -46     
  Branches     2520     2514       -6     
==========================================
- Hits        16083    16045      -38     
+ Misses       2123     2117       -6     
+ Partials      280      278       -2     
Flag Coverage Δ
unittests 86.98% <97.22%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
celery/canvas.py 97.45% <96.66%> (+0.74%) ⬆️
celery/app/task.py 95.09% <100.00%> (-0.20%) ⬇️
celery/worker/request.py 92.85% <0.00%> (-0.44%) ⬇️
celery/bin/base.py 49.17% <0.00%> (ø)
celery/utils/text.py 90.80% <0.00%> (+2.29%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Nusnus Nusnus force-pushed the blm-191_stamping_mechanism_refactoring branch 2 times, most recently from cce0acf to 7933f2c Compare February 1, 2023 20:58
@Nusnus Nusnus force-pushed the blm-191_stamping_mechanism_refactoring branch from 7933f2c to 1597511 Compare February 1, 2023 21:19
@auvipy
Copy link
Copy Markdown
Member

auvipy commented Feb 2, 2023

splitting to smaller chunks only or more improvement on the existing implementation?

@Nusnus
Copy link
Copy Markdown
Member Author

Nusnus commented Feb 2, 2023

splitting to smaller chunks only or more improvement on the existing implementation?

Basically, the stamping mechanism is our main blocker for Celery 5.3 release.
At the moment, Celery 5 (main) has bugs in an environment that includes both Celery 4 & 5 workers, due to the stamping feature, And the stamping feature itself has even more bugs by itself (Celery 5 vs Celery 5 worker environment) - mostly edge cases, but still critical edge cases.

So we can't release Celery 5 as it will break support in Celery 4 hybrid worker environment and that's a critical release blocker (imagine the process of migrating from 4 -> 5 and not having a hybrid environment working, it will be a nightmare to upgrade).

The stamping mechanism feature was developed before I was involved with Celery (at all tbh), so I am trying to complete the feature (reverse engineering the design, etc.) to get it working so we can advance into Celery 5.3 release.

The general idea of this PR then is to refactor the feature's implementation, reduce its complexity, complete testing, etc.

P.S
After I get the main to a stable version regarding bugs/features, I will push with the new pytest-celery plugin to allow implementing more advanced tests before Celery 5.3 release (e.g, backend/broker D/C tests, multiple prefork workers automatic tests, etc.).
This will create a very stable version (5.3) which we want to have, to gain trust in 5.3 and allow real-production environments the safety to upgrade.

@auvipy

@auvipy
Copy link
Copy Markdown
Member

auvipy commented Feb 2, 2023

thank you for your in detail response

@Nusnus Nusnus force-pushed the blm-191_stamping_mechanism_refactoring branch from 1597511 to 04db0f2 Compare February 2, 2023 20:36
@Nusnus Nusnus force-pushed the blm-191_stamping_mechanism_refactoring branch from 074e085 to 8a2d6ce Compare February 3, 2023 00:33
@Nusnus Nusnus force-pushed the blm-191_stamping_mechanism_refactoring branch 3 times, most recently from e1654a0 to e81cab4 Compare February 7, 2023 01:29
@Nusnus Nusnus force-pushed the blm-191_stamping_mechanism_refactoring branch from e81cab4 to 3a1568e Compare February 7, 2023 02:03
@Nusnus
Copy link
Copy Markdown
Member Author

Nusnus commented Feb 7, 2023

@thedrow I've replied to all of your comments.
All of the required fixes are pushed.
Please review again and notice:

  1. The integration tests are basically untouched from main at this point, only moved to a different file so far into the PR.
  2. Sphinx documentation will be the last step, to make sure we have a stable version first.

@Nusnus Nusnus force-pushed the blm-191_stamping_mechanism_refactoring branch from a048932 to fffd7ea Compare February 7, 2023 03:33
@Nusnus
Copy link
Copy Markdown
Member Author

Nusnus commented Feb 7, 2023

@auvipy @thedrow
Do you have any idea why does the code coverage is failing?

Failing after 1s — 86.99% (-0.01%) compared to cb83eaf

@auvipy
Copy link
Copy Markdown
Member

auvipy commented Feb 7, 2023

@auvipy @thedrow Do you have any idea why does the code coverage is failing?

Failing after 1s — 86.99% (-0.01%) compared to cb83eaf

that's mostly random codcov issue I guess

@Nusnus Nusnus force-pushed the blm-191_stamping_mechanism_refactoring branch from 6c6b3ce to fffd7ea Compare February 7, 2023 20:46
@Nusnus Nusnus force-pushed the blm-191_stamping_mechanism_refactoring branch from 48f13cc to 700f5ba Compare February 8, 2023 04:43
@Nusnus
Copy link
Copy Markdown
Member Author

Nusnus commented Feb 8, 2023

@auvipy @thedrow Do you have any idea why does the code coverage is failing?

Failing after 1s — 86.99% (-0.01%) compared to cb83eaf

that's mostly random codcov issue I guess

I think I found the reason it failed. Very interesting!
Fixed in this commit: db7936b

The code that I removed in this commit was code that indeed ran, but the condition if stamp in self.options and stamp not in link.options: was always false after all of the fixes and changes of this PR.
So technically, the body of the condition was never accessed, thus causing a code coverage error.

Now the interesting part - investigating this, I discovered that the original code (the one I just removed in db7936b) was actually a patch to a bug in the stamping mechanism, which while the bug existed this code was accessed so it did not have any code cov errors when it was first introduced. As this PR fixes the stamping mechanism, the patch fixes an impossible edge case now (as it is naturally handled now, without need for edge cases patches), so the workaround wasn't needed anymore, making the code coverage error in the PR actually very useful in finding out useless code that can be removed safely.

It was damn hard to understand but finally I can get my 100% passing CI, I hate seeing errors! 😁

@auvipy @thedrow
I think this makes a very important lesson - we shouldn't ignore very easily CI errors, even if it's "just code coverage".

@Nusnus Nusnus marked this pull request as ready for review February 8, 2023 05:21
@Nusnus Nusnus requested a review from thedrow February 8, 2023 05:23
Copy link
Copy Markdown
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 good

@thedrow thedrow merged commit 8000bb1 into celery:main Feb 8, 2023
@Nusnus
Copy link
Copy Markdown
Member Author

Nusnus commented Feb 8, 2023

Thank you!! 🙏 🙏

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.

2 participants