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

GH-124639: add back loop param to staggered_race #124700

Merged
merged 5 commits into from
Sep 29, 2024

Conversation

kumaraditya303
Copy link
Contributor

@kumaraditya303 kumaraditya303 commented Sep 27, 2024

@ZeroIntensity
Copy link
Member

I think staggered_race should emit a DeprecationWarning, so we can officially make it private in 3.16

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

Could you add a deprecation warning when loop is not None (or maybe only if it’s not equal to tg._loop)?

@kumaraditya303
Copy link
Contributor Author

kumaraditya303 commented Sep 27, 2024

Could you add a deprecation warning when loop is not None (or maybe only if it’s not equal to tg._loop)?

I'll handle change for 3.14 separately, let's first get this done so that it can be backported to stable releases. We cannot add deprecations to stable releases AFAIR.

@gvanrossum
Copy link
Member

gvanrossum commented Sep 27, 2024 via email

Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

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

LGTM. I don't know if the bot will like the 3.13 backport, because the backport for the original PR never got merged (unless I missed that, IIRC Kirill added DO-NOT-MERGE).

Copy link
Member

@gvanrossum gvanrossum 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 to me.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

Sorry, needs a test.

@bedevere-app
Copy link

bedevere-app bot commented Sep 27, 2024

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

And if you don't make the requested changes, you will be put in the comfy chair!

@gvanrossum
Copy link
Member

@kumaraditya303 Why did you mark this as a release blocker? The original PR has not been backported to 3.13. Or is it only a blocker for 3.12? My guess is (and I would agree) that Thomas will not allow the original PR in 3.13.0, and then this can't be merged there either. It can all go into 3.13.1, as well as into the 3.12 branch, of course. Let's just make sure that the original PR doesn't go into a 3.12 release without this one as well.

(I will next actually review the test.)

@@ -121,6 +121,25 @@ async def coro(index):
self.assertIsInstance(excs[0], ValueError)
self.assertIsNone(excs[1])

def test_loop_argument(self):
Copy link
Member

Choose a reason for hiding this comment

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

Ah, so this is just the original test restored. See my comment #124639 (comment) for why I'm not yet approving this.

Copy link
Member

Choose a reason for hiding this comment

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

Hm, I'm not so sure there ever were tests for staggered in 3.12. What I thought I saw was probably in a different branch. :-( Sorry.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was no tests for it and still has less in main than it should

Copy link
Contributor

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

Tested on a production system, details
#124639 (comment)

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

This version can go in, since it does the right thing when the current loop is passed in using loop=get_running_loop() (which is the only use case in aiohttp -- they just pass it in redundantly). We really need to land the 3.12 backport ASAP, since the next 3.12 release happens Tuesday (Oct 1).

However, if you pass a different eventloop (e.g. loop=new_event_loop()) things break terribly (I tried this in the test and it just hung).

Consider rolling back the TaskGroup hack (and the comment, alas) and instead just checking that loop is None or loop is get_running_task(), raising ValueError if it isn't.

But that can be a separate PR, so you don't have to stress about the release, or how to test it.

@kumaraditya303
Copy link
Contributor Author

It's a blocker for 3.12 so I marked it

@kumaraditya303 kumaraditya303 merged commit e0a41a5 into python:main Sep 29, 2024
33 of 35 checks passed
@miss-islington-app
Copy link

Thanks @kumaraditya303 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @kumaraditya303, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker e0a41a5dd12cb6e9277b05abebac5c70be684dd7 3.13

@kumaraditya303 kumaraditya303 deleted the async-fix branch September 29, 2024 03:13
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 29, 2024
(cherry picked from commit e0a41a5)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
@bedevere-app
Copy link

bedevere-app bot commented Sep 29, 2024

GH-124744 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Sep 29, 2024
kumaraditya303 added a commit to miss-islington/cpython that referenced this pull request Sep 29, 2024
kumaraditya303 added a commit that referenced this pull request Sep 29, 2024
…124744)

GH-124639: add back loop param to staggered_race (GH-124700)
(cherry picked from commit e0a41a5)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
ZeroIntensity added a commit to ZeroIntensity/cpython that referenced this pull request Sep 30, 2024
Yhg1s pushed a commit that referenced this pull request Oct 1, 2024
…am (#124810)

* Revert "GH-124639: add back loop param to staggered_race (#124700)"

This reverts commit e0a41a5.

* Revert "gh-124309: Modernize the `staggered_race` implementation to support eager task factories (#124390)"

This reverts commit de929f3.
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 1, 2024
…wnstream (pythonGH-124810)

* Revert "pythonGH-124639: add back loop param to staggered_race (pythonGH-124700)"

This reverts commit e0a41a5.

* Revert "pythongh-124309: Modernize the `staggered_race` implementation to support eager task factories (pythonGH-124390)"

This reverts commit de929f3.
(cherry picked from commit 133e929)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Yhg1s pushed a commit that referenced this pull request Oct 1, 2024
…ownstream (GH-124810) (#124817)

gh-124309: Revert eager task factory fix to prevent breaking downstream (GH-124810)

* Revert "GH-124639: add back loop param to staggered_race (GH-124700)"

This reverts commit e0a41a5.

* Revert "gh-124309: Modernize the `staggered_race` implementation to support eager task factories (GH-124390)"

This reverts commit de929f3.
(cherry picked from commit 133e929)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

5 participants