Guida rapida: componenti della pipeline Google Cloud

Questa guida rapida ti illustra come installare l'SDK dei Google Cloud componenti della pipeline (GCPC).

Installa l'ultima release

Utilizza il seguente comando per installare l' Google Cloud SDK da Python Package Index (PyPI):

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

Importa un componente predefinito utilizzando l' Google Cloud SDK

Dopo aver installato l' Google Cloud SDK, puoi utilizzarlo per importare un componente predefinito.

Per informazioni di riferimento sull'SDK per i componenti supportati, consulta la Google Cloud documentazione dell'SDK.

Ad esempio, puoi utilizzare il seguente codice per importare e utilizzare il componente Dataflow in una 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],
    )

Passaggi successivi