Skip to content

feat(frontend): use notebook name as default pipeline name and handle TaskMissingError#524

Open
cordeirops wants to merge 14 commits intokubeflow:mainfrom
cordeirops:issue510
Open

feat(frontend): use notebook name as default pipeline name and handle TaskMissingError#524
cordeirops wants to merge 14 commits intokubeflow:mainfrom
cordeirops:issue510

Conversation

@cordeirops
Copy link
Contributor

@cordeirops cordeirops commented Nov 19, 2025

feat: use notebook name as default pipeline name and handle TaskMissingError

Summary

This PR introduces improvements to pipeline name generation and error handling during notebook compilation.

Key Changes

  • Use the notebook filename as the default pipeline_name, applying sanitization to comply with KFP naming rules.
  • Add the domain exception TaskMissingError, raised by the compiler when a pipeline contains no steps.
  • Map TaskMissingError to RPCTaskIsMissing at the RPC layer and return a more actionable details message to the client.
  • Improve error handling in the notebook compilation flow to better guide users when pipeline steps are missing.
  • Add utility functions for pipeline name sanitization and default name derivation.
  • Frontend: implement default pipeline name + sanitization and provide a custom dialog for RPC error code 7 (TaskIsMissing).

Fixes #510 and #507

@StefanoFioravanzo StefanoFioravanzo changed the title FIX ISSUE_510 feat(frontend): use notebook name as default pipeline name and handle TaskMissingError Nov 20, 2025
@StefanoFioravanzo
Copy link
Member

@cordeirops I took the liberty of updating the PR title and adding the issue link to the end of the firsts comment - in that way the PR and issue are linked

Copy link
Collaborator

@jesuino jesuino left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! The changes are looking good, I added some minor request changes.

I see you fixed two problems in the same PR and one of the problems seems to be missing a Github issue. I sugest you to create a PR per issue (1:1) and feel free to create issues when needed.

];
const result = await showDialog({ title, body, buttons });
const clicked = result.button ? (result.button.label as string) : '';
if (clicked === 'Open docs') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should avoid a hardcoded string and use a constant for this string

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign ederign for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cordeirops
Copy link
Contributor Author

Thanks for your contribution! The changes are looking good, I added some minor request changes.

I see you fixed two problems in the same PR and one of the problems seems to be missing a Github issue. I sugest you to create a PR per issue (1:1) and feel free to create issues when needed.

Hi @jesuino, thanks for the review. I’ve made the requested changes and committed them.

Regarding the two issues in the same PR, this is because in #507 there was a comment mentioning that it would be fixed by #510. For this reason, I updated the description of this PR to also reference #507.

@cordeirops cordeirops requested a review from jesuino January 13, 2026 20:37
Copy link
Collaborator

@jesuino jesuino left a comment

Choose a reason for hiding this comment

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

I can confirm that now a notebook comes with a default pipeline name:

Image

Also there's a better error message when a notebook has no step:

Image

@ederign
Copy link
Member

ederign commented Jan 16, 2026

@jesuino can you took another quick look here please?

Copy link
Collaborator

@jesuino jesuino left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@hmtosi hmtosi left a comment

Choose a reason for hiding this comment

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

@cordeirops thank you for your work. There are quite a lot of changes here, so I have only reviewed the ones for the TaskMissingError so far. I believe there is a simpler way to do this, similar to what we did in #496. Please take a look at that solution, and at my comments.

@@ -0,0 +1,14 @@
"""Core domain exceptions for Kale (non-RPC).
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like the other error types are included in the rpc/errors.py file, without an entry in this file. I do not think we need to create a separate new errors.py file here, especially because the class only includes the pass keyword, and doesn't introduce other new functionality. Could you please delete this file?

from kale import Compiler, NotebookProcessor
from kale.rpc.errors import RPCInternalError
from kale.rpc.errors import RPCInternalError, RPCTaskIsMissing
from kale.errors import TaskMissingError
Copy link
Collaborator

Choose a reason for hiding this comment

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

The error type should remain the same, so the RPCTaskIsMissing import can be removed.
The from kale.errors import TaskMissingError line will not be needed, as this file should be deleted completely.

return {"pipeline_package_path": os.path.relpath(package_path),
"pipeline_metadata": pipeline.config.to_dict()}
except TaskMissingError as e:
# Domain-specific exception raised by core components when no
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please clean up these comments to be more concise and descriptive of just the code? These explain a bit too much of the development process.

"compilation: %s", msg)
raise RPCTaskIsMissing(details=msg, trans_id=request.trans_id)
except ValueError as e:
# kfp.compiler or graph_component may
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please clean up these comments as well


return {"pipeline_package_path": os.path.relpath(package_path),
"pipeline_metadata": pipeline.config.to_dict()}
except TaskMissingError as e:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use the RPCUnhandledError error instead of the TaskMissingError

INTERNAL_ERROR = 4
SERVICE_UNAVAILABLE = 5
UNHANDLED_ERROR = 6
TASK_IS_MISSING = 7
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should keep this as an UNHANDLED_ERROR, so this line of code will not be needed.

message = "Service is Unavailable"


class RPCTaskIsMissing(_RPCError):
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can use the existing RPCUnhandledError, so we will not need this class

}
};

const OPEN_DOCS_LABEL = 'Open docs';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of opening the docs, I think it would be better to generate a clear error message asking the user to use the kale editor to tag the pipeline components. This way the user will not have to leave the page they are on. I believe we can remove this functionality.

refresh: boolean = false,
refresh: boolean = false
): Promise<void> => {
if (error && error.code === RPC_CALL_STATUS.TaskIsMissing) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use the UnhandledError code instead of TaskIsMissing

await showRpcError(this.error, refresh);
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this functionality can be simplified. There is some logic already for handling the UnhandledError messages (RPCUtils.tsx:13-58`) Instead of creating a new error type, I believe this function can be updated instead. I think it would be better to provide an error message directly in the pop-up that instructs the user on how to fix it, rather than directing them to the documentation. Please see #496 for a similar discussion.

@ederign
Copy link
Member

ederign commented Feb 3, 2026

@cordeirops sorry for the delay on the review of this one, we are cleaning the house. :)

Can you take a look on @hmtosi's comments?

@cordeirops
Copy link
Contributor Author

@cordeirops sorry for the delay on the review of this one, we are cleaning the house. :)

Can you take a look on @hmtosi's comments?

@ederign No worries! Sure, I'll take a look at it.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@cordeirops cordeirops force-pushed the issue510 branch 2 times, most recently from b607237 to b62355e Compare February 4, 2026 18:36
- Introduced TaskMissingError to signal when a pipeline lacks steps.
- Updated the compiler to raise TaskMissingError if no steps are present.
- Mapped TaskMissingError to RPCTaskIsMissing for RPC error handling.
- Enhanced error handling in the notebook compilation process to provide user guidance for missing steps.
- Added utility functions in the UI to display informative dialogs for missing pipeline steps.

Signed-off-by: cordeirops <pedro.sbarainicordeiro@gmail.com>
Signed-off-by: cordeirops <pedro.sbarainicordeiro@gmail.com>
Signed-off-by: cordeirops <pedro.sbarainicordeiro@gmail.com>
Signed-off-by: cordeirops <pedro.sbarainicordeiro@gmail.com>
Signed-off-by: cordeirops <pedro.sbarainicordeiro@gmail.com>
Signed-off-by: cordeirops <pedro.sbarainicordeiro@gmail.com>
Signed-off-by: cordeirops <pedro.sbarainicordeiro@gmail.com>
Signed-off-by: cordeirops <pedro.sbarainicordeiro@gmail.com>
Signed-off-by: cordeirops <pedro.sbarainicordeiro@gmail.com>
Signed-off-by: Pedro Sbaraini Cordeiro <pedro.sbarainicordeiro@gmail.com>
Signed-off-by: cordeirops <pedro.sbarainicordeiro@gmail.com>
Signed-off-by: cordeirops <pedro.sbarainicordeiro@gmail.com>
Signed-off-by: cordeirops <pedro.sbarainicordeiro@gmail.com>
@cordeirops cordeirops closed this Feb 4, 2026
@cordeirops cordeirops reopened this Feb 4, 2026
@cordeirops
Copy link
Contributor Author

@hmtosi I’ve made the changes you requested.

When the pipeline does not contain any steps, the error is now displayed as shown below:

Captura de tela de 2026-02-04 17-31-12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] Improve how new Notebooks pipeline name is handled when no metadata is available

5 participants