How to run scripts or containers
Open Workflow defines a run task for shell commands, scripts, containers and child workflows. See Supported Features for Lemline's runtime support for each variant.
Prepare the examples
Complete the SQLite setup and keep its worker running. Run the commands from a second terminal in the setup directory. With the JAR, substitute java -jar lemline.jar for bin/lemline. The script example needs Python 3.8 or later on the worker's machine (python3 on the path, or LEMLINE_PYTHON_EXEC set).
Run an inline script
Put the script in run.script.code, set language (python or js) and pass inputs as named arguments. Lemline writes the code to a temporary file and starts it with each argument as a name followed by its value, so the script below reads sys.argv as pairs. With return: stdout, the task output is what the script prints.
Save it as inline-email-check.yaml:
The instances complete with the printed line as a string, "valid" and then "invalid".
Load an external script
Use run.script.source.endpoint to reference a script instead of inlining it. Lemline reads the script from the file system of the runner that executes the task: use an absolute file:// URI and place the script at that path on every runner. This example reads it from /tmp/lemline-scripts; on Windows, use a path such as file:///C:/lemline-scripts/email-validator.py.
Create the script with the same email check as above:
Save it as load-external-script.yaml:
The instances complete with valid and invalid. A source.endpoint that is not a file:// URI faults with Unsupported scheme for script source.
The endpoint is either a plain string or an object with a uri property. Both accept a runtime expression, for example endpoint: ${ .scriptUri }.
The runner needs Node.js 22 or later for js scripts and Python 3.8 or later for python scripts.
Run a container
Set run.container.image and, if needed, a command and volumes. The referenced volume path has to be available to the executor.
Save it as run-container-with-volume.yaml to see the failure:
Invoke a child workflow
Identify the child by namespace, name and version. Use run.workflow.input to supply named values for the child workflow. Register the child definition before starting the parent. This child asks the tutorial shop for an economy quote. Start the shop from the root of the Lemline source checkout:
Save the child as shipping-quote.yaml:
The parent waits for the child and receives its output. Save it as invoke-order-workflow.yaml:
The parent completes with the child's quote, {"quote":{"orderId":"ORD-42","carrier":"economy","price":5}}, and the shop lists one economy quote for ORD-42. Stop the shop when you are done:
See Run Workflow for awaiting completion and handling results.