Hi all! Flyte rookie here, maybe you can help me o...
# ask-the-community
g
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
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
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
Glad it worked 💪
k
Ya the disable-deck is sad, we had to do it to ensure backwards compatibility
f
Maybe worth defaulting it to False for the NotebookTask_
g
@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
Render-deck should work - cc @Samhita Alla can you please TAL
s
I'll take a look and update the example in the docs accordingly.