<#1650 Map over notebook task> Pull request opened...
# flyte-github
a
#1650 Map over notebook task Pull request opened by pingsutw TL;DR This PR allows map over notebook task Type ☑︎ Bug Fix ☐ Feature ☐ Plugin Are all requirements met? ☐ Code completed ☑︎ Smoke tested ☐ Unit tests added ☐ Code documentation added ☐ Any pending items have an associated Issue Complete description
Copy code
import os
import pathlib
import typing

from flytekit import kwtypes, task, workflow, ImageSpec, map_task
from flytekitplugins.papermill import NotebookTask

new_flytekit = "git+<https://github.com/flyteorg/flytekit@022ade936d2fe1eb6a2d705c319cce7d2c66ade6>"
new_papermill = "git+<https://github.com/flyteorg/flytekit.git@022ade936d2fe1eb6a2d705c319cce7d2c66ade6#subdirectory=plugins/flytekit-papermill>"
image = ImageSpec(registry="pingsutw", packages=[new_papermill, new_flytekit], apt_packages=["git"])

nb = NotebookTask(
    name="simple-nb",
    notebook_path=os.path.join(
        pathlib.Path(__file__).parent.absolute(), "nb-simple.ipynb"
    ),
    render_deck=True,
    inputs=kwtypes(a=float),
    outputs=kwtypes(square=float),
    container_image=image,
)


@workflow
def wf(a: float) -> typing.List[float]:
    return map_task(nb)(a=[a])


if __name__ == "__main__":
    print(wf(a=3.14))

image

Tracking Issue https://flyte-org.slack.com/archives/CP2HDHKE1/p1684471512753359 Follow-up issue NA flyteorg/flytekit Codecov: 71.01% (-0.01%) compared to ba70f46 Codecov: 25.00% of diff hit (target 71.02%) 28 other checks have passed 28/30 successful checks