def add_nodes_to_cluster()

in gridengine/src/gridengine/driver.py [0:0]


    def add_nodes_to_cluster(self, nodes: List[Node]) -> List[Node]:
        if self.read_only:
            return []

        logging.getLogger("gridengine.driver").info("add_nodes_to_cluster")

        if not nodes:
            return []

        ret: List[Node] = []
        fqdns = self.ge_env.qbin.qconf(["-sh"]).splitlines()
        admin_hostnames = [fqdn.split(".")[0] for fqdn in fqdns]

        fqdns = self.ge_env.qbin.qconf(["-ss"]).splitlines()
        submit_hostnames = [fqdn.split(".")[0] for fqdn in fqdns]

        filtered = [
            n for n in nodes if n.exists and n.hostname and n.resources.get("ccnodeid")
        ]

        # disabled nodes that need to be joined to the cluster
        no_running_jobs = [n for n in filtered if not _is_node_busy(n)]
        # disabled nodes that have running jobs should be re-enabled
        has_running_jobs = [n for n in filtered if _is_node_busy(n)]

        for node in no_running_jobs:
            if self._add_node_to_cluster(node, admin_hostnames, submit_hostnames):
                ret.append(node)
        
        if has_running_jobs:
            logging.info("Re-enabling queues for nodes with running jobs - %s",
                        [n.hostname for n in has_running_jobs])

            for node in has_running_jobs:
                wc_queue_list_expr = f"*@{node.hostname}"
                self.ge_env.qbin.qmod(["-e", wc_queue_list_expr])
        return ret