Flyte Decks#

Deck enables users to get customizable and default visibility into their tasks.

Flytekit contains various renderers (FrameRenderer, MarkdownRenderer) that generate HTML files. For example, FrameRenderer renders a DataFrame as an HTML table, and MarkdownRenderer converts Markdown string to HTML.

Each task has at least three decks (input, output, and default). Input/output decks are used to render tasks’ input/output data, and the default deck is used to render line plots, scatter plots or markdown text. In addition, users can create new decks to render their data with custom renderers. Let’s dive into an example.

import flytekit

Import the dependencies.

import pandas as pd
import as px
from flytekit import task, workflow
from flytekit.deck.renderer import TopFrameRenderer
from flytekitplugins.deck.renderer import BoxRenderer, MarkdownRenderer
from typing_extensions import Annotated

# Fetch iris data.
iris_df =

Create a new deck called demo, and use the box renderer to display the box plot on demo deck. Use MarkdownRenderer to render md_text, and append HTML to the default deck.

def t1() -> str:
    md_text = "#Hello Flyte\n##Hello Flyte\n###Hello Flyte"
    flytekit.Deck("demo", BoxRenderer("sepal_length").to_html(iris_df))
    return md_text


To see the log output, the FLYTE_SDK_LOGGING_LEVEL environment variable should be set to 20.

Expected output

{"asctime": "2022-04-19 23:12:17,266", "name": "flytekit", "levelname": "INFO", "message": "t1 task creates flyte deck html to file:///tmp/flyte/20220419_231216/sandbox/local_flytekit/161e15f8c9331e83237bcf52e604697b/deck.html"}
{"asctime": "2022-04-19 23:12:17,283", "name": "flytekit", "levelname": "INFO", "message": "t2 task creates flyte deck html to file:///tmp/flyte/20220419_231216/sandbox/local_flytekit/6d8d1bafe04769592d7b0e212c50bd0e/deck.html"}

Open the deck.html file.

Demo Deck
Default Deck

Use Annotated to override the default renderer, and display top 10 rows of dataframe.

def t2() -> Annotated[pd.DataFrame, TopFrameRenderer(10)]:
    return iris_df

Open the Flyte Deck on FlyteConsole.


Define the workflow.

def wf():

Run the code locally.

if __name__ == "__main__":

Total running time of the script: ( 0 minutes 0.000 seconds)

Gallery generated by Sphinx-Gallery