Hello,
I am working on a small panel app to show me the status of a supercomputer scheduling queue. I’d like to allow the user to push a button to get new information. So far, I have this:
import panel as pn
import pandas as pd
import fabric
pn.extension()
header = pn.Pane("# Monitoring for `LIG-T`")
def get_queue():
    print("Updating queue!")
    stan = fabric.Connection("stan1.awi.de")
    result = stan.run("qstat -l", hide=True)
    titles = result.stdout.split()[:14]
    values = result.stdout.split()[14+14:]
    queue_dict = {title: value for title, value in zip(titles, values)}
    return pn.widgets.DataFrame(pd.DataFrame.from_dict(queue_dict, orient="index").transpose())
def get_progressbar():
    print("Updating progressbar!")
    stan = fabric.Connection("stan1.awi.de")
    with stan.cd("/ace/user/pgierz/cosmos-aso-wiso/LIG-T/scripts"):
        result = stan.run("cat *date", hide=True)
        date, run_number = result.stdout.split()
        start_year = 2698
        year = int(date[:4]) - start_year
        progress = year / (6699 - start_year) * 100
        return pn.Row(str(round(progress, 2)) + "%", pn.widgets.Progress(value=round(progress)))
def run_both(event):
    queue = get_queue()
    progress_bar = get_progressbar()
button = pn.widgets.Button(name='Update', button_type='primary')
button.on_click(run_both)
progress_bar = get_progressbar()
queue = get_queue()
gspec = pn.GridSpec(sizing_mode='stretch_both', max_width=1000)#, max_height=800)
gspec[0, 0] = header
gspec[1, 0] = button
gspec[2, 0] = progress_bar
gspec[3, 0] = queue
gspec.servable()
#gspec
So far, so good. I get a panel app that displays what I want: the progress of my simulation, and the current supercomputer queue. I can then serve this with:
$ panel server <notebook_name>
Pushing the button also gives me a printout in my terminal, so I know the functions are running. However, the data frame and progress bar don’t change – for the progress bar I can understand, this simulation will take several weeks to finish, so I won’t see a percent jump every time I click. However, one part of the queue data frame is the elapsed time of the job, in seconds. This should definitely change when I push the button.
What am I doing wrong?
 However, that change yields the following:
 However, that change yields the following: