def _add_to_hostgroups()

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


    def _add_to_hostgroups(self, node: Node, hostgroups: List[str]) -> None:
        if not node.resources.get("ccnodeid"):
            return

        if not node.hostname:
            return

        for hostgroup in hostgroups:
            if not hostgroup.startswith("@"):
                # hostgroups have to start with @
                continue

            hostlist_for_hg = self._get_hostlist(hostgroup)
            if node.hostname.lower() in hostlist_for_hg:
                continue

            logging.info("Adding hostname %s to hostgroup %s", node.hostname, hostgroup)

            self.ge_env.qbin.qconf(
                ["-aattr", "hostgroup", "hostlist", node.hostname, hostgroup,]
            )