propeller logo
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 name
  • enrich — forward environment variables to the task
  • on_task_start — log when a task begins
  • on_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-example

Your 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.wasm

Use

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)

On this page