Conversation
…alize the output of the run method, which is currently still a python dict
…et stuck on TypeError: model.get_component_name is not a function
…ugly hack: serializing python output and parsing it again in ts
Member
Author
|
Alternatively could keep BMI in ts and only CLASS in Python. Pro: comlink wraps ts object instead of pyodide. Con: more communication across pyodide boundary; Python BMI not self-sufficient (but is that necessary?) |
5 tasks
Member
Author
|
Perhaps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've been playing around to try and run python code from the web application. As such, we could have an analogous implementation in Python and use the nice web application to manage and analyse our experiments.
There are multiply ways to achieve this:
Advantage: easy (?!), actual python code is being executed
Disadvantage: long load time as it needs to initialize the full pyodide environment (though only inside the web worker)
Advantage: easy and fast, code can be optimized during build
Disadvantage: for the purpose of "proof of concept", this is not much different than just writing js/ts directly
Advantage: skips the overhead of loading pyodide and interpreting the python code; could scale to larger models and then be more efficient than js/ts
Disadvantage: more challenging, would make more sense with more performance oriented libraries like Rust or C++
I decided to try the first option. Some notes
runmethod only, instead of the full BMI with all controlsI tried several approaches that go me almost there. Finally I managed to forward model output through comlink, but only through serialization on the python side and deserialization on the ts side. Then, comlink will do something similar again. How (un)desireable is that?
This PR still needs some work to reconcile the best elements of the different approaches I've tried and end up with a fully working version.