如何创建 Spot 实例 - 使用 Azure 数据工厂 (ADF) 的作业集群 - 链接服务
How to create a Spot instance - job cluster using Azure Data Factory(ADF) - Linked service
我有一个带 Databricks 的 ADF 管道 activity。
activity每次都会创建一个新的作业集群,我已经将所有需要的 Spark 配置添加到相应的链接服务中。
现在 Databricks 提供 Spot 实例,我想在 Databricks 中创建具有 Spot 配置的新集群。
我试图从 LinkedService 文档中寻求帮助,但没有成功!
如何使用 ADF 执行此操作?
干杯!!!
请使用如下所示的 ADF 链接服务选项创建 Spot 实例
我不确定现在是否可行,因为它需要在创建集群时指定 azure_attributes
参数。但应该有一个解决方法——创建一个 instance pool of the spot instances and specify that pool via instancePoolId property.
Update:确实有效,唯一的缺点是需要使用JSON来配置Linked Service(但是可以直观地配置一切,保存,并从 Git 存储库中获取 JSON 并使用所需参数更新它)。所以基本步骤如下:
- 配置实例池以使用 spot 实例:
- 配置 Databricks 链接服务以使用实例池:
{
"name": "DBName",
"type": "Microsoft.DataFactory/factories/linkedservices",
"properties": {
"annotations": [],
"type": "AzureDatabricks",
"typeProperties": {
"domain": "https://some-url.azuredatabricks.net",
"newClusterNodeType": "Standard_DS3_v2",
"newClusterNumOfWorker": "5",
"instancePoolId":"<your-pool-id>",
"newClusterSparkEnvVars": {
"PYSPARK_PYTHON": "/databricks/python3/bin/python3"
},
"newClusterVersion": "8.2.x-scala2.12",
"newClusterInitScripts": [],
"encryptedCredential": "some-base-64"
}
}
}
配置要执行作业的 ADF 管道 - 与往常一样
触发 ADF 管道,几分钟后看到实例池已被使用:
我找到了另一种解决方法,使 ADF Databricks 链接服务能够创建具有 spot 实例的作业集群。由于 ,Databricks 链接服务接口不支持 azure_attribute 集群 属性。
相反,我最终创建了一个强制执行 spot 实例的集群策略:
{
"azure_attributes.availability": {
"type": "fixed",
"value": "SPOT_WITH_FALLBACK_AZURE",
"hidden": true
}
}
如果您想增加 azure_attributes 对象的其他属性,您可以添加到该策略。此外,请确保为适当的 groups/users.
设置策略权限
创建策略后,您需要检索策略 ID。我使用对 2.0/policies/clusters/list 端点的 REST 调用来获取该值。
从那里您可以执行 并使用动态 json 选项创建链接服务,并将具有适当策略 ID 的 policyId 属性 添加到 typeProperties 对象:
"typeProperties": {
"domain": "Your Domain",
"newClusterNodeType": "@linkedService().ClusterNodeType",
"newClusterNumOfWorker": "@linkedService().NumWorkers",
"newClusterVersion": "7.3.x-scala2.12",
"newClusterInitScripts": [],
"newClusterDriverNodeType": "@linkedService().DriverNodeType",
"policyId": "Your policy id",
}
现在,当您调用 ADF 管道时,它将使用集群策略创建作业集群,以将 azure_attribute 的可用性 属性 限制为您指定的任何内容。
我有一个带 Databricks 的 ADF 管道 activity。
activity每次都会创建一个新的作业集群,我已经将所有需要的 Spark 配置添加到相应的链接服务中。
现在 Databricks 提供 Spot 实例,我想在 Databricks 中创建具有 Spot 配置的新集群。
我试图从 LinkedService 文档中寻求帮助,但没有成功!
如何使用 ADF 执行此操作?
干杯!!!
请使用如下所示的 ADF 链接服务选项创建 Spot 实例
我不确定现在是否可行,因为它需要在创建集群时指定 azure_attributes
参数。但应该有一个解决方法——创建一个 instance pool of the spot instances and specify that pool via instancePoolId property.
Update:确实有效,唯一的缺点是需要使用JSON来配置Linked Service(但是可以直观地配置一切,保存,并从 Git 存储库中获取 JSON 并使用所需参数更新它)。所以基本步骤如下:
- 配置实例池以使用 spot 实例:
- 配置 Databricks 链接服务以使用实例池:
{
"name": "DBName",
"type": "Microsoft.DataFactory/factories/linkedservices",
"properties": {
"annotations": [],
"type": "AzureDatabricks",
"typeProperties": {
"domain": "https://some-url.azuredatabricks.net",
"newClusterNodeType": "Standard_DS3_v2",
"newClusterNumOfWorker": "5",
"instancePoolId":"<your-pool-id>",
"newClusterSparkEnvVars": {
"PYSPARK_PYTHON": "/databricks/python3/bin/python3"
},
"newClusterVersion": "8.2.x-scala2.12",
"newClusterInitScripts": [],
"encryptedCredential": "some-base-64"
}
}
}
配置要执行作业的 ADF 管道 - 与往常一样
触发 ADF 管道,几分钟后看到实例池已被使用:
我找到了另一种解决方法,使 ADF Databricks 链接服务能够创建具有 spot 实例的作业集群。由于
相反,我最终创建了一个强制执行 spot 实例的集群策略:
{
"azure_attributes.availability": {
"type": "fixed",
"value": "SPOT_WITH_FALLBACK_AZURE",
"hidden": true
}
}
如果您想增加 azure_attributes 对象的其他属性,您可以添加到该策略。此外,请确保为适当的 groups/users.
设置策略权限创建策略后,您需要检索策略 ID。我使用对 2.0/policies/clusters/list 端点的 REST 调用来获取该值。
从那里您可以执行
"typeProperties": {
"domain": "Your Domain",
"newClusterNodeType": "@linkedService().ClusterNodeType",
"newClusterNumOfWorker": "@linkedService().NumWorkers",
"newClusterVersion": "7.3.x-scala2.12",
"newClusterInitScripts": [],
"newClusterDriverNodeType": "@linkedService().DriverNodeType",
"policyId": "Your policy id",
}
现在,当您调用 ADF 管道时,它将使用集群策略创建作业集群,以将 azure_attribute 的可用性 属性 限制为您指定的任何内容。