-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add PerspectiveManager remote API for Python, Tornado server example #743
Conversation
…xample tornado server
Codecov Report
@@ Coverage Diff @@
## master #743 +/- ##
==========================================
- Coverage 93.36% 91.32% -2.05%
==========================================
Files 61 63 +2
Lines 2970 3169 +199
==========================================
+ Hits 2773 2894 +121
- Misses 197 275 +78
Continue to review full report at Codecov.
|
Thanks for the PR! Looks great! |
import pandas as pd | ||
import sys | ||
import os | ||
sys.path.insert(1, os.path.join(sys.path[0], '..')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wouldnt do this
# call the underlying method on the Table or View | ||
getattr(table_or_view, method)(callback, *msg.get("args", [])) | ||
else: | ||
print("callback not found for remote call {}".format(msg)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid prints, use logging if you want to print
if msg["cmd"] == "view_method": | ||
del self._views[msg["name"]] | ||
except Exception as error: | ||
print(self._make_error_message(msg["id"], error)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove print
else: | ||
print("callback not found for remote call {}".format(msg)) | ||
except Exception as error: | ||
print(self._make_error_message(msg["id"], error)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove print
This PR adds the PerspectiveManager class, which parses JSON messages from a client perspective and allows for operations in perspective-python on a dataset in python memory, streamed through a WebSocket to a client perspective operating in the browser.
This configuration is not subject to browser memory constraints or the 2GB WebAssembly memory limit, and takes advantage of TBB for parallel processing on the server side. Configuration has been tested locally with 10 million rows, streamed with zero lag to the browser.
Additionally, this has the side benefit of allowing us to serve dataframes and Numpy array-based datasets to the client through the python API.