From 4f0c18e8989cf353019876a73aa57457332e88fb Mon Sep 17 00:00:00 2001 From: "Jonny Browning (Datatonic)" <78856444+browningjp-datatonic@users.noreply.github.com> Date: Thu, 2 Sep 2021 18:19:44 +0100 Subject: [PATCH] docs: Add code sample for Pipelines (#684) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-aiplatform/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) Fixes #683 🦕 --- README.rst | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/README.rst b/README.rst index 1f4462722c..b1daa8f0b1 100644 --- a/README.rst +++ b/README.rst @@ -349,6 +349,47 @@ To delete an endpoint: endpoint.delete() +Pipelines +--------- + +To create a Vertex Pipeline run: + +.. code-block:: Python + + # Instantiate PipelineJob object + pl = PipelineJob( + # Display name is required but seemingly not used + # see https://github.com/googleapis/python-aiplatform/blob/9dcf6fb0bc8144d819938a97edf4339fe6f2e1e6/google/cloud/aiplatform/pipeline_jobs.py#L260 + display_name="My first pipeline", + + # Whether or not to enable caching + # True = always cache pipeline step result + # False = never cache pipeline step result + # None = defer to cache option for each pipeline component in the pipeline definition + enable_caching=False, + + # Local or GCS path to a compiled pipeline definition + template_path="pipeline.json", + + # Dictionary containing input parameters for your pipeline + parameter_values=parameter_values, + + # GCS path to act as the pipeline root + pipeline_root=pipeline_root, + ) + + # Execute pipeline in Vertex + pl.run( + # Email address of service account to use for the pipeline run + # You must have iam.serviceAccounts.actAs permission on the service account to use it + service_account=service_account, + + # Whether this function call should be synchronous (wait for pipeline run to finish before terminating) + # or asynchronous (return immediately) + sync=sync + ) + + Explainable AI: Get Metadata ----------------------------