From 1afcfbe19ea988de9ed48d4d396a70353e78b294 Mon Sep 17 00:00:00 2001 From: Alex Latchford Date: Wed, 15 Jul 2020 16:37:31 -0700 Subject: [PATCH] Update SDK docs for KFP extensions to follow Sphinx guidelines --- docs/conf.py | 1 - docs/index.rst | 8 ++++---- sdk/python/kfp/aws.py | 8 +++++--- sdk/python/kfp/azure.py | 7 +++---- sdk/python/kfp/dsl/_container_op.py | 2 -- sdk/python/kfp/gcp.py | 11 ++++++----- sdk/python/kfp/onprem.py | 10 ++++++---- 7 files changed, 24 insertions(+), 23 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 6c5f37ce563..3ccece6ddab 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -106,7 +106,6 @@ # The name of the Pygments (syntax highlighting) style to use. pygments_style = None - # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for diff --git a/docs/index.rst b/docs/index.rst index 59375972800..a3944bfcfe2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,8 +3,8 @@ You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to Kubeflow Pipelines SDK API reference -================================================ +Kubeflow Pipelines SDK API +========================== Main documentation: https://www.kubeflow.org/docs/pipelines/ @@ -12,11 +12,11 @@ Source code: https://github.com/kubeflow/pipelines/ .. toctree:: :maxdepth: 3 - :caption: Contents: + :caption: Contents + self source/kfp - .. * :ref:`modindex` .. * :ref:`kfp-ref` .. * :ref:`search` diff --git a/sdk/python/kfp/aws.py b/sdk/python/kfp/aws.py index 338cec288cc..aad8315eb6b 100644 --- a/sdk/python/kfp/aws.py +++ b/sdk/python/kfp/aws.py @@ -15,9 +15,11 @@ def use_aws_secret(secret_name='aws-secret', aws_access_key_id_name='AWS_ACCESS_KEY_ID', aws_secret_access_key_name='AWS_SECRET_ACCESS_KEY'): """An operator that configures the container to use AWS credentials. - AWS doesn't create secret along with kubeflow deployment and it requires users - to manually create credential secret with proper permissions. - --- + AWS doesn't create secret along with kubeflow deployment and it requires users + to manually create credential secret with proper permissions. + + :: + apiVersion: v1 kind: Secret metadata: diff --git a/sdk/python/kfp/azure.py b/sdk/python/kfp/azure.py index 27e1bcd5908..9df2fcb674d 100644 --- a/sdk/python/kfp/azure.py +++ b/sdk/python/kfp/azure.py @@ -15,11 +15,10 @@ def use_azure_secret(secret_name='azcreds'): """An operator that configures the container to use Azure user credentials. - The azcreds secret is created as part of the kubeflow deployment that - stores the client ID and secrets for the kubeflow azure service principal. + The azcreds secret is created as part of the kubeflow deployment that + stores the client ID and secrets for the kubeflow azure service principal. - With this service principal, the container has a range of Azure APIs to - access to. + With this service principal, the container has a range of Azure APIs to access to. """ def _use_azure_secret(task): diff --git a/sdk/python/kfp/dsl/_container_op.py b/sdk/python/kfp/dsl/_container_op.py index 8d462c8c379..a7e04c49be7 100644 --- a/sdk/python/kfp/dsl/_container_op.py +++ b/sdk/python/kfp/dsl/_container_op.py @@ -569,8 +569,6 @@ class UserContainer(Container): Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. Example: :: diff --git a/sdk/python/kfp/gcp.py b/sdk/python/kfp/gcp.py index aaca532af52..8cd8b34bca8 100644 --- a/sdk/python/kfp/gcp.py +++ b/sdk/python/kfp/gcp.py @@ -17,9 +17,9 @@ def use_gcp_secret(secret_name='user-gcp-sa', secret_file_path_in_volume=None, volume_name=None, secret_volume_mount_path='/secret/gcp-credentials'): """An operator that configures the container to use GCP service account by service account key - stored in a Kubernetes secret. + stored in a Kubernetes secret. - For cluster setup and alternatives to using service account key, check https://www.kubeflow.org/docs/gke/authentication-pipelines/. + For cluster setup and alternatives to using service account key, check https://www.kubeflow.org/docs/gke/authentication-pipelines/. """ # permitted values for secret_name = ['admin-gcp-sa', 'user-gcp-sa'] @@ -95,9 +95,10 @@ def use_preemptible_nodepool(toleration: V1Toleration = V1Toleration(effect='NoS value='true'), hard_constraint: bool = False): """An operator that configures the GKE preemptible in a container op. + Args: - toleration (V1Toleration): toleration to pods, default is the preemptible label. - hard_constraint (bool): the constraint of scheduling the pods on preemptible + toleration: toleration to pods, default is the preemptible label. + hard_constraint: the constraint of scheduling the pods on preemptible nodepools is hard. (Default: False) """ @@ -127,7 +128,7 @@ def add_gpu_toleration(toleration: V1Toleration = V1Toleration( """An operator that configures the GKE GPU nodes in a container op. Args: - toleration {V1Toleration} -- toleration to pods, default is the nvidia.com/gpu label. + toleration: toleration to pods, default is the nvidia.com/gpu label. """ def _set_toleration(task): diff --git a/sdk/python/kfp/onprem.py b/sdk/python/kfp/onprem.py index 2df49ba4e20..0a119287f63 100644 --- a/sdk/python/kfp/onprem.py +++ b/sdk/python/kfp/onprem.py @@ -1,9 +1,11 @@ def mount_pvc(pvc_name='pipeline-claim', volume_name='pipeline', volume_mount_path='/mnt/pipeline'): - """ - Modifier function to apply to a Container Op to simplify volume, volume mount addition and - enable better reuse of volumes, volume claims across container ops. - Usage: + """Modifier function to apply to a Container Op to simplify volume, volume mount addition and + enable better reuse of volumes, volume claims across container ops. + + Example: + :: + train = train_op(...) train.apply(mount_pvc('claim-name', 'pipeline', '/mnt/pipeline')) """