Guía de inicio rápido: componentes de flujos de procesamiento de Google Cloud

En esta guía de inicio rápido se explica cómo instalar el SDK deGoogle Cloud componentes de la canalización (GCPC).

Instalar la última versión

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

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

Importar un componente prediseñado con el Google Cloud SDK

Después de instalar el Google Cloud SDK, puedes usarlo para importar un componente prediseñado.

Para obtener información de referencia sobre los componentes admitidos del SDK, consulta la Google Cloud documentación del SDK.

Por ejemplo, puedes usar el siguiente código para importar y usar el componente 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],
    )

Siguientes pasos