Widget updates appear blocked by python until process in complete in deployed app

Hi there! I have a text status bar that I’d like to update during a long compute. If I view the app in Jupyter, the updates to the status bar happen as python progresses through the code. If I deploy that app, the updates are blocked and are not visible until the python process is complete. I’m trying to understand why.

Here is a reproducible example:

import panel as pn
import param
import time

pn.extension()

class TestPanel(param.Parameterized):

    def __init__(self, **params):
        self.status_text = pn.widgets.StaticText(name='Status', value='Click "Evaluate"')
        self.evaluate_button = pn.widgets.Button(name='Evaluate', button_type='warning')
        self.evaluate_button.on_click(self.run_evaluate)
        super().__init__(**params)

    def run_evaluate(self, event=None):
        self.status_text.value = 'start'
        time.sleep(3)
        self.status_text.value = 'continuing'
        time.sleep(3)
        self.status_text.value = 'end'

    def panel(self):
        return pn.Column(self.status_text, self.evaluate_button)
 
app = TestPanel()
app.panel().servable()

Any ideas what is happening or what I can do to fix it?

I can’t seem to reproduce; what version of Panel do you have?

Panel 1.4.1

I’m deploying it through a new JupyterHub App Launcher that we’ve been developing. Its possible that there are some settings there that are causing this. These are the args we’re using:

        args=[
            "--destport=0",
            TString("--conda-env=$conda_env"),
            TString("$python_exec"),
            "{-}m",
            "bokeh_root_cmd.main",
            TString("$filepath"),
            "{--}port={port}",
            "{--}debug",
            TString("{--}allow-websocket-origin=$origin_host"),
            "{--}server=panel",
            TString("{--}prefix=$base_url"),
            "--ip=0.0.0.0",
            "--ready-check-path=/ready-check",
            f"--ready-timeout={READY_TIMEOUT}",
        ]

Can you see if you can reproduce locally on your machine (or another machine)?

Confirmed that I don’t see this behavior on my local machine with panel serve .... Apologies for the distraction! I will continue the investigation with the specific way we are deploying. Thank you @ahuang11 !

1 Like

No worries. Thanks for sharing!

Interesting… just realized that using the “Panel Preview” button in Jupyter also gives the same blocking behavior. I admittedly don’t know what where that button is managed to go check out what commands its running.