airflow.providers.microsoft.azure.operators.batch¶
类¶
在 Azure Batch 服务上执行作业。 |
模块内容¶
- class airflow.providers.microsoft.azure.operators.batch.AzureBatchOperator(*, batch_pool_id, batch_pool_vm_size, batch_job_id, batch_task_command_line, batch_task_id, vm_node_agent_sku_id, vm_publisher=None, vm_offer=None, sku_starts_with=None, vm_sku=None, vm_version=None, os_family=None, os_version=None, batch_pool_display_name=None, batch_job_display_name=None, batch_job_manager_task=None, batch_job_preparation_task=None, batch_job_release_task=None, batch_task_display_name=None, batch_task_container_settings=None, batch_start_task=None, batch_max_retries=3, batch_task_resource_files=None, batch_task_output_files=None, batch_task_user_identity=None, target_low_priority_nodes=None, target_dedicated_nodes=None, enable_auto_scale=False, auto_scale_formula=None, azure_batch_conn_id='azure_batch_default', use_latest_verified_vm_image_and_sku=False, timeout=25, should_delete_job=False, should_delete_pool=False, **kwargs)[source]¶
基类:
airflow.models.BaseOperator
在 Azure Batch 服务上执行作业。
- 参数:
batch_pool_id (str) – 在帐户中唯一标识池的字符串。
batch_pool_vm_size (str) – 池中虚拟机的规格大小
batch_job_id (str) – 在帐户中唯一标识作业的字符串。
batch_task_command_line (str) – 任务的命令行。
batch_task_id (str) – 在作业中唯一标识任务的字符串。
batch_pool_display_name (str | None) – 池的显示名称。显示名称无需唯一
batch_job_display_name (str | None) – 作业的显示名称。显示名称无需唯一
batch_job_manager_task (azure.batch.models.JobManagerTask | None) – 作业启动时要启动的作业管理器任务的详细信息。
batch_job_preparation_task (azure.batch.models.JobPreparationTask | None) – 作业准备任务。如果设置,Batch 服务将在计算节点上启动该作业的任何任务之前,在该节点上运行作业准备任务。如果 batch_job_release_task 已设置,则此项必需。
batch_job_release_task (azure.batch.models.JobReleaseTask | None) – 作业释放任务。用于撤消作业准备任务对计算节点所做的更改
batch_task_display_name (str | None) – 任务的显示名称。显示名称无需唯一
batch_task_container_settings (azure.batch.models.TaskContainerSettings | None) – 任务运行所在容器的设置。
batch_start_task (azure.batch.models.StartTask | None) – 指定在每个计算节点加入池时运行的任务。任务在计算节点添加到池或重启时运行。
batch_max_retries (int) – 在将此批处理操作视为失败操作之前重试的次数。默认值为 3
batch_task_resource_files (list[azure.batch.models.ResourceFile] | None) – 批处理服务在运行命令行之前将下载到计算节点的文件列表。
batch_task_output_files (list[azure.batch.models.OutputFile] | None) – 批处理服务在运行命令行之后将从计算节点上传的文件列表。
batch_task_user_identity (azure.batch.models.UserIdentity | None) – 任务运行所使用的用户身份。如果省略,任务将作为任务独有的非管理员用户运行。
target_low_priority_nodes (int | None) – 池中所需的低优先级计算节点数量。如果 enable_auto_scale 设置为 true,则不得指定此属性。
target_dedicated_nodes (int | None) – 池中所需的专用计算节点数量。如果 enable_auto_scale 设置为 true,则不得指定此属性。
enable_auto_scale (bool) – 池大小是否应随时间自动调整。默认值为 false
auto_scale_formula (str | None) – 池中所需计算节点数量的公式。如果 enableAutoScale 设置为 false,则不得指定此属性。如果 enableAutoScale 设置为 true,则此项必需。
azure_batch_conn_id – Azure Batch 连接 ID
use_latest_verified_vm_image_and_sku (bool) – 是否使用批处理帐户中最新验证的虚拟机镜像和 SKU。默认值为 false。
vm_publisher (str | None) – Azure 虚拟机市场镜像的发布者。例如,Canonical 或 MicrosoftWindowsServer。如果 use_latest_image_and_sku 设置为 True,则此项必需。
vm_offer (str | None) – Azure 虚拟机市场镜像的优惠类型。例如,UbuntuServer 或 WindowsServer。如果 use_latest_image_and_sku 设置为 True,则此项必需。
sku_starts_with (str | None) – 虚拟机 SKU 的起始字符串。如果 use_latest_image_and_sku 设置为 True,则此项必需。
vm_sku (str | None) – 要使用的虚拟机 SKU 名称。
vm_version (str | None) – 虚拟机的版本。
vm_version – str | None
vm_node_agent_sku_id (str) – 虚拟机的节点代理 SKU ID。
os_family (str | None) – 要安装在池中虚拟机上的 Azure Guest OS 系列。
os_version (str | None) – OS 系列版本。
timeout (int) – 等待作业完成的分钟数。默认值为 25
should_delete_job (bool) – 执行后是否删除作业。默认值为 False
should_delete_pool (bool) – 执行作业后是否删除池。默认值为 False
- template_fields: collections.abc.Sequence[str] = ('batch_pool_id', 'batch_pool_vm_size', 'batch_job_id', 'batch_task_id', 'batch_task_command_line')[source]¶
- 属性 hook: airflow.providers.microsoft.azure.hooks.batch.AzureBatchHook[source]¶
创建并返回一个 AzureBatchHook(已缓存)。
- execute(context)[source]¶
在创建 Operator 时派生此方法。
上下文与渲染 jinja 模板时使用的字典相同。
有关更多上下文信息,请参阅 get_template_context。