def _clear_arguments(nodes):
    """Clear arguments from nodes.

    After a node is executed, its arguments are already cleared
    indirectly in the call to their perform_execution_setup()
    method. However, when it has other connected nodes downstream,
    such connected nodes will receive and store the output as
    argument(s).

    However, if an error happens and the graph execution is
    cancelled, this method is important to ensure those other
    nodes which didn't get to be called have the arguments received
    cleared.

    Additionally, if we are only executing a portion of the
    existing nodes, for instance, when we use the
    execute_node_after_upstream_ones() method, the connected
    nodes downstream will receive the arguments as well, even
    though they won't be executed. Rather than set complex checks
    to prevent such nodes to receive the arguments it is simpler
    to just clear everything anyway.

    The cleared data doesn't affect viewer nodes as well, because
    the outputs sent away as arguments to other nodes is also
    referenced in the viewer node anyway, so it is not lost when
    the arguments are cleared.
    """
    for node in nodes:

        if (
            not hasattr(node, 'argument_map')
            or node.data.get("commented_out", False)
            or node.data.get('mode') == 'callable'
        ):
            continue

        ### clear the argument map
        node.argument_map.clear()

        ### also insert empty dicts for subparameters if node allows
        ### them

        if hasattr(node, 'var_kind_map'):

            for param_name in node.var_kind_map:
                node.argument_map[param_name] = {}
Clear arguments from nodes.

    After a node is executed, its arguments are already cleared
    indirectly in the call to their perform_execution_setup()
    method. However, when it has other connected nodes downstream,
    such connected nodes will receive and store the output as
    argument(s).

    However, if an error happens and the graph execution is
    cancelled, this method is important to ensure those other
    nodes which didn't get to be called have the arguments received
    cleared.

    Additionally, if we are only executing a portion of the
    existing nodes, for instance, when we use the
    execute_node_after_upstream_ones() method, the connected
    nodes downstream will receive the arguments as well, even
    though they won't be executed. Rather than set complex checks
    to prevent such nodes to receive the arguments it is simpler
    to just clear everything anyway.

    The cleared data doesn't affect viewer nodes as well, because
    the outputs sent away as arguments to other nodes is also
    referenced in the viewer node anyway, so it is not lost when
    the arguments are cleared.
    
nodezator/graphman/execution.py