DatabricksStep 類別

建立 Azure ML 管線步驟,以將 DataBricks 筆記本、Python 腳本或 JAR 新增為節點。

如需使用 DatabricksStep 的範例,請參閱筆記本 https://aka.ms/pl-databricks

建立 Azure ML 管線步驟,以將 DataBricks 筆記本、Python 腳本或 JAR 新增為節點。

如需使用 DatabricksStep 的範例,請參閱筆記本 https://aka.ms/pl-databricks

:p aram python_script_name:[必要] 相對於 的 Python 腳本 source_directory 名稱。 如果腳本接受輸入和輸出,這些會以參數的形式傳遞至腳本。 如果 python_script_name 已指定 ,則 source_directory 也必須指定 。

指定 、、 python_script_namemain_class_namenotebook_pathpython_script_path 其中一個 。

如果您將 DataReference 物件指定為 輸入,且具有 data_reference_name=input1 和 PipelineData 物件做為輸出 名稱=output1,則輸入和輸出會以參數的形式傳遞至腳本。 這是它們的外觀,您必須剖析腳本中的引數,以存取每個輸入和輸出的路徑: 「-input1」、「wasbs:///test」,「-output1」、「wasbs:// test@storagename.blob.core.windows.nettest@storagename.blob.core.windows.net /b3e26de1-87a4-494d-a20f-1988d2b81a2/output1」

此外,腳本中也會提供下列參數:

  • AZUREML_RUN_TOKEN:使用 Azure Machine Learning 進行驗證的 AML 權杖。
  • AZUREML_RUN_TOKEN_EXPIRY:AML 權杖到期時間。
  • AZUREML_RUN_ID:此回合的 Azure Machine Learning 執行識別碼。
  • AZUREML_ARM_SUBSCRIPTION:AML 工作區的 Azure 訂用帳戶。
  • AZUREML_ARM_RESOURCEGROUP:適用于 Azure Machine Learning 工作區的 Azure 資源群組。
  • AZUREML_ARM_WORKSPACE_NAME:Azure Machine Learning 工作區的名稱。
  • AZUREML_ARM_PROJECT_NAME:Azure Machine Learning 實驗的名稱。
  • AZUREML_SERVICE_ENDPOINT:AML 服務的端點 URL。
  • AZUREML_WORKSPACE_ID:Azure Machine Learning 工作區的識別碼。
  • AZUREML_EXPERIMENT_ID:Azure Machine Learning 實驗的識別碼。
  • AZUREML_SCRIPT_DIRECTORY_NAME:已複製source_directory之 DBFS 中的目錄路徑。
  (This parameter is only populated when `python_script_name` is used.  See more details below.)

當您使用 DatabricksStep 參數 source_directorypython_script_name Databricks 上的本機電腦上執行 Python 腳本時,您的source_directory會複製到 DBFS,而 DBFS 上的目錄路徑會在腳本開始執行時當做參數傳遞至腳本。 此參數會標示為 –AZUREML_SCRIPT_DIRECTORY_NAME。 您必須在字串 「dbfs:/」 或 「/dbfs/」 前面加上前置詞,才能存取 DBFS 中的目錄。

繼承
azureml.pipeline.core._databricks_step_base._DatabricksStepBase
DatabricksStep

建構函式

DatabricksStep(name, inputs=None, outputs=None, existing_cluster_id=None, spark_version=None, node_type=None, instance_pool_id=None, num_workers=None, min_workers=None, max_workers=None, spark_env_variables=None, spark_conf=None, init_scripts=None, cluster_log_dbfs_path=None, notebook_path=None, notebook_params=None, python_script_path=None, python_script_params=None, main_class_name=None, jar_params=None, python_script_name=None, source_directory=None, hash_paths=None, run_name=None, timeout_seconds=None, runconfig=None, maven_libraries=None, pypi_libraries=None, egg_libraries=None, jar_libraries=None, rcran_libraries=None, compute_target=None, allow_reuse=True, version=None, permit_cluster_restart=None)

參數

name
str
必要

[必要]步驟的名稱。

inputs
list[Union[InputPortBinding, DataReference, PortDataReference, PipelineData]]
預設值: None

此步驟所取用資料的輸入連接清單。 使用 dbutils.widgets.get (「input_name」) 在筆記本內擷取此專案。 可以是 DataReference 或 PipelineData。 DataReference 代表資料存放區上的現有資料片段。 基本上,這是資料存放區上的路徑。 DatabricksStep 支援封裝 DBFS、Azure Blob 或 ADLS v1 的資料存放區。 PipelineData 代表管線中另一個步驟所產生的中繼資料。

outputs
list[Union[OutputPortBinding, PipelineOutputAbstractDataset, PipelineData]]
預設值: None

此步驟所產生的輸出輸出埠定義清單。 使用 dbutils.widgets.get (「output_name」) 在筆記本內擷取此專案。 應該是 PipelineData。

existing_cluster_id
str
預設值: None

Databricks 工作區上現有互動式叢集的叢集識別碼。 如果您要傳遞此參數,則無法傳遞下列任何用來建立新叢集的參數:

  • spark_version
  • node_type
  • instance_pool_id
  • num_workers
  • min_workers
  • max_workers
  • spark_env_variables
  • spark_conf

注意:若要建立新的作業叢集,您必須傳遞上述參數。 您可以直接傳遞這些參數,或者您可以使用 runconfig 參數作為 RunConfiguration 物件的一部分傳遞這些參數。 直接傳遞這些參數並透過 RunConfiguration 會導致錯誤。

spark_version
str
預設值: None

Databricks 的 Spark 版本會執行叢集,例如:「10.4.x-scala2.12」。 如需詳細資訊,請參閱 參數的描述 existing_cluster_id

node_type
str
預設值: None

[必要]Databricks 執行的叢集的 Azure VM 節點類型,例如:「Standard_D3_v2」。 請指定 node_typeinstance_pool_id。 如需詳細資訊,請參閱 參數的描述 existing_cluster_id

instance_pool_id
str
預設值: None

[必要]必須連結叢集的實例集區識別碼。 請指定 node_typeinstance_pool_id。 如需詳細資訊,請參閱 參數的描述 existing_cluster_id

num_workers
int
預設值: None

[必要]Databricks 執行叢集的靜態背景工作角色數目。 您必須指定 或 同時 min_workers 指定 num_workersmax_workers 。 如需詳細資訊,請參閱 參數的描述 existing_cluster_id

min_workers
int
預設值: None

[必要]用於自動調整 Databricks 執行叢集的背景工作角色數目下限。 您必須指定 或 同時 min_workers 指定 num_workersmax_workers 。 如需詳細資訊,請參閱 參數的描述 existing_cluster_id

max_workers
int
預設值: None

[必要]用於自動調整 Databricks 執行叢集的背景工作角色數目上限。 您必須指定 或 同時 min_workers 指定 num_workersmax_workers 。 如需詳細資訊,請參閱 參數的描述 existing_cluster_id

spark_env_variables
dict
預設值: None

Databricks 執行叢集的 Spark 環境變數。 如需詳細資訊,請參閱 參數的描述 existing_cluster_id

spark_conf
dict
預設值: None

Databricks 執行的叢集的 Spark 組態。 如需詳細資訊,請參閱 參數的描述 existing_cluster_id

init_scripts
[str]
預設值: None

已取代。 Databricks 宣佈儲存在 DBFS 中的 init 腳本將在 2023 年 12 月 1 日後停止運作。 若要減輕此問題,請 1) 在 databricks 中使用全域 init 腳本,下列 https://learn.microsoft.com/azure/databricks/init-scripts/global 2) 批註化 AzureML databricks 步驟中的init_scripts行。

cluster_log_dbfs_path
str
預設值: None

要傳遞叢集記錄的 DBFS 路徑。

notebook_path
str
預設值: None

[必要]Databricks 實例中筆記本的路徑。 這個類別允許四種方式來指定要在 Databricks 叢集上執行的程式碼。

  1. 若要執行 Databricks 工作區中的筆記本,請使用: notebook_path=notebook_path,notebook_params={'myparam': 'testparam'}

  2. 若要執行 DBFS 中存在的 Python 腳本,請使用:python_script_path=python_script_dbfs_path、python_script_params={'arg1'、'arg2'}

  3. 若要執行 DBFS 中存在的 JAR,請使用:main_class_name=main_jar_class_name、jar_params={'arg1'、'arg2'}、jar_libraries=[JarLibrary (jar_library_dbfs_path) ]

  4. 若要執行存在於本機電腦上的 Python 腳本,請使用:python_script_name=python_script_name,source_directory=source_directory

指定 、、 python_script_namemain_class_namenotebook_pathpython_script_path 其中一個 。

notebook_params
dict[str, Union[str, PipelineParameter]]
預設值: None

要傳遞至筆記本的參數字典。 notebook_params 以小工具的形式提供。 您可以使用 dbutils.widgets.get (「myparam」) ,從筆記本內的這些小工具擷取值。

python_script_path
str
預設值: None

[必要]DBFS 中 Python 腳本的路徑。 指定 、、 python_script_namemain_class_namenotebook_pathpython_script_path 其中一個 。

python_script_params
list[str, PipelineParameter]
預設值: None

Python 腳本的參數。

main_class_name
str
預設值: None

[必要]JAR 模組中進入點的名稱。 指定 、、 python_script_namemain_class_namenotebook_pathpython_script_path 其中一個 。

jar_params
list[str, PipelineParameter]
預設值: None

JAR 模組的參數。

python_script_name
str
預設值: None

[必要]相對於 的 Python 腳本 source_directory 名稱。 如果腳本接受輸入和輸出,這些會以參數的形式傳遞至腳本。 如果 python_script_name 已指定 ,則 source_directory 也必須指定 。

指定 、、 python_script_namemain_class_namenotebook_pathpython_script_path 其中一個 。

如果您將 DataReference 物件指定為 輸入,且具有 data_reference_name=input1 和 PipelineData 物件做為輸出 名稱=output1,則輸入和輸出會以參數的形式傳遞至腳本。 這是它們的外觀,您必須剖析腳本中的引數,以存取每個輸入和輸出的路徑: 「-input1」、「wasbs:///test」,「-output1」、「wasbs:// test@storagename.blob.core.windows.nettest@storagename.blob.core.windows.net /b3e26de1-87a4-494d-a20f-1988d2b81a2/output1」

此外,腳本中也會提供下列參數:

  • AZUREML_RUN_TOKEN:使用 Azure Machine Learning 進行驗證的 AML 權杖。
  • AZUREML_RUN_TOKEN_EXPIRY:AML 權杖到期時間。
  • AZUREML_RUN_ID:此回合的 Azure Machine Learning 執行識別碼。
  • AZUREML_ARM_SUBSCRIPTION:AML 工作區的 Azure 訂用帳戶。
  • AZUREML_ARM_RESOURCEGROUP:適用于 Azure Machine Learning 工作區的 Azure 資源群組。
  • AZUREML_ARM_WORKSPACE_NAME:Azure Machine Learning 工作區的名稱。
  • AZUREML_ARM_PROJECT_NAME:Azure Machine Learning 實驗的名稱。
  • AZUREML_SERVICE_ENDPOINT:AML 服務的端點 URL。
  • AZUREML_WORKSPACE_ID:Azure Machine Learning 工作區的識別碼。
  • AZUREML_EXPERIMENT_ID:Azure Machine Learning 實驗的識別碼。
  • AZUREML_SCRIPT_DIRECTORY_NAME:已複製source_directory之 DBFS 中的目錄路徑。 (只有在使用 時 python_script_name 才會填入此參數。請參閱下方的詳細資料。)

當您使用 DatabricksStep 參數 source_directorypython_script_name Databricks 上的本機電腦上執行 Python 腳本時,您的source_directory會複製到 DBFS,而 DBFS 上的目錄路徑會在腳本開始執行時當做參數傳遞至腳本。 此參數會標示為 –AZUREML_SCRIPT_DIRECTORY_NAME。 您必須在字串 「dbfs:/」 或 「/dbfs/」 前面加上前置詞,才能存取 DBFS 中的目錄。

source_directory
str
預設值: None

包含腳本和其他檔案的資料夾。 如果 python_script_name 已指定 ,則 source_directory 也必須指定 。

hash_paths
[str]
預設值: None

已淘汰:不再需要。

檢查步驟內容的變更時,雜湊的路徑清單。 如果未偵測到任何變更,管線將會重複使用上一次執行的步驟內容。 根據預設,的內容 source_directory 會雜湊,但 .amlignore 或 .gitignore 中列出的檔案除外。

run_name
str
預設值: None

此執行的 Databricks 中的名稱。

timeout_seconds
int
預設值: None

Databricks 執行的逾時。

runconfig
RunConfiguration
預設值: None

要使用的 runconfig。

注意:您可以使用下列參數,將所需的程式庫數目傳遞至作業: maven_libraries 、、 pypi_librariesegg_librariesjar_librariesrcran_libraries 。 請直接使用其對應的參數傳遞這些參數,或使用 參數作為 RunConfiguration 物件的 runconfig 一部分,但不能同時傳遞兩者。

maven_libraries
list[MavenLibrary]
預設值: None

用於 Databricks 執行的 Maven 程式庫。

pypi_libraries
list[PyPiLibrary]
預設值: None

要用於 Databricks 執行的 PyPi 程式庫。

egg_libraries
list[EggLibrary]
預設值: None

要用於 Databricks 執行的加入程式庫。

jar_libraries
list[JarLibrary]
預設值: None

要用於 Databricks 執行的 Jar 程式庫。

rcran_libraries
list[RCranLibrary]
預設值: None

用於 Databricks 執行的 RCran 程式庫。

compute_target
str, DatabricksCompute
預設值: None

[必要]Azure Databricks 計算。 您必須先將 Azure Databricks 工作區新增為計算目標,才能使用 DatabricksStep 在 Azure Databricks 工作區上執行腳本或筆記本。

allow_reuse
bool
預設值: True

指出當使用相同的設定重新執行時,此步驟是否應該重複使用先前的結果。 預設會啟用重複使用。 如果步驟內容 (腳本/相依性) 以及輸入和參數保持不變,則會重複使用此步驟上一次執行的輸出。 重複使用步驟時,不會提交要計算的作業,而是立即提供給任何後續步驟使用上一次執行的結果。 如果您使用 Azure Machine Learning 資料集作為輸入,重複使用取決於資料集的定義是否已變更,而不是基礎資料是否已變更。

version
str
預設值: None

選擇性版本戳記,表示步驟的功能變更。

permit_cluster_restart
bool
預設值: None

如果指定existing_cluster_id,此參數會指出是否可以代表使用者重新開機叢集。

name
str
必要

[必要]步驟的名稱。

inputs
list[Union[InputPortBinding, DataReference, PortDataReference, PipelineData]]
必要

此步驟所取用資料的輸入連線清單。 使用 dbutils.widgets.get (「input_name」) 在筆記本內擷取此專案。 可以是 DataReference 或 PipelineData。 DataReference 代表資料存放區上現有的資料片段。 基本上,這是資料存放區的路徑。 DatabricksStep 支援封裝 DBFS、Azure Blob 或 ADLS v1 的資料存放區。 PipelineData 代表管線中另一個步驟所產生的中繼資料。

outputs
list[Union[OutputPortBinding, <xref:azureml.pipeline.core.pipeline_output_dataset.PipelineOutputDataset>, PipelineData]]
必要

此步驟所產生輸出的輸出埠定義清單。 使用 dbutils.widgets.get (「output_name」) 在筆記本中擷取此專案。 應該是 PipelineData。

existing_cluster_id
str
必要

Databricks 工作區上現有互動式叢集的叢集識別碼。 如果您要傳遞此參數,則無法傳遞下列任何用來建立新叢集的參數:

  • spark_version
  • node_type
  • instance_pool_id
  • num_workers
  • min_workers
  • max_workers
  • spark_env_variables
  • spark_conf

注意:若要建立新的作業叢集,您必須傳遞上述參數。 您可以直接傳遞這些參數,或使用 runconfig 參數將它們當做 RunConfiguration 物件的一部分傳遞。 直接傳遞這些參數,並透過 RunConfiguration 傳遞會導致錯誤。

spark_version
str
必要

Databricks 執行叢集的 Spark 版本,例如:「10.4.x-scala2.12」。 如需詳細資訊,請參閱 參數的描述 existing_cluster_id

node_type
str
必要

[必要]Databricks 執行的叢集的 Azure VM 節點類型,例如:「Standard_D3_v2」。 請指定 node_typeinstance_pool_id。 如需詳細資訊,請參閱 參數的描述 existing_cluster_id

instance_pool_id
str
必要

[必要]叢集必須連結至的實例集區識別碼。 請指定 node_typeinstance_pool_id。 如需詳細資訊,請參閱 參數的描述 existing_cluster_id

num_workers
int
必要

[必要]Databricks 執行叢集的靜態背景工作角色數目。 您必須指定 num_workers 或 兩者 min_workersmax_workers

如需詳細資訊,請參閱 參數的描述 existing_cluster_id

min_workers
int
必要

[必要]要用於自動調整 Databricks 執行叢集的背景工作角色數目下限。 您必須指定 num_workers 或 兩者 min_workersmax_workers

如需詳細資訊,請參閱 參數的描述 existing_cluster_id

max_workers
int
必要

[必要]用於自動調整 Databricks 執行叢集的背景工作角色數目上限。 您必須指定 num_workers 或 兩者 min_workersmax_workers

如需詳細資訊,請參閱 參數的描述 existing_cluster_id

spark_env_variables
dict
必要

Databricks 執行叢集的 Spark 環境變數。 如需詳細資訊,請參閱 參數的描述 existing_cluster_id

spark_conf
dict
必要

Databricks 執行的叢集的 Spark 組態。 如需詳細資訊,請參閱 參數的描述 existing_cluster_id

init_scripts
[str]
必要

已取代。 Databricks 宣佈儲存在 DBFS 中的 init 腳本將在 2023 年 12 月 1 日後停止運作。 若要減輕此問題,請 1) 在 databricks 中使用全域 init 腳本,下列 https://learn.microsoft.com/azure/databricks/init-scripts/global 2) 批註化 AzureML databricks 步驟中的init_scripts行。

cluster_log_dbfs_path
str
必要

要傳遞叢集記錄的 DBFS 路徑。

notebook_path
str
必要

[必要]Databricks 實例中筆記本的路徑。 這個類別允許四種方式來指定要在 Databricks 叢集上執行的程式碼。

  1. 若要執行 Databricks 工作區中的筆記本,請使用: notebook_path=notebook_path,notebook_params={'myparam': 'testparam'}

  2. 若要執行 DBFS 中存在的 Python 腳本,請使用:python_script_path=python_script_dbfs_path、python_script_params={'arg1'、'arg2'}

  3. 若要執行 DBFS 中存在的 JAR,請使用:main_class_name=main_jar_class_name、jar_params={'arg1'、'arg2'}、jar_libraries=[JarLibrary (jar_library_dbfs_path) ]

  4. 若要執行存在於本機電腦上的 Python 腳本,請使用:python_script_name=python_script_name,source_directory=source_directory

指定 、、 python_script_namemain_class_namenotebook_pathpython_script_path 其中一個 。

notebook_params
dict[str, (strPipelineParameter)]
必要

要傳遞至筆記本的參數字典。 notebook_params 以小工具的形式提供。 您可以使用 dbutils.widgets.get (「myparam」) ,從筆記本內的這些小工具擷取值。

python_script_path
str
必要

[必要]DBFS 中 Python 腳本的路徑。 指定 、、 python_script_namemain_class_namenotebook_pathpython_script_path 其中一個 。

python_script_params
list[str, PipelineParameter]
必要

Python 腳本的參數。

main_class_name
str
必要

[必要]JAR 模組中進入點的名稱。 指定 、、 python_script_namemain_class_namenotebook_pathpython_script_path 其中一個 。

jar_params
list[str, PipelineParameter]
必要

JAR 模組的參數。

source_directory
str
必要

包含腳本和其他檔案的資料夾。 如果 python_script_name 已指定 ,則 source_directory 也必須指定 。

hash_paths
[str]
必要

已淘汰:不再需要。

檢查步驟內容的變更時,雜湊的路徑清單。 如果未偵測到任何變更,管線將會重複使用上一次執行的步驟內容。 根據預設,的內容 source_directory 會雜湊,但 .amlignore 或 .gitignore 中列出的檔案除外。

run_name
str
必要

此執行的 Databricks 中的名稱。

timeout_seconds
int
必要

Databricks 執行的逾時。

runconfig
RunConfiguration
必要

要使用的 runconfig。

注意:您可以使用下列參數,將所需的程式庫數目傳遞至作業: maven_libraries 、、 pypi_librariesegg_librariesjar_librariesrcran_libraries 。 請直接使用其對應的參數傳遞這些參數,或使用 參數作為 RunConfiguration 物件的 runconfig 一部分,但不能同時傳遞兩者。

maven_libraries
list[<xref:azureml.core.runconfig.MavenLibrary>]
必要

用於 Databricks 執行的 Maven 程式庫。 如需 Maven 程式庫規格的詳細資訊,請參閱 help(azureml.core.runconfig.MavenLibrary)

pypi_libraries
list[<xref:azureml.core.runconfig.PyPiLibrary>]
必要

要用於 Databricks 執行的 PyPi 程式庫。 如需 PyPi 程式庫規格的詳細資訊,請參閱 help(azureml.core.runconfig.PyPiLibrary)

egg_libraries
list[<xref:azureml.core.runconfig.EggLibrary>]
必要

要用於 Databricks 執行的加入程式庫。 如需有關指定「影響程式庫」的詳細資訊,請參閱 help(azureml.core.runconfig.EggLibrary)

jar_libraries
list[<xref:azureml.core.runconfig.JarLibrary>]
必要

要用於 Databricks 執行的 Jar 程式庫。 如需 Jar 程式庫規格的詳細資訊,請參閱 help(azureml.core.runconfig.JarLibrary)

rcran_libraries
list[<xref:azureml.core.runconfig.RCranLibrary>]
必要

用於 Databricks 執行的 RCran 程式庫。 如需 RCran 程式庫規格的詳細資訊,請參閱 help(azureml.core.runconfig.RCranLibrary)

compute_target
str, DatabricksCompute
必要

[必要]Azure Databricks 計算。 您必須先將 Azure Databricks 工作區新增為計算目標,才能使用 DatabricksStep 在 Azure Databricks 工作區上執行腳本或筆記本。

allow_reuse
bool
必要

指出當使用相同的設定重新執行時,此步驟是否應該重複使用先前的結果。 預設會啟用重複使用。 如果步驟內容 (腳本/相依性) 以及輸入和參數保持不變,則會重複使用此步驟上一次執行的輸出。 重複使用步驟時,不會提交要計算的作業,而是立即提供給任何後續步驟使用上一次執行的結果。 如果您使用 Azure Machine Learning 資料集作為輸入,重複使用取決於資料集的定義是否已變更,而不是基礎資料是否已變更。

version
str
必要

選擇性版本戳記,表示步驟的功能變更。

permit_cluster_restart
bool
必要

如果指定existing_cluster_id,此參數會指出是否可以代表使用者重新開機叢集。

方法

create_node

從 Databricks 步驟建立節點,並將它新增至指定的圖形。

這個方法不適合直接使用。 使用此步驟具現化管線時,Azure ML 會自動傳遞透過此方法所需的參數,以便將步驟新增至代表工作流程的管線圖形。

create_node

從 Databricks 步驟建立節點,並將它新增至指定的圖形。

這個方法不適合直接使用。 使用此步驟具現化管線時,Azure ML 會自動傳遞透過此方法所需的參數,以便將步驟新增至代表工作流程的管線圖形。

create_node(graph, default_datastore, context)

參數

graph
Graph
必要

要加入節點的繪圖物件。

default_datastore
Union[AbstractAzureStorageDatastore, AzureDataLakeDatastore]
必要

預設資料存放區。

context
<xref:azureml.pipeline.core._GraphContext>
必要

圖形內容。

傳回

已建立的節點。

傳回類型