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

Python and JavaScript Variable Translation Errors in Colab #49

Open
Jonah1234567 opened this issue Jun 24, 2022 · 2 comments
Open

Python and JavaScript Variable Translation Errors in Colab #49

Jonah1234567 opened this issue Jun 24, 2022 · 2 comments
Labels
bug Something isn't working cache Relates to variable hashing during sync javascript Relates to JavaScript or Node.js code pipes Relates to interprocess streaming python Relates to Python code shared memory Relates to interprocess memory mapping

Comments

@Jonah1234567
Copy link

Jonah1234567 commented Jun 24, 2022

When trying to convert between python and JS in Google Colab, I ran into some unexpected errors. It seems that Bifrost would only allow for a one time conversion from a node to python variable. The same different code snippets would produce different results on consecutive runs.
image
image (1)

I suspect the reason for this is that the import for bifrost isn't reset every time and the JS variable is then taken by bifrost so it cannot be used again. Ran on node 14.19.3, Python 3.7.13 and Bifrost 0.5.12.

In addition, Python variables changed in JS would not always "change" to the expected value when printed in Python afterwards, although I suspect these two errors are related and caused by the same underlying issue or at least similar issues.

@Jonah1234567
Copy link
Author

const and let don't work with local python and no descriptor works but only because that actually defaults to var

@ccmcintyre-kingsds ccmcintyre-kingsds added python Relates to Python code javascript Relates to JavaScript or Node.js code bug Something isn't working labels Jul 5, 2022
@ccmcintyre-kingsds ccmcintyre-kingsds self-assigned this Jul 5, 2022
@ccmcintyre-kingsds ccmcintyre-kingsds added the shared memory Relates to interprocess memory mapping label Jul 5, 2022
@ccmcintyre-kingsds
Copy link
Contributor

@Jonah1234567
Took a bit for this issue as described to really click for me, but I've run through your tests and a number of variations on them, while studying the py_storage.py sync code; I finally see what you're saying, and I've identified what's going on. It's more insidious and wider-spread than I anticipated (the behaviour you observed even occurs when using the %%node cell magic in notebooks+colabs, which is written to explicitly sync all variables in the top-level scopes; definitely problematic, if it's missing things like this). Thank you for raising attention to the problem; this one was otherwise far too easy to overlook.

@ccmcintyre-kingsds ccmcintyre-kingsds added cache Relates to variable hashing during sync pipes Relates to interprocess streaming labels Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cache Relates to variable hashing during sync javascript Relates to JavaScript or Node.js code pipes Relates to interprocess streaming python Relates to Python code shared memory Relates to interprocess memory mapping
Projects
None yet
Development

No branches or pull requests

2 participants