def test_get_config_value(self, cond_get_cluster): cluster = self._get_fake_cluster() cond_get_cluster.return_value = cluster self.assertEqual( c_h.get_config_value('HDFS', 'fs.default.name', cluster), 'hdfs://inst1:8020') self.assertEqual(c_h.get_config_value('HDFS', 'spam', cluster), 'eggs') self.assertEqual( c_h.get_config_value('HDFS', 'dfs.safemode.extension'), 30000) self.assertRaises(e.ConfigurationError, c_h.get_config_value, 'MapReduce', 'spam', cluster)
def test_get_config_value(self, cond_get_cluster): cluster = self._get_fake_cluster() cond_get_cluster.return_value = cluster self.assertEqual( c_h.get_config_value('HDFS', 'fs.default.name', cluster), 'hdfs://inst1:8020') self.assertEqual( c_h.get_config_value('HDFS', 'spam', cluster), 'eggs') self.assertEqual( c_h.get_config_value('HDFS', 'dfs.safemode.extension'), 30000) self.assertRaises(RuntimeError, c_h.get_config_value, 'MapReduce', 'spam', cluster)
def _validate_existing_ng_scaling(self, cluster, existing): scalable_processes = self._get_scalable_processes() dn_to_delete = 0 for ng in cluster.node_groups: if ng.id in existing: if ng.count > existing[ng.id] and "datanode" in ng.node_processes: dn_to_delete += ng.count - existing[ng.id] if not set(ng.node_processes).issubset(scalable_processes): raise ex.NodeGroupCannotBeScaled( ng.name, _("Vanilla plugin cannot scale nodegroup" " with processes: %s") % " ".join(ng.node_processes), ) dn_amount = len(vu.get_datanodes(cluster)) rep_factor = c_helper.get_config_value("HDFS", "dfs.replication", cluster) if dn_to_delete > 0 and dn_amount - dn_to_delete < rep_factor: raise ex.ClusterCannotBeScaled( cluster.name, _( "Vanilla plugin cannot shrink cluster because " "it would be not enough nodes for replicas " "(replication factor is %s)" ) % rep_factor, )
def _validate_existing_ng_scaling(self, cluster, existing): scalable_processes = self._get_scalable_processes() dn_to_delete = 0 for ng in cluster.node_groups: if ng.id in existing: if ng.count > existing[ng.id] and "datanode" in \ ng.node_processes: dn_to_delete += ng.count - existing[ng.id] if not set(ng.node_processes).issubset(scalable_processes): raise ex.NodeGroupCannotBeScaled( ng.name, "Vanilla plugin cannot scale nodegroup" " with processes: " + ' '.join(ng.node_processes)) dn_amount = len(vu.get_datanodes(cluster)) rep_factor = c_helper.get_config_value('HDFS', 'dfs.replication', cluster) if dn_to_delete > 0 and dn_amount - dn_to_delete < rep_factor: raise ex.ClusterCannotBeScaled( cluster.name, "Vanilla plugin cannot shrink cluster because " "it would be not enough nodes for replicas " "(replication factor is %s)" % rep_factor)