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

Fix @track decorator when used with parallelize() #150

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

falkoschindler
Copy link
Contributor

This PR replaces the stack list with a dictionary, mapping a unique ID to function names. After running the function, we don't pop the last function name, but delete the item with the respective ID from the dictionary. Since Python dictionaries preserve their item's order, we can simply display the current state by joining all dictionary values.

Has been successfully tested with the code snippet from #147 (comment).

@falkoschindler falkoschindler added the bug Something isn't working label Jul 17, 2024
@falkoschindler falkoschindler added this to the 0.11.0 milestone Jul 17, 2024
@falkoschindler falkoschindler linked an issue Jul 17, 2024 that may be closed by this pull request
@NiklasNeugebauer
Copy link
Contributor

NiklasNeugebauer commented Jul 17, 2024

Isn't the UI confusing then?

The following would write: run → long → short → short
Even though the last short was called by long

from nicegui import ui
import rosys

@rosys.analysis.track
async def short():
    await rosys.sleep(2.0)

@rosys.analysis.track
async def long():
    await short()
    await rosys.sleep(2.0)

@rosys.analysis.track
async def run() -> None:
    await rosys.automation.parallelize(long(), short())

automator = rosys.automation.Automator(None, default_automation=run)

rosys.automation.automation_controls(automator)
rosys.analysis.track.ui()

ui.run()

@falkoschindler
Copy link
Contributor Author

Yes, the UI is far from optimal in this case. But that's how it has already been before. At least all items are correctly removed now, fixing issue #147.
We'll create a separate feature request for improving the UI for parallel coroutines.

@falkoschindler falkoschindler merged commit b66c965 into main Jul 17, 2024
5 checks passed
@falkoschindler falkoschindler deleted the track-parallelize branch July 17, 2024 09:57
@codingpaula
Copy link
Contributor

Feature Request: #151

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@track UI doesn't remove all coroutines when using parallelize()
3 participants