wasm is an EXPERIMENTAL simple example that loads and executes a wasm file function. greet.wasm, Cargo.toml and greet.rs were copied from the example provided by the wazero library: https://github.com/tetratelabs/wazero/blob/v1.0.0-pre.3/examples/allocation/rust/greet.go
To run this example in various runners, the following assumes:
OUTPUT=<path to output i.e. /tmp/example/output> git clone https://github.com/apache/beam BEAM_HOME=$(pwd)/beam cd $BEAM_HOME/sdks
To execute this example on the local runner:
go run ./go/examples/wasm --output=$OUTPUT
The following describes how to execute this example on the flink portable runner.
The example below shows Google Cloud Storage.
OUTPUT=gs://<my bucket>/greet
cd $BEAM_HOME ./gradlew :runners:flink:properties --property flink_versions
Expected output should include the following, from which you acquire the latest flink runner version.
'flink_versions: 1.17,1.18,1.19'
FLINK_VERSION=1.16
cd $BEAM_HOME ./gradlew :runners:flink:$FLINK_VERSION:job-server:runShadow
Note the JobService host and port from the output, similar to:
INFO: JobService started on localhost:8099
JOB_SERVICE=localhost:8099
cd $BEAM_HOME/sdks go run ./go/examples/wasm --runner=universal --endpoint=$JOB_SERVICE --output=$OUTPUT --environment_config=apache/beam_go_sdk:latest
The following describes how to execute this example on Dataflow.
The example below shows Google Cloud Storage.
OUTPUT=gs://<my bucket>/greet
PROJECT=<project id> REGION=<region> STAGING=gs://<my bucket>/staging NETWORK=<network> SUBNETWORK=regions/$REGION/subnetworks/<subnetwork>
cd $BEAM_HOME/sdks go run ./go/examples/wasm --runner=dataflow --output=$OUTPUT --environment_config=apache/beam_go_sdk:latest \ --project=$PROJECT --region=$REGION --network=$NETWORK --subnetwork=$SUBNETWORK --staging_location=$STAGING