Skip to content
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

loading spinner of pn.panel(..., defer_load=True) stops spinning when async function starts executing #4241

Open
MarcSkovMadsen opened this issue Dec 27, 2022 · 0 comments
Labels
async type: bug Something isn't correct or isn't working
Milestone

Comments

@MarcSkovMadsen
Copy link
Collaborator

pn.panel==0.14.1

I'm digging more into async. I would like to be able to use Async to start my Panel app.

I believe it would be very natural that the content of your dashboard layout consists of some async functions. And that you show a loading_indicator while those functions are running.

What I see in practice though is that the loading spinner stops spinning when the function starts executing and not when it finishes.

2022-12-27-15-57-09

import asyncio
import time

import panel as pn

pn.extension()

def view():
    time.sleep(1)
    return "view"

def view2():
    time.sleep(1)
    return "view2"

async def view_async():
    await asyncio.sleep(1)
    return "view_async"

async def view_async2():
    await asyncio.sleep(1)
    return "view_async2"

pn.panel(view, defer_load=True).servable()
pn.panel(view_async, defer_load=True).servable()
pn.panel(view2, defer_load=True).servable()
pn.panel(view_async2, defer_load=True).servable()

Bonus

If the async functions could be scheduled such that the combined duration is 1 sec and not 1 sec + 1 sec that would also be great.

@MarcSkovMadsen MarcSkovMadsen added type: bug Something isn't correct or isn't working async labels Dec 27, 2022
@MarcSkovMadsen MarcSkovMadsen added this to the next milestone Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
async type: bug Something isn't correct or isn't working
Projects
None yet
Development

No branches or pull requests

1 participant