You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to write a python program to run wasm file with Wasmer Python SDK. Here is my source code of wasm file:
use std::fs::OpenOptions;use std::io::{Write};use std::thread::sleep;use std::time::{Duration,SystemTime};use rand::Rng;use chrono::TimeZone;#[no_mangle]fnmain(){println!("Begin");loop{let content = get_content();append_to_file("file.txt",&content);sleep(Duration::from_secs(10));}}fnappend_to_file(filename:&str,content:&str){let file = OpenOptions::new().write(true).append(true).create(true).open(filename).expect("Failed to open file for appending");letmut file = std::io::BufWriter::new(file);writeln!(file,"{}", content).expect("Failed to write to file");println!("log: {}", content);}fnget_content() -> String{let timestamp = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).expect("Failed to get timestamp").as_secs();let formatted_timestamp = chrono::Utc.timestamp(timestamp asi64,0).to_string();let random_number = rand::thread_rng().gen_range(0..100);format!("{} {}", formatted_timestamp, random_number)}
And I compile it to wasm file with the command:
cargo build --target wasm32-wasi --release
When I run it with wasmer run cronjob.wasm, it works well:
$ wasmer run cronjob.wasm
Begin
log: 2024-12-29 15:49:34 UTC 38
log: 2024-12-29 15:49:44 UTC 81
...
But when I use the Python SDK, it fails with this panic:
$ python bench.py
Begin
log: 2024-12-29 13:57:53 UTC 17
thread '<unnamed>' panicked at 'not implemented: Polling not implemented for clocks yet', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmer-wasi-2.1.1/src/syscalls/mod.rs:2388:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
File "bench.py", line 42, in<module>instance.exports._start()
pyo3_runtime.PanicException: not implemented: Polling not implemented for clocks yet
Hello, thanks for the report. We think that the issue might be that the Python SDK has not been updated in a while. We have plans to update it, and I'll mention it in this issue once we get it done.
Hello, thanks for the report. We think that the issue might be that the Python SDK has not been updated in a while. We have plans to update it, and I'll mention it in this issue once we get it done.
Thanks for replying. I am looking forward to it :)
I am trying to write a python program to run wasm file with Wasmer Python SDK. Here is my source code of wasm file:
And I compile it to wasm file with the command:
When I run it with
wasmer run cronjob.wasm
, it works well:But when I use the Python SDK, it fails with this panic:
And here is my
bench.py
:Is there something wrong with the Python SDK?
The text was updated successfully, but these errors were encountered: