Merge branch 'master' into 13804-no-shutdown-wanted-nodes
[arvados.git] / services / nodemanager / arvnodeman / config.py
index 19d92adc64c2993863efeab26d1b31bae8e495a4..4fda7e76d69ed87aa1b5b032f1e3b1b8e608f5b5 100644 (file)
@@ -57,7 +57,8 @@ class NodeManagerConfig(ConfigParser.SafeConfigParser):
                        '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 +73,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,
@@ -148,16 +150,17 @@ class NodeManagerConfig(ConfigParser.SafeConfigParser):
         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 if missing
                 size_spec['instance_type'] = sec_words[1]
@@ -174,5 +177,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(',')]