Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sdk): Throw 'exit_task cannot depend on any other tasks.' error when an ExitHandler has a parameter dependent on other task #11005

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

hbelmiro
Copy link
Contributor

@hbelmiro hbelmiro commented Jul 15, 2024

Due to #11005 (comment), depends on:

Resolves #10187

The issue happens when an ExitHandler has a parameter that depends on other task.

from kfp import dsl
from kfp.dsl import PipelineTaskFinalStatus

@dsl.component
def test_step_a(input: str) -> str:
    return "step-a"


@dsl.component
def test_step_b(input: str, status: PipelineTaskFinalStatus):
    print("step-b")


@dsl.component
def test_step_c(input: str) -> str:
    return "step-c"


@dsl.pipeline
def test_pipeline():
    pre_task = test_step_a(input="pre")
    exit_task = test_step_b(input=pre_task.output)  <--- Here's the problem
    with dsl.ExitHandler(exit_task=exit_task):
        test_step_c(input="test")

If we change that line to:

    exit_task = test_step_b(input="some string")

The pipeline will compile.

This PR aims to show the proper error message when that happens.
This may not be the right approach. I changed the code to check the ExitHandler inputs. It seems to me that

dependent_tasks: List[str]
should contain test_step_a though. But I'm not sure that attribute actually means what I think it does.

Checklist:

Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

return False

return any(
type(task_input) is PipelineParameterChannel
Copy link
Member

Choose a reason for hiding this comment

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

i believe it's more pythontic to use isinstance here instead of manually checking type

Copy link
Contributor

@diegolovison diegolovison Jul 15, 2024

Choose a reason for hiding this comment

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

It depends. type will assert without inheritance. If this is the case, then it is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

type will assert without inheritance.

That said, I think we need isinstance here.

@hbelmiro hbelmiro marked this pull request as draft July 15, 2024 21:08
Copy link

@hbelmiro: The /retest command does not accept any targets.
The following commands are available to trigger required jobs:

  • /test kfp-kubernetes-test-python310
  • /test kfp-kubernetes-test-python311
  • /test kfp-kubernetes-test-python312
  • /test kfp-kubernetes-test-python38
  • /test kfp-kubernetes-test-python39
  • /test kubeflow-pipeline-mkp-snapshot-test
  • /test kubeflow-pipeline-mkp-test
  • /test kubeflow-pipelines-backend-visualization
  • /test kubeflow-pipelines-component-yaml
  • /test kubeflow-pipelines-integration-v2
  • /test kubeflow-pipelines-manifests
  • /test kubeflow-pipelines-sdk-docformatter
  • /test kubeflow-pipelines-sdk-execution-tests
  • /test kubeflow-pipelines-sdk-isort
  • /test kubeflow-pipelines-sdk-python310
  • /test kubeflow-pipelines-sdk-python311
  • /test kubeflow-pipelines-sdk-python312
  • /test kubeflow-pipelines-sdk-python38
  • /test kubeflow-pipelines-sdk-python39
  • /test kubeflow-pipelines-sdk-yapf
  • /test test-kfp-runtime-code-python310
  • /test test-kfp-runtime-code-python311
  • /test test-kfp-runtime-code-python312
  • /test test-kfp-runtime-code-python38
  • /test test-kfp-runtime-code-python39
  • /test test-run-all-gcpc-modules
  • /test test-upgrade-kfp-sdk

The following commands are available to trigger optional jobs:

  • /test kfp-kubernetes-execution-tests
  • /test kubeflow-pipeline-upgrade-test
  • /test kubeflow-pipeline-upgrade-test-v2
  • /test kubeflow-pipelines-samples-v2

Use /test all to run the following jobs that were automatically triggered:

  • kfp-kubernetes-execution-tests
  • kfp-kubernetes-test-python310
  • kfp-kubernetes-test-python311
  • kfp-kubernetes-test-python312
  • kfp-kubernetes-test-python38
  • kfp-kubernetes-test-python39
  • kubeflow-pipelines-component-yaml
  • kubeflow-pipelines-sdk-docformatter
  • kubeflow-pipelines-sdk-execution-tests
  • kubeflow-pipelines-sdk-isort
  • kubeflow-pipelines-sdk-python310
  • kubeflow-pipelines-sdk-python311
  • kubeflow-pipelines-sdk-python312
  • kubeflow-pipelines-sdk-python38
  • kubeflow-pipelines-sdk-python39
  • kubeflow-pipelines-sdk-yapf
  • test-kfp-runtime-code-python310
  • test-kfp-runtime-code-python311
  • test-kfp-runtime-code-python312
  • test-kfp-runtime-code-python38
  • test-kfp-runtime-code-python39
  • test-run-all-gcpc-modules
  • test-upgrade-kfp-sdk

In response to this:

/retest kfp-kubernetes-execution-tests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@hbelmiro
Copy link
Contributor Author

/retest-required

@hbelmiro
Copy link
Contributor Author

kubeflow-pipelines-sdk-execution-tests should not be failing. When I run those tests on GitHub Actions, they pass. (I tried that by copying the workflow from #10975).

@hbelmiro hbelmiro marked this pull request as ready for review July 19, 2024 14:22
Copy link

@hbelmiro: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
kfp-kubernetes-execution-tests 541dfa1 link false /test kfp-kubernetes-execution-tests
kubeflow-pipelines-sdk-execution-tests 541dfa1 link true /test kubeflow-pipelines-sdk-execution-tests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@hbelmiro
Copy link
Contributor Author

@gmfrasca @diegolovison can you guys take a second look, please?
Failing tests are due to #11005 (comment).

Copy link
Member

@chensun chensun left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chensun

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

The pull request process is described here

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

…n ExitHandler has a parameter dependent on other task

Signed-off-by: hbelmiro <helber.belmiro@gmail.com>
@HumairAK
Copy link
Collaborator

/lgtm

@hbelmiro
Copy link
Contributor Author

Copy link
Contributor

@DharmitD DharmitD left a comment

Choose a reason for hiding this comment

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

/lgtm

@google-oss-prow google-oss-prow bot merged commit 08185e7 into kubeflow:master Jul 25, 2024
25 checks passed
@hbelmiro hbelmiro deleted the issue-10187 branch July 25, 2024 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[sdk] ExitHandler doesn't compile with task Inputs
6 participants