Skip to content
Discussion options

You must be logged in to vote

Summarize the knowledge learned.
Starting multiple logics that require a long computation time can be written as follows: the starting entry needs to be asynchronous, while the computation logic does not require it.
for example:

from nicegui import run, ui
async def start():
    await run.io_bound(long_term_calculation_1)
    await run.io_bound(long_term_calculation_2)
    await run.io_bound(long_term_calculation_3)
......

def long_term_calculation_1():
    '''your_code'''
    ......

def long_term_calculation_2():
    '''your_code'''
    ......

def long_term_calculation_3():
    '''your_code'''
    ......

When executing the start function, the program waits for each step to be complete…

Replies: 3 comments 10 replies

Comment options

You must be logged in to vote
10 replies
@rodja
Comment options

rodja Sep 4, 2024
Maintainer

@mxiaonian
Comment options

@rodja
Comment options

rodja Sep 4, 2024
Maintainer

@falkoschindler
Comment options

@mxiaonian
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by mxiaonian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants