-
Notifications
You must be signed in to change notification settings - Fork 76
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
@manipulate
sometimes doesn't create the Comm link successfully
#115
Comments
Try this in the second cell:
Basically, the If the Changing the In your code, the result of the cell was just a plot ( |
Sorry, I didn't realise PlotlyJS handles its own comms and syncing. I assumed it was relying on Interact for that. My code above (where Interact basically outputs an entirely new plot each time the slider is changed) does actually work both before and after refresh, but it's less smooth than when you use PlotlyJS's own sync. In any case, this warrants further investigation. There seem to be two possibly related issues here:
N.b. Re-running the cell in your code with the Also, having the Cell 2:
Cell 3:
Curiously, this also works:
Seems to me they're both more likely to be bugs in PlotlyJS than in Interact, since HTH, sorry again for the earlier misunderstanding. |
One other thing, this is basically what the
It doesn't work, but without the Edit (after garbage collection thoughts, see comment below): actually it doesn't work for me without the
|
Thought about issue 1) some more, and (ignoring the There are lots of ways to work around this issue, you could
Having said that I think there's a strong argument to be made to make
|
Hey @JobJob that makes more sense to me. I believe the issues @ssfrr talked about were with What I've always done that seems to make it work is:
The key is to I've never had an issue that way -- not sure if that fits in well with your diagnosis or not. |
Yeah, I think the reason that's working is only because the Try this:
Also, I've realised that some other things I thought were working earlier mentioned above, either don't work every time, or break when you call So yeah, seems that GC is the problem here with issue 1. I think the issue with the comms on refresh is to do with the global |
Thanks or the PR! I'm not totally sure I understand how that PR is different in practice than what I had. It seems to me that what I had created one Comm when the julia code I believe that what is in that PR creates a Comm whenever the Julia code Either way, the Comm is only created after the user asks the Julia kernel to execute some code. Does interact on its own (i.e. just interacting with a julia expression) work between page refreshes? I would think that the behavior or "pure" Interact.jl Comms or the PlotlyJS.jl Comm(s) should be identical and described by: whenever the gc runs to clear out Julia-side Comms kept in the kernel -- e.g. maybe (? not sure) on page refresh -- the user needs to re-execute the code that created the Comm. |
See JuliaGizmos/Interact.jl#115 for more context
See JuliaGizmos/Interact.jl#115 for more context
Firstly, just to clarify, the use case that the (new and old) PRs fix is:
refresh page, then run cell again. This issue is not related to issue 1) above and GC. It is simply caused by the fact that on page refresh the Jupyter front end clears all registered comms, so the The original PR was slightly more complicated because I had an error in the test case I was using. I thought just updating the global Comm on each call to Anyway, have made a new PR, much simpler. It just creates a new global Comm every time |
I'm glad you have seemed to figured out a fix. FWIW I can't reproduce Spencer's initial failure on Jupyter 4.2.3 + latest Interact |
does this work for you when you move the slider?:
|
Yes, just fine. |
See JuliaGizmos/Interact.jl#115 for more context
Even with the Does it work for you @spencerlyon2 ? I'm also on Jupyter 4.2.3 and Interact master with Julia 0.5.0. I was pretty sure that the signal created by the |
your guess should be correct. I did copy-paste the same code you posted and it works... |
It works, and the plot updates when you move the slider? |
yes |
wow, ok... confusing |
julia 0.5.0 ? |
Eek, wait. I'm so sorry I was trying it without gc. With gc(), sure enough it doesn't work. |
whew :) |
@shashi How do you feel about changing
That way people using |
So, I think it's reasonable to make
Only problematic situation is when you have something like ticks = fps(60) in one cell @manipulate for t=ticks, x=1:100
...
end in another. As opposed to @manipulate for t=fps(60), x=1:100
...
end But this is almost never used |
Right, you're saying that won't get gc'd because of the reference to |
Stops issues with manipulate signals being garbage collected when they go out of scope. Fixes JuliaGizmos#115
Stops issues with manipulate signals being garbage collected when they go out of scope. Fixes JuliaGizmos#115
I have a notebook with one cell:
and another:
I think in the past this used to work, but right now when I run both cells the first time, the sliders don't update the plot. After I refresh the page and re-run the 2nd cell, I get a bunch of this error in the javascript console:
If I use
display(p)
before@manipulate
(instead of returningp
from the cell) it seems to work.In talking to @spencerlyon2 one theory is that it's trying to create a Comm link before the plot has been rendered. I think it's OK if this isn't supported and the user should always
display
the plot first, but if possible@manipulate
should throw an error telling the user that it couldn't talk to the plot, and maybe guiding them todisplay
it first.The text was updated successfully, but these errors were encountered: