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

Create lightweight sample #131

Merged
merged 5 commits into from
May 6, 2020

Conversation

kevinyu98
Copy link
Contributor

Which issue is resolved by this Pull Request:
Resolves #

Description of your changes:
This Kubeflow example demonstrates how to create python functions and convert to pipeline operations.
Environment tested:

  • Python Version (use python --version): 3.6.4
  • Tekton Version (use tkn version): 0.11.3
  • Kubernetes Version (use kubectl version): 1.16
  • OS (e.g. from /etc/os-release):

@kubeflow-bot
Copy link

This change is Reviewable

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

You'll be able to see Jupyter notebook diff and discuss changes. Powered by ReviewNB.

@kevinyu98
Copy link
Contributor Author

@Tomcli

@Tomcli
Copy link
Member

Tomcli commented May 1, 2020

@kevinyu98 can you move the images to the images folder? also replace all the spaces in the filename to underscores or dashes?
e.g. move samples/lightweight-component/Tekton divmod.png to samples/lightweight-component/images/Tekton_divmod.png

@@ -0,0 +1,19 @@
# Lightweight python components example
This notebook demonstrates how to compile and execute the pipeline using simple python functions, also known as creating pipeline through lightweight. This notebook is originated from the kubeflow pipeline's [lighweight-component](https://github.com/kubeflow/pipelines/tree/master/samples/core/lightweight_component) example that is running on Kubeflow 0.7. We have modified this notebook to run with Kubeflow 1.x's user namespace separation with Tekton support.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This notebook demonstrates how to compile and execute the pipeline using simple python functions, also known as creating pipeline through lightweight. This notebook is originated from the kubeflow pipeline's [lighweight-component](https://github.com/kubeflow/pipelines/tree/master/samples/core/lightweight_component) example that is running on Kubeflow 0.7. We have modified this notebook to run with Kubeflow 1.x's user namespace separation with Tekton support.
This notebook demonstrates how to compile and execute the pipeline using simple python functions, also known as creating pipeline through lightweight. This notebook is originated from the kubeflow pipeline's [lighweight-component](https://github.com/kubeflow/pipelines/tree/master/samples/core/lightweight_component) example that is running with the KFP API. We have modified this notebook to run with the Tekton compiler and submit the pipeline directly to the Tekton engine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, done.

"cell_type": "markdown",
"metadata": {},
"source": [
"Here are some screenshots to show this pipeline example and result."
Copy link
Member

Choose a reason for hiding this comment

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

Since these images only available after the pipeline execution, can we move these images to the end of the notebook?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

## Prerequisites
- Install [Kubeflow 1.0.2+](https://www.kubeflow.org/docs/started/getting-started/) and connect the cluster to the current shell with `kubectl`
- Install [kfp-tekton](/sdk/README.md#steps) SDK

Copy link
Member

Choose a reason for hiding this comment

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

I think they also need jupyter and other dependencies for the notebook. Can you create a fresh virtual env and make sure we install all the necessary dependencies for this notebook?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I create a new environment, and the notebook can run successfully. I will add the jupyter here.

@@ -0,0 +1,359 @@
{
Copy link
Member

Choose a reason for hiding this comment

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

We don't need notebook checkpoint for GitHub, can you remove this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

"outputs": [],
"source": [
"pipeline_name = \"lightweight-python-demo\"\n",
"user_namespace = \"myproject\""
Copy link
Member

Choose a reason for hiding this comment

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

set this to default namespace until we have Kubeflow as our default requirements.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

"metadata": {},
"outputs": [],
"source": [
"!kubectl create clusterrolebinding $user_namespace-edit --clusterrole kubeflow-edit --serviceaccount=$user_namespace:default\n",
Copy link
Member

Choose a reason for hiding this comment

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

We probably don't need this because we are not using any k8s api.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

"cell_type": "markdown",
"metadata": {},
"source": [
"Assign permission to Tekton's default service account and run this pipeline"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"Assign permission to Tekton's default service account and run this pipeline"
"Run this pipeline"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, missed the comments. Fixed now.

@Tomcli
Copy link
Member

Tomcli commented May 6, 2020

Thanks @kevinyu98
/lgtm

@Tomcli
Copy link
Member

Tomcli commented May 6, 2020

/approve

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Tomcli

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

@k8s-ci-robot k8s-ci-robot merged commit 1726dc5 into kubeflow:master May 6, 2020
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