Examples
Proplet Plugin Example
Example of a proplet-side lifecycle plugin
This example demonstrates a proplet-side plugin using the propeller-proplet-plugin-sdk. Unlike manager plugins (which run in the manager process), proplet plugins run inside the proplet and hook into the task lifecycle at the point of execution.
The plugin exports four lifecycle hooks:
authorize— deny tasks with an empty nameenrich— forward environment variables to the taskon_task_start— log when a task beginson_task_complete— log when a task finishes
Source Code
The source code is available in the examples/proplet-plugin-example directory.
Loading...
Build
cd propeller
make proplet-plugin-exampleYour output should look like this:
mkdir -p build/proplet-plugins
cd examples/proplet-plugin-example && cargo build --target wasm32-wasip2 --release
cp examples/proplet-plugin-example/target/wasm32-wasip2/release/proplet_plugin_example.wasm build/proplet-plugins/proplet-plugin-example.wasmUse
Place the compiled .wasm file in a directory the proplet can access and set:
export PROPLET_PLUGIN_DIR="/path/to/proplet-plugins"On task execution, the proplet logs:
[example-plugin] task starting: <task-id>
[example-plugin] task <task-id> finished (success=true)