Public release release-be1f654ae8de
Source commit: be1f654ae8de7d5eeb2005b4e1a05bf1ebf3124f Public tree identity: sha256:ab53679496be4be7d1e02bc00723072774d1a3f87e10cc56558a752f28f6abb1
This commit is contained in:
commit
a6ca9e26dd
210 changed files with 78671 additions and 0 deletions
33
examples/launch-build-demo/src/bin/sdk-product-runtime.rs
Normal file
33
examples/launch-build-demo/src/bin/sdk-product-runtime.rs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
use std::error::Error;
|
||||
|
||||
use futures_executor::block_on;
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let handle = block_on(
|
||||
clusterflux::spawn::task_with_arg(41_i32, |_| -> i32 {
|
||||
panic!("product-mode spawn invoked its local Rust closure")
|
||||
})
|
||||
.task_id("task_add_one")
|
||||
.name("SDK product Wasmtime task")
|
||||
.env(clusterflux::env!("linux"))
|
||||
.start(),
|
||||
)?;
|
||||
let task_spec = handle
|
||||
.task_spec()
|
||||
.cloned()
|
||||
.ok_or("CLUSTERFLUX_SDK_COORDINATOR did not enable product runtime")?;
|
||||
let virtual_thread_id = handle.virtual_thread_id();
|
||||
let result = block_on(handle.join())?;
|
||||
|
||||
println!(
|
||||
"{}",
|
||||
serde_json::to_string(&serde_json::json!({
|
||||
"kind": "clusterflux-sdk-product-runtime",
|
||||
"virtual_thread_id": virtual_thread_id,
|
||||
"task_spec": task_spec,
|
||||
"remote_result": result,
|
||||
"local_function_invoked_by_spawn": false,
|
||||
}))?
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue