Exemplo n.º 1
0
    def configure_initial(self) -> None:
        setup_config(self.options)

        # Since we want to collect metrics for all the pools, we need to call setup_config
        # first to load the cluster config path, and then read all the entries in that directory
        self.pools: MutableMapping[str, List[str]] = {}
        for scheduler in {'mesos', 'kubernetes'}:
            self.pools[scheduler] = get_pool_name_list(self.options.cluster,
                                                       scheduler)
        for scheduler, pools in self.pools.items():
            for pool in pools:
                self.config.watchers.append({
                    f'{pool}.{scheduler}':
                    get_pool_config_path(self.options.cluster, pool,
                                         scheduler),
                })
                load_cluster_pool_config(self.options.cluster, pool, scheduler,
                                         None)

        self.region = staticconf.read_string('aws.region')
        self.run_interval = staticconf.read_int(
            'batches.cluster_metrics.run_interval_seconds')
        self.logger = logger

        self.metrics_client = ClustermanMetricsBotoClient(
            region_name=self.region)
Exemplo n.º 2
0
 def configure_initial(self) -> None:
     setup_config(self.options)
     self.logger = logger
     self.fetch_proc_count, self.run_proc_count = setup_signals_environment(
         self.options.pool,
         self.options.scheduler,
     )
     self.config.watchers.append(
         {
             self.options.pool:
             get_pool_config_path(self.options.cluster, self.options.pool,
                                  self.options.scheduler)
         }, )
Exemplo n.º 3
0
def mock_config_files():
    with staticconf.testing.PatchConfiguration(
        {'cluster_config_directory': '/nail/whatever'}), mock_open(
            config.get_pool_config_path('cluster-A', 'pool-1', 'mesos'),
            contents=yaml.dump({
                'resource_groups': 'cluster-A',
                'other_config': 18,
            }),
        ), mock_open(
            config.get_pool_config_path('cluster-A', 'pool-2', 'mesos'),
            contents=yaml.dump({
                'resource_groups': 'cluster-A',
                'other_config': 20,
            }),
        ), mock_open(
            config.get_pool_config_path('cluster-A', 'pool-2', 'kubernetes'),
            contents=yaml.dump({
                'resource_groups': 'cluster-A',
                'other_config': 29,
            }),
        ), mock_open(
            config.get_pool_config_path('cluster-B', 'pool-1', 'mesos'),
            contents=yaml.dump({
                'resource_groups': 'cluster-B',
                'other_config': 200,
                'autoscale_signal': {
                    'branch_or_tag': 'v42'
                },
            }),
        ), mock_open('/etc/no_cfg/clusterman.json',
                     contents=json.dumps({
                         'accessKeyId': 'foo',
                         'secretAccessKey': 'bar',
                         'region': 'nowhere-useful',
                     })):
        yield