Getting started

Estimated time to complete: 3 minutes.

Prerequisites

Make sure you have docker installed and git installed, then install flytekit:

Steps

  1. First install the python Flytekit SDK and clone the flytesnacks repo:

pip install --pre flytekit
git clone git@github.com:flyteorg/flytesnacks.git flytesnacks
cd flytesnacks
  1. The repo comes with some useful Make targets to make your experimentation workflow easier. Run make help to get the supported commands. Let’s start a sandbox cluster:

make start

Tip

In case make start throws any error please refer to the troubleshooting guide here Troubleshoot

  1. Take a minute to explore Flyte Console through the provided URL.

A quick visual tour for launching your first Workflow.
  1. Open hello_world.py in your favorite editor.

cookbook/core/flyte_basics/hello_world.py
  1. Add name: str as an argument to both my_wf and say_hello functions. Then update the body of say_hello to consume that argument.

Tip

@task
def say_hello(name: str) -> str:
    return f"hello world, {name}"

Tip

@workflow
def my_wf(name: str) -> str:
    res = say_hello(name=name)
    return res
  1. Update the simple test at the bottom of the file to pass in a name. E.g.

Tip

print(f"Running my_wf(name='adam') {my_wf(name='adam')}")
  1. When you run this file locally, it should output hello world, adam. Run this command in your terminal:

python cookbook/core/flyte_basics/hello_world.py

Congratulations! You have just run your first workflow. Now, let’s run it on the sandbox cluster deployed earlier.

  1. Run:

REGISTRY=cr.flyte.org/flyteorg make fast_register

Note

If the images are to be re-built, run make register command.

  1. Visit the console, click launch, and enter your name as the input.

  2. Give it a minute and once it’s done, check out “Inputs/Outputs” on the top right corner to see your updated greeting.

A quick visual tour for launching a workflow and checking the outputs when they're done.

Recap

You have successfully:

  1. Run a flyte sandbox cluster,

  2. Run a flyte workflow locally,

  3. Run a flyte workflow on a cluster.

🎉 Congratulations, you just ran your first Flyte workflow 🎉

Next Steps: User Guide

To experience the full capabilities of Flyte, take a look at the User Guide 🛫