X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/8afc85aabb9563da4de17b0b5f7d4fe574e9ad8d..59a972c831bc8f7cd4e896ed8e1c71277b97f04e:/services/nodemanager/arvnodeman/config.py diff --git a/services/nodemanager/arvnodeman/config.py b/services/nodemanager/arvnodeman/config.py index 8655046842..4857e891a7 100644 --- a/services/nodemanager/arvnodeman/config.py +++ b/services/nodemanager/arvnodeman/config.py @@ -51,13 +51,17 @@ class NodeManagerConfig(ConfigParser.SafeConfigParser): 'Daemon': {'min_nodes': '0', 'max_nodes': '1', 'poll_time': '60', + 'cloudlist_poll_time': '0', + 'nodelist_poll_time': '0', + 'wishlist_poll_time': '0', 'max_poll_time': '300', 'poll_stale_after': '600', 'max_total_price': '0', 'boot_fail_after': str(sys.maxint), 'node_stale_after': str(60 * 60 * 2), 'watchdog': '600', - 'node_mem_scaling': '0.95'}, + 'node_mem_scaling': '0.95', + 'consecutive_idle_count': '2'}, 'Manage': {'address': '127.0.0.1', 'port': '-1', 'ManagementToken': ''}, @@ -72,6 +76,7 @@ class NodeManagerConfig(ConfigParser.SafeConfigParser): def get_section(self, section, transformers={}, default_transformer=None): transformer_map = { + str: self.get, int: self.getint, bool: self.getboolean, float: self.getfloat, @@ -139,28 +144,30 @@ class NodeManagerConfig(ConfigParser.SafeConfigParser): self.get_section('Cloud Create'), driver_class=driver_class) - def node_sizes(self, all_sizes): + def node_sizes(self): """Finds all acceptable NodeSizes for our installation. Returns a list of (NodeSize, kwargs) pairs for each NodeSize object returned by libcloud that matches a size listed in our config file. """ - + all_sizes = self.new_cloud_client().list_sizes() size_kwargs = {} section_types = { + 'instance_type': str, 'price': float, - 'preemptable': bool, + 'preemptible': bool, } for sec_name in self.sections(): sec_words = sec_name.split(None, 2) if sec_words[0] != 'Size': continue size_spec = self.get_section(sec_name, section_types, int) - if 'preemptable' not in size_spec: - size_spec['preemptable'] = False + if 'preemptible' not in size_spec: + size_spec['preemptible'] = False if 'instance_type' not in size_spec: - # Assume instance type is Size name is missing + # Assume instance type is Size name if missing size_spec['instance_type'] = sec_words[1] + size_spec['id'] = sec_words[1] size_kwargs[sec_words[1]] = size_spec # EC2 node sizes are identified by id. GCE sizes are identified by name. matching_sizes = [] @@ -173,5 +180,5 @@ class NodeManagerConfig(ConfigParser.SafeConfigParser): return matching_sizes def shutdown_windows(self): - return [int(n) + return [float(n) for n in self.get('Cloud', 'shutdown_windows').split(',')]