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

#10314 Better worker-side error handling in disttrial #11644

Merged
merged 21 commits into from
Sep 16, 2022

Conversation

exarkun
Copy link
Member

@exarkun exarkun commented Sep 7, 2022

Scope and purpose

Fixes #10314

This adds error handling (any, at all!) to the "workerreporter" that manages communication of test results from the disttrial worker processes back to the parent process so that such errors won't cause the whole trial process to exit without a result report.

It also changes the network protocol between workers and parent to stream error text so that text longer than the AMP limit of 64k makes it back to the parent without error.

@exarkun
Copy link
Member Author

exarkun commented Sep 7, 2022

please review

Copy link
Member

@adiroiban adiroiban left a comment

Choose a reason for hiding this comment

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

I did a very quick review.
I am leaving the command as I don't know when I will have time to do a full review.

If no other developer will have time to review this in the next few days, I think that this should be merge.

I don't think is ok to block a merge for a PR that has tests for the new code, is well documented and the tests are green.

src/twisted/trial/_dist/stream.py Outdated Show resolved Hide resolved
src/twisted/trial/_dist/worker.py Show resolved Hide resolved
@exarkun exarkun force-pushed the 10314.disttrial-error-handling branch from 8d0411e to 5cc7599 Compare September 13, 2022 13:52
@exarkun exarkun force-pushed the 10314.disttrial-error-handling branch from 5cc7599 to 5811136 Compare September 13, 2022 19:10
Copy link
Member

@adiroiban adiroiban left a comment

Choose a reason for hiding this comment

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

It looks good. Only minor comments.


src/twisted/trial/_dist/worker.py Outdated Show resolved Hide resolved
src/twisted/trial/_dist/workerreporter.py Outdated Show resolved Hide resolved
@adiroiban adiroiban requested a review from a team September 14, 2022 13:22
It's still on a class in a private package so this doesn't make it public to
users outside of Twisted (or even outside of disttrial).  It does make it
public to `WorkerProtocol` which needs to use it.
Copy link
Member

@adiroiban adiroiban left a comment

Choose a reason for hiding this comment

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

I left a few other minor comments.

I still have to review - _runErrorTest and WorkerProtocol.run

I will try to continue the review later today.

src/twisted/trial/test/erroneous.py Show resolved Hide resolved
src/twisted/trial/test/erroneous.py Show resolved Hide resolved
Copy link
Member

@adiroiban adiroiban 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.

Only a medium comment regarding the usage of context manager.

But I think it can be fixed and merged without another round of reviews.

src/twisted/trial/_dist/worker.py Outdated Show resolved Hide resolved
src/twisted/trial/_dist/worker.py Outdated Show resolved Hide resolved
src/twisted/trial/_dist/worker.py Outdated Show resolved Hide resolved
All reporting results must have happened by the time `suite.run` returns so
there's no reason to process them inside the context manager.  And processing
them in the context manager means that if any code somehow starts a _new_
reporting operation the list we passed to DeferredList will be mutated (and
presumably then ignore).  Ending the context manager turns that case into a
hard error, instead.
@exarkun exarkun merged commit a5127a5 into twisted:trunk Sep 16, 2022
@exarkun exarkun deleted the 10314.disttrial-error-handling branch September 16, 2022 17:12
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.

Failure: twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error
3 participants