Guia de início rápido: componentes de pipeline do Google Cloud

Neste guia de início rápido, orientamos você na instalação do SDK dos componentes de pipeline do Google Cloud (GCPC).Google Cloud

Instalar versão mais recente

Use o seguinte comando para instalar o SDK Google Cloud do índice de pacotes do Python (PyPI):

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

Importar um componente pré-criado usando o SDK do Google Cloud

Depois de instalar o SDK Google Cloud , é possível usá-lo para importar um componente pré-compilado.

Para informações de referência do SDK sobre os componentes compatíveis, consulte a documentação do SDKGoogle Cloud .

Por exemplo, é possível usar o código a seguir para importar e usar o componente do Dataflow em um 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],
    )

A seguir