Eseguire un processo Processing con Apache Spark
Apache Spark è un motore di analisi unificato per l'elaborazione di dati su larga scala. Amazon SageMaker AI fornisce immagini Docker predefinite che includono Apache Spark e altre dipendenze necessarie per eseguire processi di elaborazione dati distribuiti. Di seguito viene fornito un esempio su come eseguire un processo Amazon SageMaker Processing utilizzando Apache Spark.
Con Amazon SageMaker Python
Un repository di codice che contiene il codice sorgente e i Dockerfile per le immagini Spark è disponibile su GitHub
Puoi usare la classe sagemaker.spark.PySparkProcessorsagemaker.spark.SparkJarProcessor
L'esempio di codice seguente mostra come eseguire un processo di elaborazione che invocano lo script PySpark preprocess.py.
from sagemaker.spark.processing import PySparkProcessor spark_processor = PySparkProcessor( base_job_name="spark-preprocessor", framework_version="2.4", role=role, instance_count=2, instance_type="ml.m5.xlarge", max_runtime_in_seconds=1200, ) spark_processor.run( submit_app="preprocess.py", arguments=['s3_input_bucket', bucket, 's3_input_key_prefix', input_prefix, 's3_output_bucket', bucket, 's3_output_key_prefix', output_prefix] )
Per un'analisi approfondita, consulta il notebook di esempio
Se non utilizzi Amazon SageMaker AI Python SDK
Per ulteriori informazioni sull’utilizzo di SageMaker Python SDK con container Processing, consulta Amazon SageMaker AI Python SDK