You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation for integrating async functions use loop.run_until_complete. This function runs the event loop until the result from the coroutine is done and then halts the execution of the event loop. This causes any scheduled coroutines to to also halt execution. This is not too bad because every time you run another coroutine, the execution resumes, but this is not ideal.
The idea is to maintain current behaviour when executing async functions, but when the coroutine finishes, the loop somehow continues to execute in the background. This way, the coroutines scheduled are not blocked by the main thread.
I have an implementation that i think could solve this issue. It starts a thread that runs the event loop in the background when robot is executing normal keywords. If the keyword is async, this threads stops and robot runs as usual, once the result is done we start another thread and repeat the process.
Unfortunally, this is still not truly parallel execution because threads in python have the GIL and event loops cannot be serialized for us to use multiprocessing, i tried but didn't succeed. Nevertheless any IO bound code will not halt the execution of the event loop anymore, this includes functions like sleep not blocking coroutines.
The text was updated successfully, but these errors were encountered:
The current implementation for integrating async functions use loop.run_until_complete. This function runs the event loop until the result from the coroutine is done and then halts the execution of the event loop. This causes any scheduled coroutines to to also halt execution. This is not too bad because every time you run another coroutine, the execution resumes, but this is not ideal.
The idea is to maintain current behaviour when executing async functions, but when the coroutine finishes, the loop somehow continues to execute in the background. This way, the coroutines scheduled are not blocked by the main thread.
I have an implementation that i think could solve this issue. It starts a thread that runs the event loop in the background when robot is executing normal keywords. If the keyword is async, this threads stops and robot runs as usual, once the result is done we start another thread and repeat the process.
Unfortunally, this is still not truly parallel execution because threads in python have the GIL and event loops cannot be serialized for us to use multiprocessing, i tried but didn't succeed. Nevertheless any IO bound code will not halt the execution of the event loop anymore, this includes functions like sleep not blocking coroutines.
The text was updated successfully, but these errors were encountered: