flytesnacks repo and install its dependencies, which includes flytekit :
[Recommended] Create a new python virtual environment to make sure it doesn’t interfere with your
development environment, e.g. with
python -m venv <path/to/env>.
git clone https://github.com/flyteorg/flytesnacks cd flytesnacks/cookbook pip install -r core/requirements.txt
To make sure everything is working in your virtual environment, run
Running my_wf() hello world
Create a Local Demo Flyte Cluster#
flytectl to start a demo Flyte cluster:
flytectl demo start
Now you can run all of the example workflows locally using the default Docker image bundled with
pyflyte run core/flyte_basics/hello_world.py my_wf
The first couple arguments of
pyflyte run is in the form of
path/to/script.py <workflow_name>, where
<workflow_name> is the function decorated with
@workflow that you want to run.
To run the workflow on the demo Flyte cluster, all you need to do is supply the
pyflyte run --remote core/flyte_basics/hello_world.py my_wf
You should see an output that looks like:
Go to https://<flyte_admin_url>/console/projects/flytesnacks/domains/development/executions/<execution_name> to see execution in the console.
You can visit this url to inspect the execution as it runs:
Finally, let’s run a workflow that takes some inputs, for example the
pyflyte run --remote core/flyte_basics/basic_workflow.py my_wf --a 5 --b hello
We’re passing in the workflow inputs as additional options to
pyflyte run, in the above example the
--a 5 and
--b hello. For snake-case argument names like
arg_name, you can provide the
Workflows can be visualized as DAGs on the UI. However, you can visualize workflows on the browser and in the terminal by just using your terminal.
To view workflow on the browser:
flytectl get workflows --project flytesnacks --domain development flyte.workflows.example.my_wf --version <version> -o doturl
To view workflow as a
strict digraph on the command line:
flytectl get workflows --project flytesnacks --domain development flyte.workflows.example.my_wf --version <version> -o dot
<version> with version from console UI, it may look something like
Running most of the examples in the User Guide only requires the default Docker image that ships with Flyte.
Many examples in the Tutorials and Integrations section depend on additional libraries,
tensorflow, which will not work with the default docker image used by
These examples will explicitly show you which images to use for running these examples by passing in the docker
image you want to use with the
--image option in
🎉 Congrats! Now you can run all the examples in the User Guide 🎉
Try out the examples in Flyte Basics section.