def preprocess_buckets()

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


    def preprocess_buckets(self, node_mgr: NodeManager) -> NodeManager:
        """
            # A toy example: disable all but certain regions given
            # time of day
            import time
            now = time.localtime()
            if now.tm_hour < 9:
                limit_regions = ["westus", "westus2"]
            else:
                limit_regions = ["eastus"]

            for bucket in node_mgr.get_buckets():

                if bucket.location not in limit_regions:
                    bucket.enabled = False
        """
        # by_pg = partition(node_mgr.get_buckets(), lambda b: b.placement_group)
        # for queue_config in parallel_environments.read_queue_configs():
        #     for pe in queue_config.get_pes():
        #         if pe.requires_placement_groups:
        #             placement_group = ht.PlacementGroup("{}_{}".format(ge_queue.qname, pe.name))
        #             placement_group = re.sub("[^a-zA-z0-9-_]", "_", placement_group)
        #             """
        #         Just pre-declare the pgs in the autoscale config!
        #         """
        #             if placement_group not in by_pg:
        #                 node_mgr._add_bucket()

        return node_mgr