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

Make 'steal' command atomic #1144

Merged
merged 1 commit into from
Oct 30, 2024
Merged

Conversation

amezin
Copy link
Collaborator

@amezin amezin commented Oct 23, 2024

Either unschedule all requested tests, or none if it's not possible - if some of the requested tests have already been processed by the time the request arrives. It may happen if the worker runs tests faster than the controller receives and processes status updates. But in this case maybe it's just better to let the worker keep running.

This is a prerequisite for group/scope support in worksteal scheduler - so they won't be broken up incorrectly.

This change could break schedulers that use "steal" command. However:

  1. worksteal scheduler doesn't need any adjustments.

  2. I'm not aware of any external schedulers relying on this command yet.

So I think it's better to keep the protocol simple, not complicate it for imaginary compatibility with some unknown and likely non-existent schedulers.

@amezin amezin force-pushed the steal-atomic branch 2 times, most recently from aa1324c to eb4388c Compare October 23, 2024 05:09
Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

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

Thanks @amezin, overall looks good!

I left a few minor comments.

src/xdist/remote.py Show resolved Hide resolved
src/xdist/remote.py Outdated Show resolved Hide resolved
testing/test_remote.py Show resolved Hide resolved
testing/test_remote.py Show resolved Hide resolved
changelog/1144.feature Outdated Show resolved Hide resolved
@amezin amezin force-pushed the steal-atomic branch 2 times, most recently from ddb7e68 to 8dea23c Compare October 23, 2024 14:26
Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@RonnyPfannschmidt would appreciate a second set of eyes before we merge this.

Either unschedule all requested tests, or none if it's not possible -
if some of the requested tests have already been processed by the time
the request arrives. It may happen if the worker runs tests faster than
the controller receives and processes status updates. But in this case
maybe it's just better to let the worker keep running.

This is a prerequisite for group/scope support in worksteal scheduler -
so they won't be broken up incorrectly.

This change could break schedulers that use "steal" command. However:

1) worksteal scheduler doesn't need any adjustments.

2) I'm not aware of any external schedulers relying on this command yet.

So I think it's better to keep the protocol simple, not complicate it for
imaginary compatibility with some unknown and likely non-existent
schedulers.

Co-authored-by: Bruno Oliveira <[email protected]>
@nicoddemus nicoddemus merged commit 9788f12 into pytest-dev:master Oct 30, 2024
23 checks passed
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.

2 participants