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

feat(sdk): support local pipeline execution #localexecution #10423

Merged
merged 2 commits into from
Jan 29, 2024

Conversation

connor-mccarthy
Copy link
Member

@connor-mccarthy connor-mccarthy commented Jan 23, 2024

Description of your changes:
Enables running a pipeline locally:

from kfp import dsl
from kfp import local

local.init(runner=local.SubprocessRunner())


@dsl.component
def add(a: int, b: int) -> int:
    return a + b


@dsl.pipeline
def my_pipeline(num: int) -> int:
    t1 = add(a=num, b=2)
    t2 = add(a=t1.output, b=3)
    return t2.output


task = my_pipeline(num=1)
print(f'Got result: {task.output}')

Currently:

  • Only sequential pipelines are supported. Control flow features (dsl.Condition, dsl.ParallelFor, and dsl.ExitHandler) are not supported yet.
  • dsl.importeris not supported yet.
  • Pipeline-in-pipeline is not supported yet.
  • Passing data via f-strings is not supported.

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

@connor-mccarthy
Copy link
Member Author

/assign @chensun

@connor-mccarthy
Copy link
Member Author

/retest

@connor-mccarthy connor-mccarthy force-pushed the local-pipeline branch 9 times, most recently from c925921 to 9810542 Compare January 27, 2024 00:49
@connor-mccarthy
Copy link
Member Author

/retest

1 similar comment
@connor-mccarthy
Copy link
Member Author

/retest

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

pipeline_spec=self.pipeline_spec,
arguments=args,
)
elif self.component_spec is not None:
Copy link
Member

Choose a reason for hiding this comment

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

The two branches possibly need to be merged, otherwise I suspect we may run into bugs for components with DagSpec.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this LOC should not be hit for the case of a pipeline in a pipeline, since execute_locally would be False (passed in here). For condition and iteration DagSpecs, there is no associated PipelineTask so this LOC would also not be hit.

Is there another case you had in mind?

In my WIP implementation of pipeline-in-pipeline local execution, I've also not hit an issue in this location.

sdk/python/kfp/dsl/types/type_utils.py Show resolved Hide resolved

Returns:
If DAG succeeds, a two-tuple of: (Status.SUCCESS, None).
If DAG fails, a two-tuple of: (Status.FAILURE, '<task-that-failed>').
Copy link
Member

Choose a reason for hiding this comment

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

This interface implies the failed task must be from the the top level? A better option would be using a chain of names in case the task failed is nested in layers of dags.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that makes sense. Since in the current PR this would only amount to wrapping this single element in a list, can we wait to implement this until the implementation of local pipelines-in-pipelines? I think that specific feature will make the motivation for such a data structure clear.

sdk/python/kfp/local/dag_orchestrator.py Outdated Show resolved Hide resolved
sdk/python/kfp/local/dag_orchestrator.py Show resolved Hide resolved
sdk/python/kfp/local/dag_orchestrator.py Show resolved Hide resolved
sdk/python/kfp/local/graph_utils.py Show resolved Hide resolved
sdk/python/kfp/local/graph_utils_test.py Outdated Show resolved Hide resolved
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

Thanks!

@google-oss-prow google-oss-prow bot added the lgtm label Jan 29, 2024
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

Copy link

@connor-mccarthy: 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
kubeflow-pipelines-sdk-execution-tests c0be34c link true /test kubeflow-pipelines-sdk-execution-tests
kfp-kubernetes-execution-tests c0be34c link false /test 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/test-infra repository. I understand the commands that are listed here.

@connor-mccarthy connor-mccarthy merged commit 442d457 into kubeflow:master Jan 29, 2024
25 of 28 checks passed
@connor-mccarthy connor-mccarthy changed the title feat(sdk): support local pipeline execution feat(sdk): support local pipeline execution #localexecution Feb 8, 2024
roytman pushed a commit to roytman/pipelines that referenced this pull request Feb 14, 2024
* local pipeline implementation

* address review feedback

Signed-off-by: Alexey Roytman <roytman@il.ibm.com>
stijntratsaertit pushed a commit to stijntratsaertit/kfp that referenced this pull request Feb 16, 2024
* local pipeline implementation

* address review feedback
petethegreat pushed a commit to petethegreat/pipelines that referenced this pull request Mar 27, 2024
* local pipeline implementation

* address review feedback
petethegreat pushed a commit to petethegreat/pipelines that referenced this pull request Mar 29, 2024
* local pipeline implementation

* address review feedback
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.

2 participants