Skip to content

Commit

Permalink
docs: flow trigger example
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-geller authored and brian-mulier-p committed Nov 29, 2024
1 parent 870d0b6 commit 41f3f6b
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions core/src/main/java/io/kestra/plugin/core/trigger/Flow.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@
full = true,
title = """
1) Trigger the `transform` flow after the `extract` flow finishes successfully. \
The `extract` flow generates a `last_ingested_date` output that is passed to the \
The `extract` flow generates a `date` output that is passed to the \
`transform` flow as an input. \
Here is the `extract` flow:
```yaml
id: extract
namespace: company.team
Expand All @@ -80,24 +78,24 @@
format: "{{ execution.startDate | dateAdd(-2, 'DAYS') | date('yyyy-MM-dd') }}"
outputs:
- id: last_ingested_date
- id: date
type: STRING
value: "{{ outputs.final_date.value }}"
```
Below is the `transform` flow triggered in response to the `extract` flow's successful completion.""",
The `transform` flow is triggered after the `extract` flow finishes successfully.""",
code = """
id: transform
namespace: company.team
inputs:
- id: last_ingested_date
- id: date
type: STRING
defaults: "2025-01-01"
variables:
result: |
Ingestion done in {{ trigger.executionId }}.
Now transforming data up to {{ inputs.last_ingested_date }}
Now transforming data up to {{ inputs.date }}
tasks:
- id: run_transform
Expand All @@ -112,8 +110,9 @@
- id: run_after_extract
type: io.kestra.plugin.core.trigger.Flow
inputs:
last_ingested_date: "{{ trigger.outputs.last_ingested_date }}"
date: "{{ trigger.outputs.date }}"
preconditions:
id: flows
flows:
- namespace: company.team
flowId: extract
Expand All @@ -123,10 +122,16 @@
full = true,
title = """
2) Trigger the `silver_layer` flow once the `bronze_layer` flow finishes successfully by 9 AM. \
This ensures that no new executions are triggered past the deadline. \
Here is the `silver_layer` flow:
```yaml
id: bronze_layer
namespace: company.team
tasks:
- id: raw_data
type: io.kestra.plugin.core.log.Log
message: Ingesting raw data
```""",
code = """
id: silver_layer
namespace: company.team
Expand All @@ -146,8 +151,7 @@
flows:
- namespace: company.team
flowId: bronze_layer
states: [SUCCESS]
```"""
states: [SUCCESS]"""
),
@Example(
full = true,
Expand Down

0 comments on commit 41f3f6b

Please sign in to comment.