acoustic-carpenter-78188
05/19/2023, 6:28 AMimport 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▾
acoustic-carpenter-78188
05/20/2023, 6:50 AMacoustic-carpenter-78188
05/24/2023, 4:48 AM