Note
Click here to download the full example code
Setup a Project#
Prerequisites#
Start a new project#
Create a virtual environment :
python -m venv ~/venvs/flyte
source ~/venvs/flyte/bin/activate
Then install Flytekit on it:
pip install flytekit
Then run pyflyte init <project_name>
, where <project_name>
is the
directory that will be created containing the scaffolding for a flyte-ready
project. For this guide we’re going call it my_flyte_project
:
pyflyte init my_flyte_project
cd my_flyte_project
The my_flyte_project
directory comes with a sample workflow, which can be
found under flyte/workflows/example.py
. The structure below shows the most
important files and how a typical Flyte app should be laid out.
A typical Flyte app should have these files
my_flyte_project
├── Dockerfile
├── docker_build_and_tag.sh
├── flyte
│ ├── __init__.py
│ └── workflows
│ ├── __init__.py
│ └── example.py
└── requirements.txt
Note
You can use pip-compile to build your requirements file.
The Dockerfile that comes with this is not GPU ready, but is a simple Dockerfile that should work for most of your apps.
Run the Workflow Locally#
The workflow can be run locally, simply by running it as a Python script:
python flyte/workflows/example.py
Note
The workflow needs to be invoked after the if __name__ == "__main__"
entrypoint at the bottom of flyte/workflows/example.py
.
Expected output:
Running my_wf() hello world
Conclusion#
We’ve successfully created a Flyte project and executed your workflows on a python runtime environment! 🎉 Next, let’s learn how to deploy to the cloud.
Total running time of the script: ( 0 minutes 0.000 seconds)