Closed falkoschindler closed 2 months ago
I just merged this PR with the new implementation #150 and successfully tested with the following demo:
from nicegui import ui
import rosys
@rosys.analysis.track
async def short():
await rosys.sleep(0.25)
@rosys.analysis.track
async def long():
await rosys.sleep(0.75)
@rosys.analysis.track
async def run() -> None:
await rosys.automation.parallelize(short(), long())
automator1 = rosys.automation.Automator(None, default_automation=run)
automator2 = rosys.automation.Automator(None, default_automation=run)
rosys.automation.automation_controls(automator1)
rosys.automation.automation_controls(automator2)
rosys.analysis.track.ui()
ui.run()
Similar to NiceGUI's slot stacks, this PR implements separate
@track
stacks per task ID. Originally this was meant to solve issue #147, but it turned out that parallelized coroutines share the same task ID. Nevertheless, this PR should prevent the track stack from getting scrambled when calling tracked coroutines from different tasks, e.g. by clicking UI buttons.