3 ms·
If you could provide example code for how to do this - how to run a snippet of untrusted Python code using wasmtime-py with a CPU and RAM limit - I would shout
by simonw 4y ago
If you could provide example code for how to do this - how to run a snippet of untrusted Python code using wasmtime-py with a CPU and RAM limit - I would shout it from the rooftops. I think a LOT of people would benefit from clear examples of how to actually achieve this.
- phickey 4y agoThe wit-bindgen work required would be a significant undertaking (a week? more?) by someone who already has some expertise in wit & python. Maybe the wasmlabs folks are up for taking it on. In general the Wasm Component ecosystem is still a few months away from being generally useful. There are a lot of people across the bytecode alliance working on the fundamentals right now, and we are making great progress, but its not ready to ship quite yet.
- iampims 4y agois this close to what you had in mind? https://gist.github.com/pims/711549577759ad1341f1a90860f1f3a5 https://gist.github.com/pims/711549577759ad1341f1a90860f1f3a...
- simonw 4y agoYes! Very much so. Just tried this and it works great! I changed app.py to this: import sqlite3 print(sqlite3.connect(":memory:").execute( "select sqlite_version()" ).fetchone()[0]) And it output "3.39.2" - but the same code in my regular Python interpreter output "3.40.1", which demonstrates that the WASM Python there has its own WASM-compiled SQLite.
- iampims 4y agoGreat! I still need to look into how to limit memory consumption. Fuel works well enough for now, but there might be an option to limit execution by time, not just instructions.