Fundamentals
This section will guide you through the fundamentals of Kestra.
We assume you followed the Getting Started guide before this tutorial.
Flows
In Kestra, we define flows using the declarative YAML language.
We identify them by an id
and a namespace
. The id
is a unique identifier inside the namespace, which is used to group flows. Flows can also have a description and labels.
id: kestra-tutorial
namespace: io.kestra.tutorial
labels:
env: PRD
description: |
# Kestra Tutorial
As you notice, we can use markdown here.
Discover more about flows in the Flows section.
Tasks
We use Tasks to write flows. We define a Task by an id
, a type
, and some properties related to its type. Each Task is a step in your Flow that will execute a specific action. For example, you can use a Task to run a Python script.
tasks:
- id: python
type: io.kestra.core.tasks.scripts.Python
inputFiles:
main.py: |
print("Hello World")
At the moment of writing this guide, Kestra has 290+ tasks, which can be challenging to remember. That's why we provide an auto-completion feature to help you find the Task you need. Use the shortcut CTRL or ⌘ + SPACE
to activate it.
Create your first Flow
Now, let's create our first Flow. On the left side of the screen, click on the Flows menu. Then, click on the Create button.
Use the following Flow in the Editor, then click the Save button. This Flow will download a CSV file from the French Open Data Portal.
id: kestra-tutorial
namespace: io.kestra.tutorial
labels:
env: PRD
description: |
# Kestra Tutorial
As you notice, we can use markdown here.
tasks:
- id: download
type: io.kestra.plugin.fs.http.Download
uri: "https://gist.githubusercontent.com/tchiotludo/2b7f28f4f507074e60150aedb028e074/raw/6b6348c4f912e79e3ffccaf944fd019bf51cba30/conso-elec-gaz-annuelle-par-naf-agregee-region.csv"
After saving it, you will see a New Execution button. Click on it and watch your first Flow running.