Skip to content

Add annotations to minimise differences with celery-aio-pool's tracer.py.#7925

Merged
thedrow merged 1 commit intocelery:mainfrom
ShaheedHaque:srh_reduce_trace_diffs
Jan 4, 2023
Merged

Add annotations to minimise differences with celery-aio-pool's tracer.py.#7925
thedrow merged 1 commit intocelery:mainfrom
ShaheedHaque:srh_reduce_trace_diffs

Conversation

@ShaheedHaque
Copy link
Contributor

@ShaheedHaque ShaheedHaque commented Nov 27, 2022

Description

As per #7874, add annotations to trace.py to improve it's documentation, and make it easier to compare with celery-aio-pool's tracer.py. See also #the-wondersmith/celery-aio-pool/pull/4.

(Note: unit tests are currently badly broken)

@codecov
Copy link

codecov bot commented Nov 27, 2022

Codecov Report

Base: 89.89% // Head: 89.90% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (29ac7a6) compared to base (b5bc40f).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7925   +/-   ##
=======================================
  Coverage   89.89%   89.90%           
=======================================
  Files         128      128           
  Lines       15896    15910   +14     
  Branches     2140     2143    +3     
=======================================
+ Hits        14290    14304   +14     
  Misses       1370     1370           
  Partials      236      236           
Flag Coverage Δ
unittests 89.88% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
celery/app/trace.py 98.61% <100.00%> (+0.01%) ⬆️
celery/app/base.py 96.66% <0.00%> (+0.01%) ⬆️
celery/canvas.py 94.72% <0.00%> (+0.04%) ⬆️

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.

@lgtm-com
Copy link

lgtm-com bot commented Nov 27, 2022

This pull request introduces 1 alert when merging 9d3046f into 87613c7 - view on LGTM.com

new alerts:

  • 1 for Module is imported with 'import' and 'import from'

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog.

@ShaheedHaque ShaheedHaque force-pushed the srh_reduce_trace_diffs branch 2 times, most recently from 108e90a to 4468397 Compare November 27, 2022 15:46
@lgtm-com
Copy link

lgtm-com bot commented Nov 27, 2022

This pull request introduces 1 alert when merging 4468397 into 87613c7 - view on LGTM.com

new alerts:

  • 1 for Module is imported with 'import' and 'import from'

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog.

@ShaheedHaque ShaheedHaque force-pushed the srh_reduce_trace_diffs branch from 4468397 to 29ac7a6 Compare November 28, 2022 17:29
@ShaheedHaque ShaheedHaque requested review from clokep and removed request for auvipy November 29, 2022 08:30
@lgtm-com
Copy link

lgtm-com bot commented Nov 29, 2022

This pull request introduces 1 alert when merging 29ac7a6 into 87613c7 - view on LGTM.com

new alerts:

  • 1 for Module is imported with 'import' and 'import from'

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog.

@ShaheedHaque
Copy link
Contributor Author

@auvipy I think I accidentally removed you as a reviewer, but I am not sure how to add you back.

@auvipy auvipy requested review from auvipy and removed request for clokep November 30, 2022 04:06
@ShaheedHaque
Copy link
Contributor Author

ShaheedHaque commented Jan 3, 2023

@auvipy @clokep Any chance of getting this reviewed and merged? I have merged the corresponding celery-aio-pool PR.

Copy link
Contributor

@clokep clokep left a comment

Choose a reason for hiding this comment

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

I don't see any issues with it.

request: celery.app.task.Context,
exc: Union[Exception, Type[Exception]],
state: str = FAILURE,
call_errbacks: bool = True) -> Tuple[Info, Any, Any, Any]:
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe that I.state is a string, but that can always be tightened up in the future.

Suggested change
call_errbacks: bool = True) -> Tuple[Info, Any, Any, Any]:
call_errbacks: bool = True) -> Tuple[Info, Any, str, Any]:

@thedrow thedrow merged commit 0233c3b into celery:main Jan 4, 2023
Nusnus added a commit to Katz-Consulting-Group/celery that referenced this pull request Jan 16, 2024
Nusnus added a commit to Katz-Consulting-Group/celery that referenced this pull request Jan 17, 2024
Nusnus added a commit that referenced this pull request Jan 17, 2024
* Revert "Add annotations to minimise differences with celery-aio-pool's tracer.py. (#7925)"

This reverts commit 0233c3b.

* Added smoke test: test_worker_consume_tasks_after_redis_broker_restart

* Removed Redis xfail from tests now that the bug is fixed

* Renamed smoke tests CI jobs
@Nusnus
Copy link
Member

Nusnus commented Jan 17, 2024

This PR was reverted as it introduced a bug, unfortunately.
At the time, it was impossible to know. Now we have the means.

The work needs to be done again, apologies & thank you 🙏

@ShaheedHaque
Copy link
Contributor Author

ShaheedHaque commented Jan 17, 2024

@Nusnus OK, sorry for the inconvenience.

I have reviewed the code and am not able to see what caused the issue? AFAICS, this commit consists of annotations which are not supposed to have any run time effect. Did some supporting import go wrong perhaps?

@Nusnus
Copy link
Member

Nusnus commented Jan 17, 2024

@ShaheedHaque

I have reviewed the code and am not able to see what caused the issue? AFAICS, this commit consists of annotations which are not supposed to have any run time effect. Did some supporting import go wrong perhaps?

My first attempt was just reverting single lines - anything that wasn’t pure type annotation change. I also added from __future__ import annotations and ran pyupgrade, which further cleaned the original contribution.
I am sure I missed something, because it didn’t work. I was so tired when I stumbled upon this, so I just reverted the entire PR, and the original bug was gone, so I went with it (due to being just a documentation PR and the bug being an urgent production-breaking issue).

@Nusnus OK, sorry for the inconvenience.

No worries - on the contrary though, you’re welcome to redo the work now that you can trust the CI to let you know if something breaks, so go ahead - and tag me for review 🤙

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