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): Add local runner which will run ops in docker or locally. Fixes #1138 #4983

Merged
merged 17 commits into from
Feb 24, 2021
Merged

feat(sdk): Add local runner which will run ops in docker or locally. Fixes #1138 #4983

merged 17 commits into from
Feb 24, 2021

Conversation

lynnmatrix
Copy link
Member

@lynnmatrix lynnmatrix commented Jan 13, 2021

Description of your changes:
Add local runner which will run ops in docker or locally.
kfp.run_pipeline_func_locally(my_pipeline, arguments={...})

Fixes #1138

@k8s-ci-robot
Copy link
Contributor

Hi @lynnmatrix. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

sdk/python/kfp/_runners.py Outdated Show resolved Hide resolved
@Ark-kun
Copy link
Contributor

Ark-kun commented Jan 14, 2021

Thank you for this tremendous work.
/ok-to-test

@lynnmatrix
Copy link
Member Author

@Ark-kun This feature requires docker in CI environment, need your help.

@Ark-kun Ark-kun self-assigned this Jan 14, 2021
@Bobgy
Copy link
Contributor

Bobgy commented Jan 19, 2021

/assign @chensun @numerology

@lynnmatrix
Copy link
Member Author

Should I remove the dependency to docker in unit test?

@numerology
Copy link

numerology commented Jan 19, 2021

Should I remove the dependency to docker in unit test?

I think the more sustainable way is actually declaring docker as a test-only dependency by something like

extra_requires = {
    'test': ['docker']}

and then pip install -e .[test] will also install docker.

Or you can simply add docker installation to https://github.com/kubeflow/pipelines/blob/master/test/presubmit-tests-sdk.sh

Copy link

@numerology numerology left a comment

Choose a reason for hiding this comment

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

Thanks!

sdk/python/kfp/_local_client.py Outdated Show resolved Hide resolved
sdk/python/kfp/_local_client.py Outdated Show resolved Hide resolved
sdk/python/kfp/_local_client.py Outdated Show resolved Hide resolved
sdk/python/kfp/_local_client.py Outdated Show resolved Hide resolved
@numerology
Copy link

@Bobgy

Do you remember what's the recommended way of using docker in our test fixture? IIRC it's something similar to dind, right?

@lynnmatrix
Copy link
Member Author

/retest

@Bobgy
Copy link
Contributor

Bobgy commented Jan 20, 2021

It's very challenging to use docker within current presubmit process. Let me take another look at this PR soon.

@lynnmatrix
Copy link
Member Author

Yes, I tried to install docker in presubmit process which run in k8s container, but failed. I have no experience in dind.
I disable tests which depend on docker for now, and the CI pipeline succeed, I will reopen the test if we find way to run docker in presubmit process

It's very challenging to use docker within current presubmit process. Let me take another look at this PR soon.

Copy link

@numerology numerology left a comment

Choose a reason for hiding this comment

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

Thanks! A general question of mine is that, do we know what's the current limitation of this local runner? For example, does it support control flow features like recursion/condition?

sdk/python/kfp/__init__.py Show resolved Hide resolved
sdk/python/kfp/_local_client.py Show resolved Hide resolved
sdk/python/kfp/_local_client.py Outdated Show resolved Hide resolved
@lynnmatrix
Copy link
Member Author

/test kubeflow-pipelines-tfx-python36

sdk/python/kfp/_local_client.py Show resolved Hide resolved
sdk/python/kfp/_local_client.py Outdated Show resolved Hide resolved
sdk/python/kfp/_local_client.py Outdated Show resolved Hide resolved
sdk/python/kfp/_local_client.py Outdated Show resolved Hide resolved
@Ark-kun
Copy link
Contributor

Ark-kun commented Jan 29, 2021

I tried to install docker in presubmit process which run in k8s container, but failed. I have no experience in dind.

Our sample tests use dind:

- name: build-image-by-dockerfile

It's probably fine to skip that in the initial PR. You can make another PR where you add the docker tests to sample tests.

@Ark-kun
Copy link
Contributor

Ark-kun commented Feb 18, 2021

Thank you for you great contribution
/lgtm
/approve

@Ark-kun
Copy link
Contributor

Ark-kun commented Feb 18, 2021

/hold

@Ark-kun
Copy link
Contributor

Ark-kun commented Feb 18, 2021

I approve this PR, but I'd like let Ajay have a look.

@Ark-kun
Copy link
Contributor

Ark-kun commented Feb 18, 2021

/retest

Copy link
Contributor

@neuromage neuromage left a comment

Choose a reason for hiding this comment

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

Many thanks for this @lynnmatrix! This looks great! Left some comments/discussion points in the PR.

sdk/python/kfp/_local_client.py Outdated Show resolved Hide resolved
sdk/python/kfp/_local_client.py Outdated Show resolved Hide resolved
sdk/python/kfp/_local_client.py Outdated Show resolved Hide resolved
sdk/python/kfp/_local_client.py Outdated Show resolved Hide resolved
sdk/python/tests/local_runner_test.py Outdated Show resolved Hide resolved
sdk/python/kfp/_local_client.py Outdated Show resolved Hide resolved
sdk/python/kfp/_runners.py Show resolved Hide resolved
sdk/python/kfp/_local_client.py Show resolved Hide resolved
sdk/python/kfp/_local_client.py Outdated Show resolved Hide resolved
sdk/python/kfp/_local_client.py Outdated Show resolved Hide resolved
@Ark-kun
Copy link
Contributor

Ark-kun commented Feb 20, 2021

Thank you for review, Ajay. Good points.

@k8s-ci-robot k8s-ci-robot removed the lgtm label Feb 20, 2021
@google-oss-robot
Copy link

New changes are detected. LGTM label has been removed.

@lynnmatrix lynnmatrix requested a review from neuromage February 22, 2021 09:29
@lynnmatrix
Copy link
Member Author

@neuromage Thanks for your review from which I have learned much.
Please review again.

return kfp.dsl.ContainerOp(
name="echo",
image=BASE_IMAGE,
command=["echo", "hello world", ">", "/tmp/outputs/output_file"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, thanks for adding this test!

@neuromage
Copy link
Contributor

/lgtm

Many thanks @lynnmatrix! Really nice PR. This has been a much requested feature and will go a long way towards helping users develop/debug locally.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Ark-kun, lynnmatrix, neuromage

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

1 similar comment
@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Ark-kun, lynnmatrix, neuromage

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

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.

Enable local test runner for Kubeflow Pipelines
10 participants