Questa guida rapida ti guida nell'installazione dell'SDK Google Cloud Pipeline Components (GCPC).
Installa l'ultima release
Utilizza il seguente comando per installare l'SDK Google Cloud dall'indice dei pacchetti Python (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 documentazione dell'SDKGoogle Cloud .
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
- Leggi l'introduzione a Google Cloud Pipeline Components.
- Visualizza tutti i tutorial che utilizzano l'
google_cloud_pipeline_components
SDK. - Inizia a utilizzare i componenti Dataflow.