Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FlyteDeck Example #1734

Merged
merged 4 commits into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions examples/development_lifecycle/development_lifecycle/decks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@
# https://docs.flyte.org/en/latest/user_guide/customizing_dependencies/imagespec.html#image-spec-example

custom_image = ImageSpec(
packages=["plotly", "scikit-learn", "flytekitplugins-deck-standard"], registry="ghcr.io/flyteorg"
packages=[
"flytekitplugins-deck-standard",
"markdown",
"pandas",
"pillow",
"plotly",
"pyarrow",
"scikit-learn",
"ydata_profiling",
],
registry="ghcr.io/flyteorg",
)

if custom_image.is_container():
Expand Down Expand Up @@ -47,7 +57,7 @@ def pca_plot():
from flytekitplugins.deck.renderer import FrameProfilingRenderer


@task(enable_deck=True)
@task(enable_deck=True, container_image=custom_image)
def frame_renderer() -> None:
df = pd.DataFrame(data={"col1": [1, 2], "col2": [3, 4]})
flytekit.Deck("Frame Renderer", FrameProfilingRenderer().to_html(df=df))
Expand All @@ -61,7 +71,7 @@ def frame_renderer() -> None:
from flytekit.deck import TopFrameRenderer


@task(enable_deck=True)
@task(enable_deck=True, container_image=custom_image)
def top_frame_renderer() -> Annotated[pd.DataFrame, TopFrameRenderer(1)]:
return pd.DataFrame(data={"col1": [1, 2], "col2": [3, 4]})

Expand All @@ -70,7 +80,7 @@ def top_frame_renderer() -> Annotated[pd.DataFrame, TopFrameRenderer(1)]:
# producing HTML as a Unicode string.


@task(enable_deck=True)
@task(enable_deck=True, container_image=custom_image)
def markdown_renderer() -> None:
flytekit.current_context().default_deck.append(
MarkdownRenderer().to_html("You can install flytekit using this command: ```import flytekit```")
Expand All @@ -87,7 +97,7 @@ def markdown_renderer() -> None:
from flytekitplugins.deck.renderer import BoxRenderer


@task(enable_deck=True)
@task(enable_deck=True, container_image=custom_image)
def box_renderer() -> None:
iris_df = px.data.iris()
flytekit.Deck("Box Plot", BoxRenderer("sepal_length").to_html(iris_df))
Expand All @@ -101,7 +111,7 @@ def box_renderer() -> None:
from flytekitplugins.deck.renderer import ImageRenderer


@task(enable_deck=True)
@task(enable_deck=True, container_image=custom_image)
def image_renderer(image: FlyteFile) -> None:
flytekit.Deck("Image Renderer", ImageRenderer().to_html(image_src=image))

Expand All @@ -117,7 +127,7 @@ def image_renderer_wf(
from flytekitplugins.deck.renderer import TableRenderer


@task(enable_deck=True)
@task(enable_deck=True, container_image=custom_image)
def table_renderer() -> None:
flytekit.Deck(
"Table Renderer",
Expand Down
Loading