Comments (9)
Thanks for the report. I'll look into but as a quick aside:
For deploying I have downloaded the notebook as a python file and edited Test().show() to Test().show().server_doc().
This shouldn't be necessary, you can have the "app" work both in the notebook and on bokeh server by using Test().show().servable()
. That will render in a notebook and work when you use panel serve notebook.ipynb --show
.
Also when you want to test bokeh server from a notebook you could do Test().show().show()
from panel.
Okay, so this is a pretty central part of how bokeh server works, changing a parameter value will schedule a so called next_tick_callback
, which won't be processed while the "heavy_calculation" is being processed. Ordinarily you could also schedule the calculation as a next_tick_callback and we could consider exposing that mechanism in an easy way. However it would of course be a lot nicer if we could somehow make the naive approach work, I'll have to read a bit more about tornado and bokeh server to see if that's feasible.
from panel.
Thank you very much for looking into all of the issues. For me personally either way is fine, if it is too hard to make it work the naive way, I can try with the next_tick_callback.
(But I have to look into how this works)
from panel.
@MHC03 So there's probably nothing we can do automatically, however you can do it by using the tornado IOLoop, in your example you'd do something like:
def _button_click(self, clicks):
self.txt.value = 'Start heavy calculation...'
ioloop = tornado.ioloop.IOLoop.current()
ioloop.add_callback(self._heavy_calculation)
def _heavy_calculation(self):
heavy_calculation()
self.txt.value = 'Heavy calculation finished.'
from panel.
For me the above approach does not fully work, the second change to the textinput value does not occur. It is stuck with 'Start heavy calculation...'. If I change the code to following it works in a server but not in a Jupyter Notebook as intended:
def _button_click(self, clicks):
self.txt.value = 'Start heavy calculation...'
ioloop = tornado.ioloop.IOLoop.current()
ioloop.add_callback(heavy_calculation)
self.txt.value = 'Heavy calculation finished.'
With this I get the expected behaviour in a server, in a Jupyter Notebook it directly jumps to the last line without waiting for the callback to finish. If I have several heavy calculations it gets a bit more complicated through this method.
from panel.
This code would be a bit less confusing if you changed your show() method to view(), to avoid confusion with Panel's .show() method.
from panel.
For me the above approach does not fully work, the second change to the textinput value does not occur. It is stuck with 'Start heavy calculation...'.
Yeah, it's not quite clear to me what's going on here, it's definitely not working right in this case but I've used it successfully in other examples.
from panel.
This code would be a bit less confusing if you changed your show() method to view(), to avoid confusion with Panel's .show() method.
Changed it, maybe @philippjfr can also edit his comment.
Yeah, it's not quite clear to me what's going on here, it's definitely not working right in this case but I've used it successfully in other examples.
I will try some workaround with the ioloop callback for now. Thanks a lot for looking into this stuff.
from panel.
Thanks a lot for looking into this stuff.
No problem, I'm encountering the same issues so this is fairly high priority. Still searching for a better solution, but my knowledge of tornado is lacking a bit.
from panel.
Related Issues (20)
- ChatInterface is broken on 1.3.7rc2 HOT 4
- vtkvolume minimal test multiple javascript errors in browser, no render
- Not clear from Reference Documentation how TextAreaInput.resizable works HOT 1
- Multichoice options not visible with Slides template dark theme
- Add support for special blocks when panel serves a Markdown file HOT 1
- DEV Column refererence guide flickering HOT 2
- 1.3.7rc3 does not pick up cookies
- Enhance Jupyter Preview Error Message if notebook raise exception HOT 1
- Remove section anchor from Alerts HOT 1
- pn.pane.HiPlot
- pn.widget.DataFrame `autosize_mode` does not work inside a notebook HOT 2
- Replace Hamburger Icon with Chevron Icon for sidebar toggle functionality. HOT 8
- Panel._compute_sizing_mode not gracefully handling None HOT 1
- Can the panel preview tool be bundled with panel rather than pyviz_comms?
- Panel generator docs is missing
- Update docs to use the bound function as a reference
- pn.widgets.DatetimePicker: Allow only valid dates and times to be displayed! HOT 2
- pn.widgets.DatetimePicker: Allow specification of enabled datetimes as iterables with datetime64
- Feature Request: Access label of "select-like" elements through property HOT 3
- Custom template don't work anymore
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from panel.