Skip to content

adds papermill plugin#857

Merged
samhita-alla merged 13 commits intomainfrom
papermill-plugin
Apr 15, 2026
Merged

adds papermill plugin#857
samhita-alla merged 13 commits intomainfrom
papermill-plugin

Conversation

@samhita-alla
Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
)
return task

def loader_args(self, task: TaskTemplate, root_dir: pathlib.Path | None) -> list[str]:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could load it using the task_name itself.
Ideally honestly i would love to support tasks to be like container task. Why do we need to load the Notebook task? Can we not just send the notebook path and just run that directly? you might need the task for inputs / outputs maybe.

async def my_task():
    t = NotebookTask("my_nb.ipynb")
    await t(...)

Ideally i would like ^ this to work. if you use module level resolver this cannot work.

Copy link
Copy Markdown
Contributor Author

@samhita-alla samhita-alla Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the resolver. it now bakes the notebook path and i/o type schemas into the task spec at registration time so it doesn't have to be a module-level resolver. this works?

@env.task
async def async_inline_workflow(x: int = 3, y: float = 1.5) -> int:
    from flyteplugins.papermill import NotebookTask

    nb = NotebookTask(
        name="add_numbers_async_inline",
        notebook_path="notebooks/basic_math.ipynb",
        task_environment=env,
        inputs={"x": int, "y": float},
        outputs={"result": int},
    )
    # Use .aio() when calling a NotebookTask from an async task function
    return await nb.aio(x=x, y=y)

@kumare3
Copy link
Copy Markdown
Contributor

kumare3 commented Mar 28, 2026

looks pretty cool, but one comment, about resolver

…o schema

Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
fiedlerNr9
fiedlerNr9 previously approved these changes Mar 30, 2026
Copy link
Copy Markdown
Contributor

@fiedlerNr9 fiedlerNr9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm! Thanks for building this 🚀

Somehow, I want the user to see this is a Notebook task when clicking on summary. Maybe showing a Integration link with a JN icon, similiar to what we have for spark and ray. The link could just be a redirect to the report tab?

What do you think?

Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>

inputs = _schema_to_types(args_dict.get("input-schema", "{}"))
outputs = _schema_to_types(args_dict.get("output-schema", "{}"))
config: dict = json.loads(args_dict.get("config", "{}"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh this is dangerous. hmm we might have very big right, does it work always?

Copy link
Copy Markdown
Contributor Author

@samhita-alla samhita-alla Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does work with the examples i tested. why would it be big? it's just the types and the papermill config, no?


inputs = _schema_to_types(args_dict.get("input-schema", "{}"))
outputs = _schema_to_types(args_dict.get("output-schema", "{}"))
config: dict = json.loads(args_dict.get("config", "{}"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if you want to pass it so, just pickle the entire task and send it no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm this should work too, right? papermill doesn’t support a wide range of types: only JSON-serializable ones (int, str, bool, float, list, dict, None), along with File, Dir, and DataFrame. these should work well with the plugin.

…nd add a type-check validator

Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
@samhita-alla
Copy link
Copy Markdown
Contributor Author

@kumare3 let me know what you think.

@samhita-alla samhita-alla requested a review from kumare3 April 14, 2026 16:19
@samhita-alla samhita-alla merged commit 680b67a into main Apr 15, 2026
57 checks passed
katrogan pushed a commit that referenced this pull request Apr 16, 2026
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Katrina Rogan <katroganGH@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants