Início rápido: componentes da pipeline Google Cloud

Este guia de início rápido explica a instalação do SDK Google Cloud Pipeline Components (GCPC).

Instale o lançamento mais recente

Use o seguinte comando para instalar o Google Cloud SDK a partir do Python Package Index (PyPI):

pip install --upgrade google-cloud-pipeline-components

Importe um componente pré-criado através do Google Cloud SDK

Depois de instalar o Google Cloud SDK, pode usá-lo para importar um componente pré-criado.

Para informações de referência do SDK para componentes suportados, consulte a Google Cloud documentação do SDK.

Por exemplo, pode usar o código seguinte para importar e usar o componente Dataflow num pipeline.

from google_cloud_pipeline_components.v1.dataflow import DataflowPythonJobOp
from kfp import dsl

@dsl.pipeline(
    name=PIPELINE_NAME,
    description='Dataflow launch python pipeline'
)
def pipeline(
    python_file_path:str = 'gs://ml-pipeline-playground/samples/dataflow/wc/wc.py',
    project_id:str = PROJECT_ID,
    location:str = LOCATION,
    staging_dir:str = PIPELINE_ROOT,
    requirements_file_path:str = 'gs://ml-pipeline-playground/samples/dataflow/wc/requirements.txt',
):
    dataflow_python_op = DataflowPythonJobOp(
        project=project_id,
        location=location,
        python_module_path=python_file_path,
        temp_location = staging_dir,
        requirements_file_path = requirements_file_path,
        args = ['--output', OUTPUT_FILE],
    )

O que se segue?