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

Asynchronously process updates when running in Tornado #838

Merged
merged 14 commits into from
Dec 11, 2019
Merged

Conversation

sc1f
Copy link
Contributor

@sc1f sc1f commented Dec 7, 2019

This PR contains an integration between perspective-python and the Tornado event loop, namely allowing Perspective to call _process on updates (an expensive operation) asynchronously.

When using PerspectiveTornadoHandler, the default queue_process method is replaced with a version that uses tornado.ioloop.IOLoop.current(), and the _process call becomes a callback for the next loop iteration.

This should also allow for deeper integration with other event loop structures, which would implement their own version of queue_process, and then call _set_queue_process on an instance of PerspectiveManager. The tables under management (and future tables hosted on the manager instance) will now call the custom queue_process method. This structure also allows for manager instances that use the event loop and other instances that do not use the event loop all in the same runtime.

Various tests have been added for the async functionality.

@sc1f sc1f added enhancement Feature requests or improvements Python labels Dec 7, 2019
Copy link
Member

@texodus texodus left a comment

Choose a reason for hiding this comment

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

Reviewed offline - Looks good!

@texodus
Copy link
Member

texodus commented Dec 11, 2019

Thanks for the PR!

@texodus texodus merged commit eaabd8b into master Dec 11, 2019
@texodus texodus deleted the py-event-loop branch December 11, 2019 23:07
@texodus texodus added bug Concrete, reproducible bugs and removed enhancement Feature requests or improvements labels Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Concrete, reproducible bugs Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants