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。