| Index: appengine/gce-backend/config.py
|
| diff --git a/appengine/gce-backend/config.py b/appengine/gce-backend/config.py
|
| index a64883ac26024e752cac0cf4ca361c4a9bee60aa..cde35e0b21682eedf9f2961206a8c8fa24132628 100644
|
| --- a/appengine/gce-backend/config.py
|
| +++ b/appengine/gce-backend/config.py
|
| @@ -65,6 +65,22 @@ class Configuration(datastore_utils.config.GlobalConfig):
|
| return template_cfg, manager_cfg
|
|
|
|
|
| +def count_instances():
|
| + """Counts the numbers of instances configured by each instance template.
|
| +
|
| + Returns:
|
| + A dict mapping instance template name to a list of (min, max).
|
| + """
|
| + # Aggregate the numbers of instances configured in each instance group manager
|
| + # created for each instance template.
|
| + totals = collections.defaultdict(lambda: [0, 0])
|
| + _, manager_cfg = Configuration.load()
|
| + for manager in manager_cfg.managers:
|
| + totals[manager.template_base_name][0] += manager.minimum_size
|
| + totals[manager.template_base_name][1] += manager.maximum_size
|
| + return totals
|
| +
|
| +
|
| def update_template_configs():
|
| """Updates the local template configuration from the config service.
|
|
|
|
|