SparkResourceConfiguration Class

Compute resource configuration for Spark component or job.

Inheritance
azure.ai.ml.entities._mixins.RestTranslatableMixin
SparkResourceConfiguration
azure.ai.ml.entities._mixins.DictMixin
SparkResourceConfiguration

Constructor

SparkResourceConfiguration(*, instance_type: str | None = None, runtime_version: str | None = None)

Keyword-Only Parameters

Name Description
instance_type

The type of VM to be used by the compute target.

runtime_version

The Spark runtime version.

Examples

Configuring a SparkJob with SparkResourceConfiguration.


   from azure.ai.ml import Input, Output
   from azure.ai.ml.entities._credentials import AmlTokenConfiguration, SparkJob, SparkResourceConfiguration

   spark_job = SparkJob(
       code="./tests/test_configs/spark_job/basic_spark_job/src",
       entry={"file": "./main.py"},
       jars=["simple-1.1.1.jar"],
       identity=AmlTokenConfiguration(),
       driver_cores=1,
       driver_memory="2g",
       executor_cores=2,
       executor_memory="2g",
       executor_instances=2,
       dynamic_allocation_enabled=True,
       dynamic_allocation_min_executors=1,
       dynamic_allocation_max_executors=3,
       name="builder-spark-job",
       experiment_name="builder-spark-experiment-name",
       environment="AzureML-sklearn-1.0-ubuntu20.04-py38-cpu:33",
       inputs={
           "input1": Input(
               type="uri_file", path="azureml://datastores/workspaceblobstore/paths/python/data.csv", mode="direct"
           )
       },
       outputs={
           "output1": Output(
               type="uri_file",
               path="azureml://datastores/workspaceblobstore/spark_titanic_output/titanic.parquet",
               mode="direct",
           )
       },
       resources=SparkResourceConfiguration(instance_type="Standard_E8S_V3", runtime_version="3.3.0"),
   )

Methods

get
has_key
items
keys
update
values

get

get(key: Any, default: Any | None = None) -> Any

Parameters

Name Description
key
Required
default
Default value: None

has_key

has_key(k: Any) -> bool

Parameters

Name Description
k
Required

items

items() -> list

keys

keys() -> list

update

update(*args: Any, **kwargs: Any) -> None

values

values() -> list

Attributes

instance_type_list

instance_type_list = ['standard_e4s_v3', 'standard_e8s_v3', 'standard_e16s_v3', 'standard_e32s_v3', 'standard_e64s_v3']