class_docstr: A :class:`TaskContext` with extra contextual info and tooling for tasks in a barrier stage.
  Use :func:`BarrierTaskContext.get` to obtain the barrier context for a running barrier task.
  
  .. versionadded:: 2.4.0
  
  Notes
  -----
  This API is experimental
  
  Examples
  --------
  Set a barrier, and execute it with RDD.
  
  >>> from pyspark import BarrierTaskContext
  >>> def block_and_do_something(itr):
  ...     taskcontext = BarrierTaskContext.get()
  ...     # Do something.
  ...
  ...     # Wait until all tasks finished.
  ...     taskcontext.barrier()
  ...
  ...     return itr
  ...
  >>> rdd = spark.sparkContext.parallelize([1])
  >>> rdd.barrier().mapPartitions(block_and_do_something).collect()
  [1]
docstr: Returns :class:`BarrierTaskInfo` for all tasks in this barrier stage,
  ordered by partition ID.
  
  .. versionadded:: 2.4.0
  
  Notes
  -----
  This API is experimental
  
  Examples
  --------
  >>> from pyspark import BarrierTaskContext
  >>> rdd = spark.sparkContext.parallelize([1])
  >>> barrier_info = rdd.barrier().mapPartitions(
  ...     lambda _: [BarrierTaskContext.get().getTaskInfos()]).collect()[0][0]
  >>> barrier_info.address
  '...:...'
docstr_tok: ["Returns",":","class",":","`","BarrierTaskInfo","`","for","all","tasks","in","this","barrier","stage",",","ordered","by","partition","ID",".","..","versionadded",":",":","2.4.0","Notes","--","--","-","This","API","is","experimental","Examples","--","--","--","--",">",">",">","from","pyspark","import","BarrierTaskContext",">",">",">","rdd","=","spark.sparkContext.parallelize","(","[","1","]",")",">",">",">","barrier_info","=","rdd.barrier","(",")",".mapPartitions","(","...","lambda","_",":","[","BarrierTaskContext.get","(",")",".getTaskInfos","(",")","]",")",".collect","(",")","[","0","]","[","0","]",">",">",">","barrier_info.address","'","...",":","...","'"]
code: def getTaskInfos(self) -> List["BarrierTaskInfo"]:
      """
      Returns :class:`BarrierTaskInfo` for all tasks in this barrier stage,
      ordered by partition ID.
  
      .. versionadded:: 2.4.0
  
      Notes
      -----
      This API is experimental
  
      Examples
      --------
      >>> from pyspark import BarrierTaskContext
      >>> rdd = spark.sparkContext.parallelize([1])
      >>> barrier_info = rdd.barrier().mapPartitions(
      ...     lambda _: [BarrierTaskContext.get().getTaskInfos()]).collect()[0][0]
      >>> barrier_info.address
      '...:...'
      """
      if self._port is None or self._secret is None:
          raise PySparkRuntimeError(
              error_class="CALL_BEFORE_INITIALIZE",
              message_parameters={
                  "func_name": "getTaskInfos",
                  "object": "BarrierTaskContext",
              },
          )
      else:
          addresses = cast(Dict[str, str], self._localProperties).get(
              "addresses", ""
          )
          return [
              BarrierTaskInfo(h.strip()) for h in addresses.split(",")
          ]
  
imports: from typing import ClassVar, Type, Dict, List, Optional, Union, cast
  from pyspark.java_gateway import local_connect_and_auth
  from pyspark.resource import ResourceInformation
  from pyspark.serializers import read_int, write_int, write_with_length, UTF8Deserializer
  from pyspark.errors import PySparkRuntimeError
label_desc: Use image node_id 6 for calling the BarrierTaskContext obj's underlying member method code with example usage: obj.getTaskInfos() and returns: unknown