Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
Signed-off-by: nikki everett <[email protected]>
  • Loading branch information
nikki everett committed Apr 9, 2024
1 parent 2528de7 commit 9c33b9c
Showing 1 changed file with 7 additions and 71 deletions.
78 changes: 7 additions & 71 deletions docs/user_guide/advanced_composition/chaining_flyte_entities.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
---
jupytext:
cell_metadata_filter: all
formats: md:myst
main_language: python
notebook_metadata_filter: all
text_representation:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.16.1
kernelspec:
display_name: Python 3
language: python
name: python3
---

+++ {"lines_to_next_cell": 0}

(chain_flyte_entities)=

# Chaining Flyte entities
Expand All @@ -31,65 +12,20 @@ This is particularly valuable when chaining tasks and subworkflows without the n
## Tasks

Let's establish a sequence where `t1()` occurs after `t0()`, and `t2()` follows `t1()`.

```{code-cell}
from flytekit import task, workflow
@task
def t2():
print("Running t2")
return
@task
def t1():
print("Running t1")
return
@task
def t0():
print("Running t0")
return
@workflow
def chain_tasks_wf():
t2_promise = t2()
t1_promise = t1()
t0_promise = t0()
t0_promise >> t1_promise
t1_promise >> t2_promise

```{rli} https://raw.githubusercontent.com/flyteorg/flytesnacks/master/examples/advanced_composition/advanced_composition/chain_entities.py
:caption: advanced_composition/advanced_composition/chain_entities.py
:lines: 3-32
```

+++ {"lines_to_next_cell": 0}

(chain_subworkflow)=
## Subworkflows

Just like tasks, you can chain {ref}`subworkflows <subworkflow>`.

```{code-cell}
:lines_to_next_cell: 2
@workflow
def sub_workflow_1():
t1()
@workflow
def sub_workflow_0():
t0()
@workflow
def chain_workflows_wf():
sub_wf1 = sub_workflow_1()
sub_wf0 = sub_workflow_0()
sub_wf0 >> sub_wf1
```{rli} https://raw.githubusercontent.com/flyteorg/flytesnacks/master/examples/advanced_composition/advanced_composition/chain_entities.py
:caption: advanced_composition/advanced_composition/chain_entities.py
:lines: 36-51
```

To run the provided workflows on the Flyte cluster, use the following commands:
Expand Down

0 comments on commit 9c33b9c

Please sign in to comment.