feat: bidirectional support#34
Conversation
| """ | ||
| # only one export can be done at a time to ensure that the references | ||
| # are correct | ||
| exporter.acquire() |
There was a problem hiding this comment.
Am going to move this to a context manager, although I wonder if I have a correct understanding that a TableListener can lead to a race condition. My understanding on how the java and python interact here is weak.
There was a problem hiding this comment.
Do you need a lock, and not just get the execution context?: https://deephaven.io/core/docs/conceptual/execution-context/#when-an-executioncontext-is-needed
There was a problem hiding this comment.
This lock may have been doing something else that is necessary. I'm getting fairly frequent deadlocks when plotting w/ the latest change. Usually on re-creating a figure, but have gotten it once on the first time I plotted something after a fresh server start
There was a problem hiding this comment.
Nevermind I was able to deadlock even building off the commit before the lock was removed
There was a problem hiding this comment.
I'm seeing those deadlocks too. I'm not sure where they're coming from. It seems to be the whole python interpreter that gets locked.
There was a problem hiding this comment.
@mattrunyon It might have been some figure locks I had that shouldn't also be needed. I removed them and there doesn't seem to be deadlocks any more.
I am still seeing odd behavior when switching between figure tabs. Is there any possibility when switching on and off a figure that there is some lingering data in the window that could mess up the new figure creation? As far as I can tell the proper updates are being sent.
There was a problem hiding this comment.
Pushed a fix for that stale data issue. Also fixed a double loader that appeared from some CSS changes to web-client-ui.
We'll need to update to non-beta packages on the next release to get TS fixes in for this. If there's no other issues w/ this PR though, could just ts-ignore the TS issue and fix it in a future PR when changing to a WidgetPlugin
|
Added JS bidirectional support. Looks like I need to rebase on main though. There are some issues w/ recreating a plot w/ the same name (i.e. run the same code twice in a row in the repl). There is an error printed to the user console because something is double closing I think and causing the error (no way to detect it's already been closed). This also seems to be an issue w/ our tables and charts, but it's a JS error/warning. Turns out in |
| @@ -1,6 +1,6 @@ | |||
| { | |||
| "name": "deephaven-js-plugins", | |||
| "lockfileVersion": 3, | |||
| "lockfileVersion": 2, | |||
There was a problem hiding this comment.
@jnumainville I think you may be using the wrong version of npm. Run nvm install to use the correct version, and/or you can set up your environment to automatically switch: https://github.com/nvm-sh/nvm#deeper-shell-integration
There was a problem hiding this comment.
fixed I think?
| """ | ||
| # only one export can be done at a time to ensure that the references | ||
| # are correct | ||
| exporter.acquire() |
There was a problem hiding this comment.
Do you need a lock, and not just get the execution context?: https://deephaven.io/core/docs/conceptual/execution-context/#when-an-executioncontext-is-needed
|
something funky is going on with removing points, especially in a layer Example it almost seems like figures aren't being updated properly if you're not viewing them? |
|
@mattrunyon it seems like when I switch panels (from looking at one figure to not then back to looking at it) a new connection is set up but the old one is still there. Do you know how to stop that? here's an example of the resulting new references, old references, connection id (I see the wrong ids being removed too possibly? investigating that) code is in previous comment, but only ran figure 1 then switched off and back on the figure panel |
|
Everything seems to be working properly after Matt's fixes |
|
After discussion with Colin, the locks are something should be done, so I have added them back in. |
|
@mattrunyon I have (hopefully correctly) added the tables to the liveness scope |
|
@mattrunyon fixed #2 with an empty default figure in the partition case. code I used: |
| this.tableColumnReplacementMap.forEach((columnReplacements, tableId) => { | ||
| const tableData = this.tableDataMap.get(tableId); | ||
| if (tableData == null) { | ||
| // log.warn('No tableData for this event. Skipping update'); |
There was a problem hiding this comment.
I changed it to throw. It shouldn't ever happen, but if it does then there's probably some out of sync state or stale state laying around
Can change back to a warning if you think that's right. It doesn't cause an issue to ignore it, but the plot might not be correct if this case were to happen. Prefer error over showing potentially incorrect data?
There was a problem hiding this comment.
Yup error over showing incorrect.
There was a problem hiding this comment.
I need to fix something for initial loading actually with this. The chart is finished loading after the model initializes, but before the tables are fetched which leads to this throwing
There was a problem hiding this comment.
Ok I have changed this to throw and set an empty tableData when the table starts fetching (previously I set the data after the table was fetched). There could be states (like initial load) where the table is being fetched and doesn't have its data yet, so that's why I added the default empty tableData
The error should only throw if something bad happens or somehow gets out of sync. Mostly there so TS doesn't complain about the possibility of null
| // TODO: Add this back when JsWidget doesn't log a Python error when already closed | ||
| // This issue occurs when you recreate a plot in the REPL as the engine closes its side | ||
| // but the widget doesn't know and unsubscribe on panel unmount causes this close | ||
| // this.widget?.close(); |
There was a problem hiding this comment.
Is there a ticket already for this? I know Colin said he was going to fix it, but did it slide off his radar?
There was a problem hiding this comment.
I'm going to remove this comment and uncomment the code. Either way there's errors printed to the user's console, but I think once that bug is fixed this will be the correct way to do it
|
At this point I have resolved all bugs and comments I am aware of in the python side of the application |
|
I believe the JS side has any known issues fixed as well |
Fixes #2
Adds python support for bidirectional communication and updating of plots with plot bys.
Tested with Matt's front-end changes (and will need to be merged with those).
Simple example plot:
Also has some miscellaneous cleanup and refactoring.