Skip to content

Commit 513f624

Browse files
Update documentation with global variables examples
Co-authored-by: kevinbackhouse <[email protected]>
1 parent 62d567c commit 513f624

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ Example: deploying a Taskflow:
7777
hatch run main -t examples.taskflows.example
7878
```
7979

80+
Example: deploying a Taskflow with command line global variables:
81+
82+
```sh
83+
hatch run main -t examples.taskflows.example_globals -g fruit=apples
84+
```
85+
86+
Multiple global variables can be set:
87+
88+
```sh
89+
hatch run main -t examples.taskflows.example_globals -g fruit=apples -g color=red
90+
```
91+
8092
## Deploying from Docker
8193

8294
You can deploy the Taskflow Agent via its Docker image using `docker/run.sh`.
@@ -104,6 +116,13 @@ Example: deploying a Taskflow (example.yaml):
104116
```sh
105117
docker/run.sh -t example
106118
```
119+
120+
Example: deploying a Taskflow with global variables:
121+
122+
```sh
123+
docker/run.sh -t example_globals -g fruit=apples
124+
```
125+
107126
Example: deploying a custom taskflow (custom_taskflow.yaml):
108127

109128
```sh

doc/GRAMMAR.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,20 @@ taskflow:
340340
Tell me more about {{ GLOBALS_fruit }}.
341341
```
342342
343+
Global variables can also be set or overridden from the command line using the `-g` or `--global` flag:
344+
345+
```sh
346+
hatch run main -t examples.taskflows.example_globals -g fruit=apples
347+
```
348+
349+
Multiple global variables can be set by repeating the flag:
350+
351+
```sh
352+
hatch run main -t examples.taskflows.example_globals -g fruit=apples -g color=red
353+
```
354+
355+
Command line globals override any globals defined in the taskflow YAML file, allowing you to reuse taskflows with different parameter values without editing the files.
356+
343357
### Reusable Tasks
344358

345359
Tasks can reuse single step taskflows and optionally override any of its configurations. This is done by setting a `uses` field with a link to the single step taskflow YAML file as its value.

0 commit comments

Comments
 (0)