blob: 487bf49909b5657ba3026072a22aeb4706c67e61 [file] [log] [blame]
:py:mod:`airflow.providers.microsoft.azure.hooks.batch`
=======================================================
.. py:module:: airflow.providers.microsoft.azure.hooks.batch
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.microsoft.azure.hooks.batch.AzureBatchHook
.. py:class:: AzureBatchHook(azure_batch_conn_id = default_conn_name)
Bases: :py:obj:`airflow.hooks.base.BaseHook`
Hook for Azure Batch APIs
:param azure_batch_conn_id: :ref:`Azure Batch connection id<howto/connection:azure_batch>`
of a service principal which will be used to start the container instance.
.. py:attribute:: conn_name_attr
:annotation: = azure_batch_conn_id
.. py:attribute:: default_conn_name
:annotation: = azure_batch_default
.. py:attribute:: conn_type
:annotation: = azure_batch
.. py:attribute:: hook_name
:annotation: = Azure Batch Service
.. py:method:: get_connection_form_widgets()
:staticmethod:
Returns connection widgets to add to connection form
.. py:method:: get_ui_field_behaviour()
:staticmethod:
Returns custom field behaviour
.. py:method:: get_conn(self)
Get the Batch client connection
:return: Azure Batch client
.. py:method:: configure_pool(self, pool_id, vm_size = None, vm_publisher = None, vm_offer = None, sku_starts_with = None, vm_sku = None, vm_version = None, vm_node_agent_sku_id = None, os_family = None, os_version = None, display_name = None, target_dedicated_nodes = None, use_latest_image_and_sku = False, **kwargs)
Configures a pool
:param pool_id: A string that uniquely identifies the Pool within the Account
:param vm_size: The size of virtual machines in the Pool.
:param display_name: The display name for the Pool
:param target_dedicated_nodes: The desired number of dedicated Compute Nodes in the Pool.
:param use_latest_image_and_sku: Whether to use the latest verified vm image and sku
:param vm_publisher: The publisher of the Azure Virtual Machines Marketplace Image.
For example, Canonical or MicrosoftWindowsServer.
:param vm_offer: The offer type of the Azure Virtual Machines Marketplace Image.
For example, UbuntuServer or WindowsServer.
:param sku_starts_with: The start name of the sku to search
:param vm_sku: The name of the virtual machine sku to use
:param vm_version: The version of the virtual machine
:param vm_version: str
:param vm_node_agent_sku_id: The node agent sku id of the virtual machine
:param os_family: The Azure Guest OS family to be installed on the virtual machines in the Pool.
:param os_version: The OS family version
.. py:method:: create_pool(self, pool)
Creates a pool if not already existing
:param pool: the pool object to create
.. py:method:: wait_for_all_node_state(self, pool_id, node_state)
Wait for all nodes in a pool to reach given states
:param pool_id: A string that identifies the pool
:param node_state: A set of batch_models.ComputeNodeState
.. py:method:: configure_job(self, job_id, pool_id, display_name = None, **kwargs)
Configures a job for use in the pool
:param job_id: A string that uniquely identifies the job within the account
:param pool_id: A string that identifies the pool
:param display_name: The display name for the job
.. py:method:: create_job(self, job)
Creates a job in the pool
:param job: The job object to create
.. py:method:: configure_task(self, task_id, command_line, display_name = None, container_settings=None, **kwargs)
Creates a task
:param task_id: A string that identifies the task to create
:param command_line: The command line of the Task.
:param display_name: A display name for the Task
:param container_settings: The settings for the container under which the Task runs.
If the Pool that will run this Task has containerConfiguration set,
this must be set as well. If the Pool that will run this Task doesn't have
containerConfiguration set, this must not be set.
.. py:method:: add_single_task_to_job(self, job_id, task)
Add a single task to given job if it doesn't exist
:param job_id: A string that identifies the given job
:param task: The task to add
.. py:method:: wait_for_job_tasks_to_complete(self, job_id, timeout)
Wait for tasks in a particular job to complete
:param job_id: A string that identifies the job
:param timeout: The amount of time to wait before timing out in minutes