Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp onboarding docs #1266

Merged
merged 208 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
208 commits
Select commit Hold shift + click to select a range
443f2ca
add structure for updated onboarding docs
Nov 17, 2023
8e87575
move new docs to correct location, delete duplicate project creation …
Nov 20, 2023
dd7ce32
fix headers
Nov 20, 2023
9005fa1
add quickstart guide to toc
Nov 20, 2023
d4f503b
Merge branch 'master' into nikki-onboarding-docs-revamp
Nov 20, 2023
18ef56e
update getting started links in light of new docs structure
Nov 20, 2023
ee192e4
add whitespace at end of each file to get linter to stop complaining
Nov 20, 2023
2daaef7
rename running workflows locally article, update refs in example docs
Nov 20, 2023
e1722a1
remove trailing whitespace
Nov 20, 2023
b028b5d
fix broken ref
Nov 20, 2023
ec26975
fix additional refs
Nov 20, 2023
114a720
update creating a project refs
Nov 20, 2023
58774cb
fix stray broken refs
Nov 20, 2023
29345f0
fix formatting
Nov 20, 2023
8364927
fix more refs
Nov 21, 2023
720fe97
align existing tasks and workflows doc and new creating a flyte proje…
Nov 21, 2023
6446ed2
add content to creating a project doc
Nov 21, 2023
da35f9e
split flyte project components out into separate article
Nov 21, 2023
e1fd6da
trim trailing whitespace
Nov 21, 2023
d9b299b
don't capitalize project
Nov 21, 2023
d4d42e0
update quickstart guide
Nov 21, 2023
cabd5d6
fix ref
Nov 21, 2023
8d8d466
remove task and workflow conceptual info from quickstart guide
Nov 21, 2023
8695cc9
try to fix next and prev links
Nov 21, 2023
ae6da75
Merge branch 'master' into nikki-onboarding-docs-revamp
Nov 27, 2023
28c2859
fix whitespace issues manually
Nov 27, 2023
8d6183f
add intro content to getting started with wf dev section
Nov 27, 2023
1983de5
rename launch plan article
Nov 27, 2023
bff5c72
try to fix next and prev links again
Nov 27, 2023
bd9fe21
rewrite about flyte page
Nov 27, 2023
3658f6a
move quickstart guide out of getting started with wf development section
Nov 27, 2023
f86ce9a
attempt to fix sidebar toc
Nov 27, 2023
7e9bcf1
attempt to fix next and prev links again
Nov 28, 2023
fbcddd6
add prev links to flyte fundamentals
Nov 28, 2023
c174d51
add prev link to quickstart guide
Nov 28, 2023
bbf7125
finish content for quickstart guide
Nov 28, 2023
13ed0f4
small edit for quickstart guide
Nov 28, 2023
b55d9ec
more edits in installation doc
Nov 28, 2023
c456035
rename about flyte back to introduction to flyte
Nov 29, 2023
0a877f8
second draft of creating a flyte project
Nov 29, 2023
39e1ccd
small edits
Nov 29, 2023
b68ad12
add next steps
Nov 29, 2023
7a553fe
second draft of project components doc
Nov 29, 2023
57f1fd0
tell readers what a dsl is
Nov 29, 2023
63b1726
less verbose
Nov 29, 2023
b698f33
remove temporary references to docs that will be written later
Nov 30, 2023
fac5bc9
polish flyte project docs
Nov 30, 2023
df69eb5
more content in running workflows
Nov 30, 2023
c2743b6
fix formatting
Nov 30, 2023
11fc30d
remove launch plan article from this branch
Dec 1, 2023
6792d7e
remove launch plan article from toc
Dec 1, 2023
b134410
more improvements to running workflows article
Dec 1, 2023
798ef85
add toc to getting started with workflow development landing page
Dec 1, 2023
059cba9
make intro copy more concise, fix toc links, add tk to workflows article
Dec 1, 2023
da20717
change {ref} to {doc} for links to pages
Dec 1, 2023
5b292af
remove ref from workflows file
Dec 1, 2023
f955386
Merge branch 'master' into nikki-onboarding-docs-revamp
Dec 1, 2023
d1bb43a
change ref to doc link
Dec 4, 2023
22ecd71
polish running flyte workflows locally
Dec 4, 2023
49237d1
fix numbering and add note
Dec 4, 2023
d2b2ab4
remove next steps section for now
Dec 4, 2023
122827a
rename running a workflow locally article, update language around opt…
Dec 4, 2023
df9e1b0
remove stray tk
Dec 4, 2023
fad20f8
fix doc link
Dec 4, 2023
6dfcdc0
fix links
Dec 4, 2023
7e6a8cc
test links outside of list
Dec 4, 2023
0c493b2
fix link
Dec 4, 2023
5e9fc99
try fixing links again
Dec 4, 2023
c2e62b4
try fixing link on index page again
Dec 4, 2023
d06aad7
turn doc links into ref links
Dec 4, 2023
5515423
add updated images
Dec 4, 2023
90f84e2
add space around images plus alt text
Dec 4, 2023
2df13d2
make screenshots easier to tell apart
Dec 4, 2023
ad0a644
clearer section header
Dec 4, 2023
fa5bc78
remove TKs - will turn into PR comments if needed
Dec 4, 2023
75e13df
fix typo and TOC
Dec 5, 2023
2d63d6c
update prerequisites sections
Dec 5, 2023
72a11cf
update running workflow doc with feedback
Dec 6, 2023
c804cb9
fix link to creating a project doc
Dec 7, 2023
6fb121e
Merge branch 'master' into nikki-onboarding-docs-revamp
Dec 7, 2023
794db79
fix link to development tools article
Dec 7, 2023
7b42751
rewrite intro
Dec 7, 2023
24c0905
quickstart guide updates
Dec 7, 2023
07f4f4e
update example in quickstart guide
Dec 7, 2023
dbebaba
move flyteconsole to control plane
Dec 7, 2023
89ecb3e
lots of edits to address feedback
Dec 8, 2023
9b598cf
imagespec updates
Dec 11, 2023
d80800d
missed an imagespec update
Dec 11, 2023
3e56eee
rename
Dec 11, 2023
0a5ac67
fix note formatting and add note about Dockerfile
Dec 11, 2023
46732c0
further updates to visualizing task inputs and outputs article
Dec 11, 2023
edddfd0
update image links
Dec 11, 2023
a45945d
Merge branch 'master' into nikki-onboarding-docs-revamp
Dec 11, 2023
c00f186
add note about git needed for dockerfile based setup
Dec 11, 2023
fbae5a5
fix imagespec template link, fix flyte fundamentals toctree
Dec 11, 2023
a7d4a46
remove build artifact
Dec 11, 2023
d543356
move note from quickstart guide
Dec 12, 2023
c82f81a
small fixes for dev tools page, formatting fixes for creating a flyte…
Dec 12, 2023
882e9f8
address today's feedback
Dec 13, 2023
48b0dec
proofread
Dec 13, 2023
a9751cd
Merge branch 'master' into nikki-onboarding-docs-revamp
Dec 13, 2023
0e26a13
Merge branch 'master' into nikki-onboarding-docs-revamp
cosmicBboy Dec 14, 2023
921e1e7
add note about using a different template
Dec 14, 2023
ad7e202
Merge branch 'nikki-onboarding-docs-revamp' of github.com:flyteorg/fl…
Dec 14, 2023
5f5c38e
Merge branch 'master' into nikki-onboarding-docs-revamp
Jan 3, 2024
18e2484
Merge branch 'master' into nikki-onboarding-docs-revamp
Jan 9, 2024
83bf699
small edits
Jan 9, 2024
f596187
Merge branch 'master' into nikki-onboarding-docs-revamp
Jan 10, 2024
51691a5
add structure for updated onboarding docs
Nov 17, 2023
0ea2164
move new docs to correct location, delete duplicate project creation …
Nov 20, 2023
83e9963
fix headers
Nov 20, 2023
397035d
add quickstart guide to toc
Nov 20, 2023
61901c3
update getting started links in light of new docs structure
Nov 20, 2023
08e0e0e
add whitespace at end of each file to get linter to stop complaining
Nov 20, 2023
d4e374d
rename running workflows locally article, update refs in example docs
Nov 20, 2023
6eeed26
remove trailing whitespace
Nov 20, 2023
6a90add
fix broken ref
Nov 20, 2023
f281011
fix additional refs
Nov 20, 2023
3123d17
update creating a project refs
Nov 20, 2023
87a244a
fix stray broken refs
Nov 20, 2023
e6dd303
fix formatting
Nov 20, 2023
bf8d01e
fix more refs
Nov 21, 2023
a3265d9
align existing tasks and workflows doc and new creating a flyte proje…
Nov 21, 2023
b0aaac1
add content to creating a project doc
Nov 21, 2023
d3db5b7
split flyte project components out into separate article
Nov 21, 2023
61a95bf
trim trailing whitespace
Nov 21, 2023
b55ca67
don't capitalize project
Nov 21, 2023
b97efe0
update quickstart guide
Nov 21, 2023
feade8c
fix ref
Nov 21, 2023
07adb8c
remove task and workflow conceptual info from quickstart guide
Nov 21, 2023
657cb19
try to fix next and prev links
Nov 21, 2023
913a742
add intro content to getting started with wf dev section
Nov 27, 2023
a9e40a0
rename launch plan article
Nov 27, 2023
cb60dd5
try to fix next and prev links again
Nov 27, 2023
f41d2d0
rewrite about flyte page
Nov 27, 2023
ae9f8dc
move quickstart guide out of getting started with wf development section
Nov 27, 2023
971e674
attempt to fix sidebar toc
Nov 27, 2023
d449bbd
attempt to fix next and prev links again
Nov 28, 2023
f4a5d3d
add prev links to flyte fundamentals
Nov 28, 2023
7f7745b
add prev link to quickstart guide
Nov 28, 2023
c219880
finish content for quickstart guide
Nov 28, 2023
232435c
small edit for quickstart guide
Nov 28, 2023
7849627
more edits in installation doc
Nov 28, 2023
ddea83c
rename about flyte back to introduction to flyte
Nov 29, 2023
1ed6dea
second draft of creating a flyte project
Nov 29, 2023
10a5a9b
small edits
Nov 29, 2023
dfc7e5d
add next steps
Nov 29, 2023
2cf76a1
second draft of project components doc
Nov 29, 2023
962ecdb
tell readers what a dsl is
Nov 29, 2023
9b52ac7
less verbose
Nov 29, 2023
cdbeaa2
remove temporary references to docs that will be written later
Nov 30, 2023
37cf884
polish flyte project docs
Nov 30, 2023
1ac9912
more content in running workflows
Nov 30, 2023
d99eb86
fix formatting
Nov 30, 2023
4de30c5
remove launch plan article from this branch
Dec 1, 2023
3d6174f
remove launch plan article from toc
Dec 1, 2023
ea0e810
more improvements to running workflows article
Dec 1, 2023
994952a
add toc to getting started with workflow development landing page
Dec 1, 2023
b7de9a4
make intro copy more concise, fix toc links, add tk to workflows article
Dec 1, 2023
be8c342
change {ref} to {doc} for links to pages
Dec 1, 2023
8502716
remove ref from workflows file
Dec 1, 2023
8dae135
change ref to doc link
Dec 4, 2023
b262ed0
polish running flyte workflows locally
Dec 4, 2023
f6db328
fix numbering and add note
Dec 4, 2023
40af88b
remove next steps section for now
Dec 4, 2023
5d080cd
rename running a workflow locally article, update language around opt…
Dec 4, 2023
b0e72ce
remove stray tk
Dec 4, 2023
a076152
fix doc link
Dec 4, 2023
a5d7568
fix links
Dec 4, 2023
a27394e
test links outside of list
Dec 4, 2023
1f083f9
fix link
Dec 4, 2023
fe8fc2d
try fixing links again
Dec 4, 2023
908e054
try fixing link on index page again
Dec 4, 2023
8c98228
turn doc links into ref links
Dec 4, 2023
b5665df
add updated images
Dec 4, 2023
2fa0ed9
add space around images plus alt text
Dec 4, 2023
be4c990
make screenshots easier to tell apart
Dec 4, 2023
8a9ff1c
clearer section header
Dec 4, 2023
4e73698
remove TKs - will turn into PR comments if needed
Dec 4, 2023
95202d9
fix typo and TOC
Dec 5, 2023
3181448
update prerequisites sections
Dec 5, 2023
6644a3c
update running workflow doc with feedback
Dec 6, 2023
1d15964
fix link to creating a project doc
Dec 7, 2023
7bd53d7
fix link to development tools article
Dec 7, 2023
5439317
rewrite intro
Dec 7, 2023
f689044
quickstart guide updates
Dec 7, 2023
40e2a47
update example in quickstart guide
Dec 7, 2023
0b6abaa
move flyteconsole to control plane
Dec 7, 2023
81353ec
lots of edits to address feedback
Dec 8, 2023
c2a2a96
imagespec updates
Dec 11, 2023
7b8b7e7
missed an imagespec update
Dec 11, 2023
ccd818b
rename
Dec 11, 2023
8112d18
fix note formatting and add note about Dockerfile
Dec 11, 2023
e94be57
further updates to visualizing task inputs and outputs article
Dec 11, 2023
8848ec9
update image links
Dec 11, 2023
2a4135b
add note about git needed for dockerfile based setup
Dec 11, 2023
cc160b5
fix imagespec template link, fix flyte fundamentals toctree
Dec 11, 2023
042f5a6
remove build artifact
Dec 11, 2023
547bc12
move note from quickstart guide
Dec 12, 2023
fbbcb84
small fixes for dev tools page, formatting fixes for creating a flyte…
Dec 12, 2023
a56d9d7
address today's feedback
Dec 13, 2023
6d06ea8
proofread
Dec 13, 2023
928a264
add note about using a different template
Dec 14, 2023
10762c1
small edits
Jan 9, 2024
74fbd8e
have user copy python code instead of using pyflyte init
Jan 16, 2024
0272c69
resolve merge conflict
Jan 16, 2024
f3b0080
add note about needing to change directories
Jan 16, 2024
cfc9619
Merge branch 'master' into nikki-onboarding-docs-revamp
Jan 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions docs/getting_started/creating_a_flyte_project.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
jupytext:
formats: md:myst
text_representation:
extension: .md
format_name: myst
---

# Creating a Flyte project
neverett marked this conversation as resolved.
Show resolved Hide resolved
neverett marked this conversation as resolved.
Show resolved Hide resolved

## About Flyte projects

A Flyte project is a directory containing task and workflow code, internal Python source code, configuration files, and other artifacts structured according to software engineering best practices that enables you to package up your code so that it can be registered to a Flyte cluster.

## Prerequisites

* Follow the steps in {doc}`"Installing development tools" <installing_development_tools>`
* (Optional, but recommended) Install [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)

## Steps

### 1. Activate your Python virtual environment

If you are using conda or another Python virtual environment manager, first, activate the virtual environment you will use to manage dependencies for your Flyte project:

```{prompt} bash $
conda activate flyte-example
```

### 2. Initialize your Flyte project

Next, initialize your Flyte project. The [flytekit-python-template GitHub repository](https://github.com/flyteorg/flytekit-python-template) contains Flyte project templates with sample code that you can run as is or modify to suit your needs.

In this example, we will initialize the [basic-example-imagespec project template](https://github.com/flyteorg/flytekit-python-template/tree/main/basic-example-imagespec).

```{prompt} bash $
pyflyte init my_project
```

:::{note}

To initialize a Flyte project with a different template, use the `--template` parameter:

`pyflyte init --template hello-world hello-world`
:::

### 3. Install additional requirements

After initializing your Flyte project, you will need to install requirements listed in `requirements.txt`:

```{prompt} bash $
cd my_project
pip install -r requirements.txt
```

### 4. (Optional) Version your Flyte project with git

We highly recommend putting your Flyte project code under version control. To do so, initialize a git repository in the Flyte project directory:

```{prompt} bash $
git init
```

```{note}
If you are using a Dockerfile instead of ImageSpec, you will need to initialize a git repository and create at least one commit, since the commit hash is used to tag the image when it is built.
```

### 5. Run your workflow in a local Python environment

To check that your Flyte project was set up correctly, run the workflow in a local Python environment:

```{prompt} bash $
cd workflows
pyflyte run example.py wf
```

## Next steps

To learn about the parts of a Flyte project, including tasks and workflows, see {doc}`"Flyte project components" <flyte_project_components>`.

To run the workflow in your Flyte project in a local Flyte cluster, see the {ref}`"Running a workflow in a local cluster" <getting_started_running_workflow_local_cluster>` section of {doc}`"Running a workflow locally" <running_a_workflow_locally>`.
154 changes: 0 additions & 154 deletions docs/getting_started/creating_flyte_project.md

This file was deleted.

15 changes: 6 additions & 9 deletions docs/getting_started/flyte_fundamentals.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
# override the toc-determined page navigation order
prev-page: index
prev-page-title: Getting Started
prev-page: getting_started/creating_and_running_a_flyte_launch_plan
prev-page-title: Creating and running a Flyte Launch Plan
next-page: getting_started/tasks_and_workflows
next-page-title: Tasks, Workflows and LaunchPlans
---

(getting_started_fundamentals)=
Expand All @@ -24,14 +25,11 @@ use cases.
* - {doc}`🔀 Tasks, Workflows and LaunchPlans <tasks_and_workflows>`
- Create tasks as building blocks, compose them into workflows, and schedule
them with launchplans.
* - {doc}`✨ Creating a Flyte Project <creating_flyte_project>`
- Build a Flyte project from scratch and learn about the recommended project
structure.
* - {doc}`🗄 Registering Workflows <package_register>`
- Develop and deploy workflows to a local Flyte demo cluster.
* - {doc}`⏱ Running and Scheduling Workflows <run_schedule>`
- Execute workflows programmatically and schedule them as cron jobs.
* - {doc}`📊 Visualizing Artifacts <visualizing_artifacts>`
* - {doc}`📊 Visualizing Task Input and Output <visualizing_task_input_and_output>`
- Create rich, customizable static reports for increased visibility into tasks.
* - {doc}`🏎 Optimizing Tasks <optimizing_tasks>`
- Make tasks scalable, performant, and robust to unexpected failures.
Expand All @@ -52,10 +50,9 @@ cluster, see the {ref}`Deployment Guide <deployment>`.
:hidden:

tasks_and_workflows
creating_flyte_project
package_register
run_schedule
visualizing_artifacts
visualizing_task_input_and_output
optimizing_tasks
extending_flyte
```
118 changes: 118 additions & 0 deletions docs/getting_started/flyte_project_components.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
jupytext:
formats: md:myst
text_representation:
extension: .md
format_name: myst
---

# Flyte project components

A Flyte project is a directory containing task and workflow code, internal Python source code, configuration files, and other artifacts needed to package up your code so that it can be run on a Flyte cluster.

## Directory structure

If you look at the project you created with `pyflyte init` in {doc}`"Creating a Flyte project" <creating_a_flyte_project>`, you'll see the following directory structure:

```{code-block} bash
my_project
├── LICENSE
├── README.md
├── requirements.txt # Python dependencies
└── workflows
├── __init__.py
└── example.py # Example Flyte workflow code
```

(getting_started_python_dependencies)=

## `requirements.txt` Python dependencies

Most Flyte projects contain a `requirements.txt` file that you can modify to suit the needs of your project.

You can specify pip-installable Python dependencies in your project by adding them to the
`requirements.txt` file.

```{note}
We recommend using [pip-compile](https://pip-tools.readthedocs.io/en/latest/) to
manage your project's Python requirements.
```

````{dropdown} See requirements.txt

```{rli} https://raw.githubusercontent.com/flyteorg/flytekit-python-template/main/simple-example/%7B%7Bcookiecutter.project_name%7D%7D/requirements.txt
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link will need to be updated after flyteorg/flytekit-python-template#43 is merged

:caption: requirements.txt
```

````

(getting_started_workflow_code)=

## `example.py` workflow code

Flyte projects initialized with `pyflyte init` contain a `workflows` directory, inside of which is a Python file that holds the workflow code for the application.

The workflow code may contain ImageSpec configurations, and one or more task and workflow functions, decorated with the `@task` and `@workflow` decorators, respectively.

```{note}
The workflow directory also contains an `__init__.py` file to indicate that the workflow code is part of a Python package. For more information, see the [Python documentation](https://docs.python.org/3/reference/import.html#regular-packages).
```

### ImageSpec

The workflow code file in the basic template includes an optional ImageSpec configuration. ImageSpec is a Flyte feature that enables you to build a custom container image without having to write a Dockerfile. To learn more, see the [ImageSpec documentation](https://docs.flyte.org/projects/cookbook/en/latest/auto_examples/customizing_dependencies/image_spec.html#image-spec-example)

```python
# basic_image = ImageSpec(
# name="flytekit", # rename this to your docker image name
# base_image="ghcr.io/flyteorg/flytekit:py3.11-1.10.2",
# # the base image that flytekit will use to build your image
# packages=["example-package"], # packages to add to the base image
# # remove "example-package" before using.
# registry="ghcr.io/unionai-oss",
# # the registry your image will be pushed to
# python_version="3.11"
# # the python version; optional if not different from the base image
# )
```

```{note}
If you need to use a Dockerfile instead of ImageSpec, you will need to add a Dockerfile and a `docker_build.sh` script to the top-level directory of your project, and either remove any ImageSpec configurations from the workflow code file or leave them commented out.
```

### The `@task` and `@workflow` decorators

* The `@task` and `@workflow` decorators can be parsed by Python provided that they are used only on functions at the top-level scope of the module.
* Task and workflow function signatures must be type-annotated with Python type hints.
* Tasks and workflows can be invoked like regular Python methods, and even imported and used in other Python modules or scripts.
* Task and workflow functions must be invoked with keyword arguments.

#### `@task`

The `@task` decorator indicates a Python function that defines a task.

* A task is a Python function that takes some inputs and produces an output.
* Tasks are assembled into workflows.
* When deployed to a Flyte cluster, each task runs in its own [Kubernetes Pod](https://kubernetes.io/docs/concepts/workloads/pods/), where Flyte orchestrates what task runs at what time in the context of a workflow.

```python
@task()
def say_hello(name: str) -> str:
return f"Hello, {name}!"
```

#### `@workflow`

The `@workflow` decorator indicates a function-esque construct that defines a workflow.

* Workflows specify the flow of data between tasks, and the dependencies between tasks.
* A workflow appears to be a Python function but is actually a [domain-specific language (DSL)](https://en.wikipedia.org/wiki/Domain-specific_language) that only supports a subset of Python syntax and semantics.
* When deployed to a Flyte cluster, the workflow function is "compiled" to construct the directed acyclic graph (DAG) of tasks, defining the order of execution of task pods and the data flow dependencies between them.

```python
@workflow
def wf(name: str = "world") -> typing.Tuple[str, int]:
greeting = say_hello(name=name)
greeting_len = greeting_length(greeting=greeting)
return greeting, greeting_len
```
Loading
Loading