Skip to content

Commit

Permalink
[WAIT TO MERGE] Use remoteliteralinclude for code in user guide docs (#…
Browse files Browse the repository at this point in the history
…5207)

* first commit

Signed-off-by: nikki everett <[email protected]>

* update raw flytesnacks urls

Signed-off-by: nikki everett <[email protected]>

* switch to remoteliteralinclude

Signed-off-by: nikki everett <[email protected]>

* switch basics docs to remoteliteralinclude

Signed-off-by: nikki everett <[email protected]>

* updates

Signed-off-by: nikki everett <[email protected]>

* add example code links

Signed-off-by: nikki everett <[email protected]>

* update flytesnacks links

Signed-off-by: nikki everett <[email protected]>

* update flytesnacks links in basics docs

Signed-off-by: nikki everett <[email protected]>

* fix links again

Signed-off-by: nikki everett <[email protected]>

* clean up customizing dependencies files

Signed-off-by: nikki everett <[email protected]>

* clean up data types and I/O files

Signed-off-by: nikki everett <[email protected]>

* clean up development lifecycle files

Signed-off-by: nikki everett <[email protected]>

* clean up extending files

Signed-off-by: nikki everett <[email protected]>

* clean up productionizing files

Signed-off-by: nikki everett <[email protected]>

* clean up testing files

Signed-off-by: nikki everett <[email protected]>

* fix rli

Signed-off-by: nikki everett <[email protected]>

---------

Signed-off-by: nikki everett <[email protected]>
  • Loading branch information
neverett authored Apr 19, 2024
1 parent e8588f3 commit 7e99ba4
Show file tree
Hide file tree
Showing 57 changed files with 1,028 additions and 4,291 deletions.
84 changes: 13 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 @@ -28,68 +9,27 @@ kernelspec:
Flytekit offers a mechanism for chaining Flyte entities using the `>>` operator.
This is particularly valuable when chaining tasks and subworkflows without the need for data flow between the entities.

```{note}
To clone and run the example code on this page, see the [Flytesnacks repo][flytesnacks].
```

## 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/chain_entities.py
:lines: 1-30
```

+++ {"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/chain_entities.py
:lines: 34-49
```

To run the provided workflows on the Flyte cluster, use the following commands:
Expand All @@ -110,3 +50,5 @@ pyflyte run --remote \
Chaining tasks and subworkflows is not supported in local environments.
Follow the progress of this issue [here](https://github.com/flyteorg/flyte/issues/4080).
:::

[flytesnacks]: https://github.com/flyteorg/flytesnacks/tree/master/examples/advanced_composition/
Loading

0 comments on commit 7e99ba4

Please sign in to comment.