class_docstr: Abstract class for a node in a Ray task graph.
  
  A node has a type (e.g., FunctionNode), data (e.g., function options and
  body), arguments (Python values, DAGNodes, and DAGNodes nested within Python
  argument values) and options (Ray API .options() used for function, class
  or class method)
docstr: Apply and replace all immediate child nodes using a given function.
  
  This is a shallow replacement only. To recursively transform nodes in
  the DAG, use ``apply_recursive()``.
  
  Args:
      fn: Callable that will be applied once to each child of this node.
  
  Returns:
      New DAGNode after replacing all child nodes.
docstr_tok: ["Apply","and","replace","all","immediate","child","nodes","using","a","given","function",".","This","is","a","shallow","replacement","only",".","To","recursively","transform","nodes","in","the","DAG",",","use","``","apply_recursive","(",")","``",".","Args",":","fn",":","Callable","that","will","be","applied","once","to","each","child","of","this","node",".","Returns",":","New","DAGNode","after","replacing","all","child","nodes","."]
code: def _apply_and_replace_all_child_nodes(
      self, fn: "Callable[[DAGNode], T]"
  ) -> "DAGNode":
      """Apply and replace all immediate child nodes using a given function.
  
      This is a shallow replacement only. To recursively transform nodes in
      the DAG, use ``apply_recursive()``.
  
      Args:
          fn: Callable that will be applied once to each child of this node.
  
      Returns:
          New DAGNode after replacing all child nodes.
      """
  
      replace_table = {}
      # CloudPickler scanner object for current layer of DAGNode. Same
      # scanner should be use for a full find & replace cycle.
      scanner = _PyObjScanner()
      # Find all first-level nested DAGNode children in args.
      # Update replacement table and execute the replace.
      for node in scanner.find_nodes(
          [
              self._bound_args,
              self._bound_kwargs,
              self._bound_other_args_to_resolve,
          ]
      ):
          if node not in replace_table:
              replace_table[node] = fn(node)
      (
          new_args,
          new_kwargs,
          new_other_args_to_resolve,
      ) = scanner.replace_nodes(replace_table)
      scanner.clear()
  
      # Return updated copy of self.
      return self._copy(
          new_args,
          new_kwargs,
          self.get_options(),
          new_other_args_to_resolve,
      )
  
imports: import ray
  from ray.dag.base import DAGNodeBase
  from ray.dag.py_obj_scanner import _PyObjScanner
  from ray.util.annotations import DeveloperAPI
  from typing import Optional, Union, List, Tuple, Dict, Any, TypeVar, Callable
  import uuid
  import asyncio
  from ray.dag.compiled_dag_node import build_compiled_dag_from_ray_dag
label_desc: Use image node_id 12 for calling the DAGNode obj's underlying member method code with example usage: obj._apply_and_replace_all_child_nodes(fn) and returns: self