class_docstr: 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.
class_docstr_tok: ["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","."]
docstr: 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
docstr_tok: ["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"]
code: def wait_for_all_node_state(
      self, pool_id: str, node_state: set
  ) -> list:
      """
      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
      """
      self.log.info(
          "waiting for all nodes in pool %s to reach one of: %s",
          pool_id,
          node_state,
      )
      while True:
          # refresh pool to ensure that there is no resize error
          pool = self.connection.pool.get(pool_id)
          if pool.resize_errors is not None:
              resize_errors = "\n".join(
                  repr(e) for e in pool.resize_errors
              )
              raise RuntimeError(
                  f"resize error encountered for pool {pool.id}:\n{resize_errors}"
              )
          nodes = list(self.connection.compute_node.list(pool.id))
          if len(nodes) >= pool.target_dedicated_nodes and all(
              node.state in node_state for node in nodes
          ):
              return nodes
          # Allow the timeout to be controlled by the AzureBatchOperator
          # specified timeout. This way we don't interrupt a startTask inside
          # the pool
          time.sleep(10)
  
imports: from __future__ import annotations
  import time
  from datetime import timedelta
  from functools import cached_property
  from typing import TYPE_CHECKING, Any
  from azure.batch import BatchServiceClient, batch_auth, models
  from airflow.exceptions import AirflowException
  from airflow.hooks.base import BaseHook
  from airflow.providers.microsoft.azure.utils import AzureIdentityCredentialAdapter, add_managed_identity_connection_widgets, get_field
  from airflow.utils import timezone
label_desc: Use image node_id 10 for calling the AzureBatchHook obj's underlying member method code with example usage: obj.wait_for_all_node_state(pool_id, node_state) and returns: nodes