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: Update containerized-python-components.md. fixes #3871 #3873

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

stephenleo
Copy link
Contributor

@stephenleo stephenleo commented Sep 14, 2024

This PR fixes the documentation for containerized Python components. The current documentation doesn't work and errors out as described in #3871

  • Move the import into the component
  • Update base_image to Python 3.11
  • Import the component in pipeline.py

Minor updates to make the documentation work

Signed-off-by: Marie Stephen Leo <[email protected]>
Copy link

Hi @stephenleo. 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.

@stephenleo
Copy link
Contributor Author

@kubeflow/kubeflow-steering-committee can please help to review this change?

Copy link
Member

@Arhell Arhell left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@@ -62,17 +62,18 @@ src/
In this step, you'll provide `base_image` and `target_image` arguments to the `@dsl.component` decorator of your component in `src/my_component.py`:

```python
@dsl.component(base_image='python:3.7',
@dsl.component(base_image='python:3.11',
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use Python 3.9, which is still supported?

Copy link
Contributor

Choose a reason for hiding this comment

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

We support any >= 3.9 and due to that it is the website. It is fine to use 3.11

Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we use 3.12 then? I mean, the lowest or the highest.

Copy link
Contributor

Choose a reason for hiding this comment

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

It can be anything as long as it matches one of the items declared in: https://github.com/kubeflow/pipelines/blob/master/sdk/python/setup.py#L100

return add_numbers(a, b)
```

Setting `target_image` both (a) specifies the [tag][image-tag] for the image you'll build in Step 3, and (b) instructs KFP to run the decorated Python function in a container that uses the image with that tag.

In a Containerized Python Component, `base_image` specifies the base image that KFP will use when building your new container image. Specifically, KFP uses the `base_image` argument for the [`FROM`][docker-from] instruction in the Dockerfile used to build your image.

The previous example includes `base_image` for clarity, but this is not necessary as `base_image` will default to `'python:3.7'` if omitted.
The previous example includes `base_image` for clarity, but this is not necessary as `base_image` will default to `'python:3.11'` if omitted.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above regarding Python 3.9.

Copy link
Contributor

@diegolovison diegolovison Sep 19, 2024

Choose a reason for hiding this comment

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

As mentioned earlier, I’m open to either Python 3.9 or Python 3.11. I trust your judgment, so whichever you choose works for me.

@hbelmiro
Copy link
Contributor

@diegolovison are you willing to take a look at this?

@hbelmiro
Copy link
Contributor

@stephenleo can you edit #3873 (comment) to link this PR to the issue?

@diegolovison
Copy link
Contributor

/lgtm

Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hbelmiro

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

@google-oss-prow google-oss-prow bot merged commit d9ae92b into kubeflow:master Sep 19, 2024
6 checks passed
@stephenleo stephenleo deleted the patch-1 branch September 27, 2024 12:09
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.

4 participants