SparkJob 類別
獨立 Spark 作業。
- 繼承
-
azure.ai.ml.entities._job.job.JobSparkJobazure.ai.ml.entities._job.parameterized_spark.ParameterizedSparkSparkJobazure.ai.ml.entities._job.job_io_mixin.JobIOMixinSparkJobazure.ai.ml.entities._job.spark_job_entry_mixin.SparkJobEntryMixinSparkJob
建構函式
SparkJob(*, driver_cores: int | None = None, driver_memory: str | None = None, executor_cores: int | None = None, executor_memory: str | None = None, executor_instances: int | None = None, dynamic_allocation_enabled: bool | None = None, dynamic_allocation_min_executors: int | None = None, dynamic_allocation_max_executors: int | None = None, inputs: Dict | None = None, outputs: Dict | None = None, compute: str | None = None, identity: Dict[str, str] | ManagedIdentityConfiguration | AmlTokenConfiguration | UserIdentityConfiguration | None = None, resources: Dict | SparkResourceConfiguration | None = None, **kwargs)
參數
每個執行程式進程使用的記憶體數量,格式化為大小單位尾碼為 (「k」、「m」、「g」 或 「t」) (的字串,例如 「512m」、「2g」) 。
- identity
- Optional[Union[dict[str, str], ManagedIdentityConfiguration, AmlTokenConfiguration, UserIdentityConfiguration]]
在計算上執行時,Spark 作業將使用的身分識別。
範例
設定 SparkJob。
from azure.ai.ml import Input, Output
from azure.ai.ml.entities import SparkJob
spark_job = SparkJob(
code="./sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/spark_job_in_pipeline/basic_src",
entry={"file": "sampleword.py"},
conf={
"spark.driver.cores": 2,
"spark.driver.memory": "1g",
"spark.executor.cores": 1,
"spark.executor.memory": "1g",
"spark.executor.instances": 1,
},
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"
)
},
compute="synapsecompute",
outputs={"component_out_path": Output(type="uri_folder")},
args="--input1 ${{inputs.input1}} --output2 ${{outputs.output1}} --my_sample_rate ${{inputs.sample_rate}}",
)
方法
dump |
以 YAML 格式將作業內容傾印到檔案中。 |
filter_conf_fields |
篩選出 conf 屬性的欄位,這些欄位不在 ~azure.ai.ml._schema.job.parameterized_spark 中列出的 Spark 組態欄位中。CONF_KEY_MAP並在自己的字典中傳回它們。 |
dump
以 YAML 格式將作業內容傾印到檔案中。
dump(dest: str | PathLike | IO, **kwargs) -> None
參數
要寫入 YAML 內容的本機路徑或檔案資料流程。 如果 dest 是檔案路徑,則會建立新的檔案。 如果 dest 是開啟的檔案,則會直接寫入檔案。
- kwargs
- dict
要傳遞至 YAML 序列化程式的其他引數。
例外狀況
如果 dest 是檔案路徑且檔案已經存在,則引發。
如果 dest 是開啟的檔案,而且無法寫入檔案,則引發。
filter_conf_fields
篩選出 conf 屬性的欄位,這些欄位不在 ~azure.ai.ml._schema.job.parameterized_spark 中列出的 Spark 組態欄位中。CONF_KEY_MAP並在自己的字典中傳回它們。
filter_conf_fields() -> Dict[str, str]
傳回
不是 Spark 組態欄位之 conf 欄位的字典。
傳回類型
例外狀況
如果 dest 是檔案路徑且檔案已經存在,則引發。
如果 dest 是開啟的檔案,而且無法寫入檔案,則引發。
屬性
base_path
creation_context
entry
environment
要執行 Spark 元件或作業的 Azure ML 環境。
傳回
要執行 Spark 元件或作業的 Azure ML 環境。
傳回類型
id
identity
在計算上執行時,Spark 作業將使用的身分識別。
傳回
在計算上執行時,Spark 作業將使用的身分識別。
傳回類型
inputs
log_files
outputs
resources
status
工作的狀態。
傳回的常見值包括 「Running」、「Completed」 和 「Failed」。 所有可能的值為:
NotStarted - 這是用戶端 Run 物件在雲端提交之前所在的暫時狀態。
啟動 - 執行已在雲端中開始處理。 呼叫端此時有執行識別碼。
布建 - 針對指定的作業提交建立隨選計算。
準備 - 正在準備執行環境,且處於兩個階段之一:
Docker 映射組建
conda 環境設定
已排入佇列 - 作業會排入計算目標上的佇列。 例如,在 BatchAI 中,作業處於佇列狀態
等候所有要求的節點準備就緒時。
執行 - 作業已開始在計算目標上執行。
完成 - 使用者程式碼執行已完成,且執行處於後續處理階段。
CancelRequested - 已要求取消作業。
已完成 - 執行已順利完成。 這包括使用者程式碼執行和執行
後續處理階段。
失敗 - 執行失敗。 執行上的 Error 屬性通常會提供原因的詳細資料。
已取消 - 遵循取消要求,並指出現在已成功取消執行。
NotResponding - 針對已啟用活動訊號的執行,最近不會傳送活動訊號。
傳回
作業的狀態。
傳回類型
studio_url
type
CODE_ID_RE_PATTERN
CODE_ID_RE_PATTERN = re.compile('\\/subscriptions\\/(?P<subscription>[\\w,-]+)\\/resourceGroups\\/(?P<resource_group>[\\w,-]+)\\/providers\\/Microsoft\\.MachineLearningServices\\/workspaces\\/(?P<workspace>[\\w,-]+)\\/codes\\/(?P<co)
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應