Option to use https://github.com/joblib/loky instead of the default run.cpu_bound ProcessPoolExecutor #5574
ehfd
started this conversation in
Ideas / Feature Requests
Replies: 2 comments 3 replies
-
|
Good idea! Let's pick up #4708 ? |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Very interesting! import asyncio
import time
from nicegui import run, ui
def wait():
time.sleep(1.0)
async def launch():
start = time.perf_counter()
await asyncio.gather(*[run.cpu_bound(wait) for _ in range(10)])
print(f'All done in {time.perf_counter() - start:.2f} s')
@ui.page('/')
def page():
ui.button('launch', on_click=launch)
if __name__ in {'__main__', '__mp_main__'}:
print('running main')
ui.run()Maybe loky solves this problem as well? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
https://github.com/joblib/loky allows the serialization of non-pickleable functions or objects and then offloading them by using
cloudpicklefor non-pickleable objects. This could be an optional dependency to activate.Requires:
lokyandpsutil.Example:
Beta Was this translation helpful? Give feedback.
All reactions