Skip to content

Commit

Permalink
doc: add variables and links
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-geller committed Jan 9, 2024
1 parent 35ed999 commit 5a69abb
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 10 deletions.
2 changes: 0 additions & 2 deletions content/docs/01.getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ tasks:
Click on **Save** and then on the **Execute** button to start your first execution.
![Your first flow saved](/docs/getting-started/saved.png)
::next-link
[For a more detailed introduction to Kestra, check our Tutorial](01.tutorial/index.md)
Expand Down
14 changes: 6 additions & 8 deletions content/docs/03.concepts/flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@
title: Flow
---

A flow is a container for `tasks`, their `inputs`, `outputs`, handling of `errors` and overall orchestration logic. It defines the **order** in which tasks are executed and **how** they are executed, e.g. **sequentially**, i**n parallel**, based on upstream task dependencies and their state, etc.
A flow is a container for `tasks`, their `inputs`, `outputs`, handling of `errors` and overall orchestration logic. It defines the **order** in which tasks are executed and **how** they are executed, e.g. **sequentially**, **in parallel**, based on upstream task dependencies and their state, etc.

**Flows** are used to implement your workload. They define all the tasks you want to perform and the order in which they will be run.
You can define a flow declaratively using a [YAML](https://en.wikipedia.org/wiki/YAML) file.

You define a flow using the declarative model called [YAML](https://en.wikipedia.org/wiki/YAML).
A flow must have an identifier (`id`), a `namespace`, and a list of [`tasks`](tasks.md).

A flow must have an identifier (`id`), a `namespace`, and a list of [`tasks`](./02.tasks.md).

A flow can also have [`inputs`](./inputs.md), [error handlers](./07.errors-handling.md) under the property `errors`, and [`triggers`](./triggers/index.md).
A flow can also have [`inputs`](inputs.md), [error handlers](errors.md), and [`triggers`](triggers/index.md).

## Flow sample

Here is a sample flow definition. It uses tasks available in Kestra core for testing purposes.
Here is a sample flow definition. It uses tasks available in Kestra core for testing purposes, such as the `Return` or `Log` tasks, and demonstrates how to use `labels`, `inputs`, `variables`, `triggers` and various `descriptions`.

```yaml
id: hello-world
Expand Down Expand Up @@ -51,7 +49,7 @@ taskDefaults:
### Task defaults
You can also define `taskDefaults` in your flow. This is a list of default task properties that will be applied to each task of a certain type inside your flow. The `taskDefaults` property can be handy to avoid repeating the same values when leveraging the same task multiple times.
You can also define `taskDefaults` in your flow. This is a list of default task properties that will be applied to each task of a certain type inside your flow. The [taskDefaults](task-defaults.md) property can be handy to avoid repeating the same values when leveraging the same task multiple times.

### Variables

Expand Down
33 changes: 33 additions & 0 deletions content/docs/03.concepts/variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: Variables
---

Variables are key-value pairs that can be used many times in your flow. You can also store variables on a namespace level so that they can be reused across multiple flows in a given namespace.

## How to configure variables

Here is how you can configure variables in your flow:

```yaml
id: hello-world
namespace: dev

variables:
myvar: hello
numeric_variable: 42

tasks:
- id: log
type: io.kestra.core.tasks.debugs.Return
format: "{{ vars.myvar }} world {{ vars.numeric_variable }}"
```
You can see the syntax for using variables is `{{ vars.variable_name }}`.

## How are variables rendered

You can use variables in any task property that is documented as **dynamic**.

Dynamic variables will be rendered thanks to the Pebble templating engine. Pebble templating engine allows to process various expressions with filters and functions. More information on variable processing can be found under [Expressions](expression/01.index.md).


Binary file removed public/docs/getting-started/saved.png
Binary file not shown.

0 comments on commit 5a69abb

Please sign in to comment.