https://flyte.org logo
#ask-the-community
Title
# ask-the-community
g

Guy Harel

08/28/2023, 12:37 PM
Hi all! Flyte rookie here, maybe you can help me out :) I'm trying to render a NotebookTask into a Flyte Deck. This is the task configuration inside the .py file (taken almost verbatim):
Copy code
nb = NotebookTask(
    name="simple-nb",
    notebook_path=os.path.join(NOTEBOOK_PATH, "text.ipynb"),
    render_deck=True,
    inputs=kwtypes(s=str),
    outputs=kwtypes(text=str)
)
However, there is no "Flyte Deck" button on the output view, even though the task completes successfully. Flyte Deck does show up for simpler tasks such as these:
Copy code
@task(disable_deck=False)
def t1() -> str:
    md_text = "#Hello Flyte\n##Hello Flyte\n###Hello Flyte"
    flytekit.Deck("demo", BoxRenderer("sepal_length").to_html(iris_df))
    flytekit.current_context().default_deck.append(MarkdownRenderer().to_html(md_text))
    return md_text
For context, this is running locally on the sandbox "cluster".
f

Franco Bocci

08/28/2023, 12:41 PM
Copy code
from flytekit.types.file import HTMLPage, PythonNotebook

nb = NotebookTask(
    name=notebook_name,
    notebook_path=notebook_path,
    render_deck=True,
    disable_deck=False,
    outputs=kwtypes(out_nb=PythonNotebook, out_rendered_nb=HTMLPage),
)
Something like this worked for me. Remember having this issue. Maybe you’re missing the
disable_deck=False
?
g

Guy Harel

08/28/2023, 12:47 PM
Thanks @Franco Bocci I will try this out. I did add disable_deck=False before which didn't help, but I will try the new outputs.
OK, just tried it out and it worked 🙂
Copy code
nb = NotebookTask(
    name="simple-nb",
    notebook_path=os.path.join(NOTEBOOK_PATH, "text.ipynb"),
    render_deck=True,
    disable_deck=False,
    inputs=kwtypes(s=str),
    outputs=kwtypes(text=str, out_rendered_nb=HTMLPage)
)
Thanks again @Franco Bocci!
f

Franco Bocci

08/28/2023, 12:52 PM
Glad it worked 💪
k

Ketan (kumare3)

08/28/2023, 2:50 PM
Ya the disable-deck is sad, we had to do it to ensure backwards compatibility
f

Franco Bocci

08/28/2023, 3:47 PM
Maybe worth defaulting it to False for the NotebookTask_
g

Guy Harel

08/29/2023, 6:34 AM
@Ketan (kumare3) It would really help if at least the docs get updated with both that flag and the explicit output, because the example shown doesn't work 🙂 https://docs.flyte.org/projects/cookbook/en/stable/auto_examples/papermill_plugin/simple.html
k

Ketan (kumare3)

08/29/2023, 2:10 PM
Render-deck should work - cc @Samhita Alla can you please TAL
s

Samhita Alla

08/29/2023, 3:34 PM
I'll take a look and update the example in the docs accordingly.
7 Views