Guía de inicio rápido: Componentes de la canalización de Google Cloud

En esta guía de inicio rápido, se te guiará a través de la instalación del Google Cloud SDK de componentes de canalización (GCPC).

Instala la versión más reciente

Usa el siguiente comando para instalar el Google Cloud SDK desde el índice de paquetes de Python (PyPI):

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

Importa un componente compilado previamente con el Google Cloud SDK

Después de instalar el Google Cloud SDK, puedes usarlo para importar un componente compilado previamente.

Para obtener información de referencia del SDK para componentes compatibles, consulta la Google Cloud documentación del SDK.

Por ejemplo, puedes usar el siguiente código para importar y usar el componente de Dataflow en una canalización.

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],
    )

¿Qué sigue?