python/ray/experimental/dag/dag_node.py
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
        )

        # Return updated copy of self.
        return self._copy(
            new_args, new_kwargs, self.get_options(), new_other_args_to_resolve
        )
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.
        
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()``.
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 () ` ` .
def _apply_and_replace_all_child_nodes(
        self, fn: "Callable[[DAGNode], T]"
    ) -> "DAGNode":
        replace_table = {}
        scanner = _PyObjScanner()
        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
        )
        return self._copy(
            new_args, new_kwargs, self.get_options(), new_other_args_to_resolve
        )
def _apply_and_replace_all_child_nodes ( self , fn : "Callable[[DAGNode], T]" ) -> "DAGNode" : replace_table = { } scanner = _PyObjScanner ( ) 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 ) return self . _copy ( new_args , new_kwargs , self . get_options ( ) , new_other_args_to_resolve )
Apply and replace all immediate child nodes using a given function.
Apply and replace all immediate child nodes using a given function .
"""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.
        """ # CloudPickler scanner object for current layer of DAGNode. Same # scanner should be use for a full find & replace cycle. # Find all first-level nested DAGNode children in args. # Update replacement table and execute the replace. # Return updated copy of self.
New DAGNode after replacing all child nodes.
New DAGNode after replacing all child nodes .
self
fn
"Callable[[DAGNode], T]"
Callable that will be applied once to each child of this node.
Callable that will be applied once to each child of this node .