def _handle_powering_down_nodes()

in src/slurm_plugin/clustermgtd.py [0:0]


    def _handle_powering_down_nodes(self, slurm_nodes):
        """
        Handle nodes that are powering down and not already being replaced.

        Terminate instances backing the powering down node if any.
        Reset the nodeaddr for the powering down node. Node state is not changed.
        """
        powering_down_nodes = [
            node for node in slurm_nodes if node.is_powering_down_with_nodeaddr() and not node.is_being_replaced
        ]
        if powering_down_nodes:
            log.info("Resetting powering down nodes: %s", print_with_count(powering_down_nodes))
            reset_nodes(nodes=[node.name for node in powering_down_nodes])
            instances_to_terminate = [node.instance.id for node in powering_down_nodes if node.instance]
            log.info("Terminating instances that are backing powering down nodes")
            self._instance_manager.delete_instances(
                instances_to_terminate, terminate_batch_size=self._config.terminate_max_batch_size
            )