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

Better handling of exceptions in children, especially for threads. Ad… #27

Merged
merged 2 commits into from
Feb 2, 2017

Conversation

jamadden
Copy link
Member

@jamadden jamadden commented Feb 2, 2017

…d unittests for this. Fixes #26.

@coveralls
Copy link

coveralls commented Feb 2, 2017

Coverage Status

Changes Unknown when pulling c954c74 on thread-hang into ** on master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 9943a97 on thread-hang into ** on master**.

@@ -11,7 +11,8 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Multiprocessing utilities.
"""
Copy link
Member

Choose a reason for hiding this comment

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

Technically, this is a PEP 8 violation.

Suggest adding a backsplash.

Copy link
Member Author

Choose a reason for hiding this comment

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

I prefer the Django convention which doesn't require an opening sentence to be beside the quotes.

Copy link
Member

Choose a reason for hiding this comment

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

I guess PEP 257 allows that.

def run_in_child(func, strategy, *args, **kw):
"""Call a function in a child process. Don't return anything.
def run_in_child(func, strategy, *args, **kwargs):
"""
Copy link
Member

Choose a reason for hiding this comment

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

ditto and ditto for other cases :)

"process running %r failed with exit code %d" % (func, p.exitcode))
Process, Queue = strategies[strategy]

queue = Queue()
Copy link
Member

Choose a reason for hiding this comment

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

Should this Queue be used for the child queue?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, that's the parent_queue (for communication to the parent). There is no child queue (communication to the child) because these functions have never been allowed to call sync (which is where the child queue would be used).

Copy link
Member

Choose a reason for hiding this comment

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

I don't see where the global Queue used by Child.init is defined. I must have missed it.

Copy link
Member Author

Choose a reason for hiding this comment

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

The subclass SynclessQueue that we use here passes in a dummy function for that argument.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 257b832 on thread-hang into ** on master**.

2 similar comments
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 257b832 on thread-hang into ** on master**.

@coveralls
Copy link

coveralls commented Feb 2, 2017

Coverage Status

Changes Unknown when pulling 257b832 on thread-hang into ** on master**.

@jimfulton
Copy link
Member

I just did a quick drive by. I need to understand how this works a lot more to do more of a review and I don't have time for that atm.

@jamadden
Copy link
Member Author

jamadden commented Feb 2, 2017

Thanks for your comments!

In empirical testing, this solves the hanging problems I experienced in #26, and it has tests, so I'm happy enough with it to merge (once I actually turn on coverage for the new tests :/)

@coveralls
Copy link

coveralls commented Feb 2, 2017

Coverage Status

Changes Unknown when pulling b06f9a4 on thread-hang into ** on master**.

@jamadden jamadden merged commit 0cebd69 into master Feb 2, 2017
@jamadden jamadden deleted the thread-hang branch February 2, 2017 18:43
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