def validate(self, cluster): nn_count = sum( [ng.count for ng in utils.get_node_groups(cluster, "namenode")]) if nn_count != 1: raise ex.InvalidComponentCountException("namenode", 1, nn_count) dn_count = sum( [ng.count for ng in utils.get_node_groups(cluster, "datanode")]) if dn_count < 1: raise ex.InvalidComponentCountException("datanode", _("1 or more"), nn_count) # validate Spark Master Node and Spark Slaves sm_count = sum( [ng.count for ng in utils.get_node_groups(cluster, "master")]) if sm_count != 1: raise ex.RequiredServiceMissingException("Spark master") sl_count = sum( [ng.count for ng in utils.get_node_groups(cluster, "slave")]) if sl_count < 1: raise ex.InvalidComponentCountException("Spark slave", _("1 or more"), sl_count)
def validate(self, cluster): nn_count = sum([ng.count for ng in utils.get_node_groups(cluster, "namenode")]) if nn_count != 1: raise ex.InvalidComponentCountException("namenode", 1, nn_count) dn_count = sum([ng.count for ng in utils.get_node_groups(cluster, "datanode")]) if dn_count < 1: raise ex.InvalidComponentCountException("datanode", "1 or more", nn_count) # validate Spark Master Node and Spark Slaves sm_count = sum([ng.count for ng in utils.get_node_groups(cluster, "master")]) if sm_count != 1: raise ex.RequiredServiceMissingException("Spark master") sl_count = sum([ng.count for ng in utils.get_node_groups(cluster, "slave")]) if sl_count < 1: raise ex.InvalidComponentCountException("Spark slave", "1 or more", sl_count)
def validate(self, cluster): # validate Storm Master Node and Storm Slaves sm_count = sum([ng.count for ng in utils.get_node_groups(cluster, "master")]) if sm_count != 1: raise ex.RequiredServiceMissingException("Storm master") sl_count = sum([ng.count for ng in utils.get_node_groups(cluster, "slave")]) if sl_count < 1: raise ex.InvalidComponentCountException("Storm slave", "1 or more", sl_count)
def validate(self, cluster): nn_count = sum( [ng.count for ng in utils.get_node_groups(cluster, "namenode")]) if nn_count != 1: raise ex.InvalidComponentCountException("namenode", 1, nn_count) jt_count = sum( [ng.count for ng in utils.get_node_groups(cluster, "jobtracker")]) if jt_count not in [0, 1]: raise ex.InvalidComponentCountException("jobtracker", _('0 or 1'), jt_count) oozie_count = sum( [ng.count for ng in utils.get_node_groups(cluster, "oozie")]) if oozie_count not in [0, 1]: raise ex.InvalidComponentCountException("oozie", _('0 or 1'), oozie_count) hive_count = sum( [ng.count for ng in utils.get_node_groups(cluster, "hiveserver")]) if jt_count == 0: tt_count = sum([ ng.count for ng in utils.get_node_groups(cluster, "tasktracker") ]) if tt_count > 0: raise ex.RequiredServiceMissingException( "jobtracker", required_by="tasktracker") if oozie_count > 0: raise ex.RequiredServiceMissingException("jobtracker", required_by="oozie") if hive_count > 0: raise ex.RequiredServiceMissingException("jobtracker", required_by="hive") if hive_count not in [0, 1]: raise ex.InvalidComponentCountException("hive", _('0 or 1'), hive_count)
def _configure_storage(client, cluster): datanode_ng = u.get_node_groups(cluster, 'datanode')[0] storage_paths = datanode_ng.storage_paths() dn_hosts = [i.fqdn() for i in u.get_datanodes(cluster)] name_dir_param = ",".join( [st_path + '/dfs/name' for st_path in storage_paths]) data_dir_param = ",".join( [st_path + '/dfs/data' for st_path in storage_paths]) client.params.hdfs.update('dfs.name.dir', name_dir_param) client.params.hdfs.update('dfs.data.dir', data_dir_param, nodes=dn_hosts)
def _configure_storage(client, cluster): datanode_ng = u.get_node_groups(cluster, 'datanode')[0] storage_paths = datanode_ng.storage_paths() dn_hosts = [i.fqdn() for i in u.get_datanodes(cluster)] name_dir_param = ",".join( [st_path + '/dfs/name' for st_path in storage_paths]) data_dir_param = ",".join( [st_path + '/dfs/data' for st_path in storage_paths]) client.params.hdfs.update('dfs.name.dir', name_dir_param) client.params.hdfs.update('dfs.data.dir', data_dir_param, nodes=dn_hosts)
def validate(self, cluster): nn_count = sum([ng.count for ng in utils.get_node_groups(cluster, "namenode")]) if nn_count != 1: raise ex.InvalidComponentCountException("namenode", 1, nn_count) jt_count = sum([ng.count for ng in utils.get_node_groups(cluster, "jobtracker")]) if jt_count not in [0, 1]: raise ex.InvalidComponentCountException("jobtracker", _('0 or 1'), jt_count) oozie_count = sum([ng.count for ng in utils.get_node_groups(cluster, "oozie")]) if oozie_count not in [0, 1]: raise ex.InvalidComponentCountException("oozie", _('0 or 1'), oozie_count) hive_count = sum([ng.count for ng in utils.get_node_groups(cluster, "hiveserver")]) if jt_count == 0: tt_count = sum([ng.count for ng in utils.get_node_groups(cluster, "tasktracker")]) if tt_count > 0: raise ex.RequiredServiceMissingException( "jobtracker", required_by="tasktracker") if oozie_count > 0: raise ex.RequiredServiceMissingException( "jobtracker", required_by="oozie") if hive_count > 0: raise ex.RequiredServiceMissingException( "jobtracker", required_by="hive") if hive_count not in [0, 1]: raise ex.InvalidComponentCountException("hive", _('0 or 1'), hive_count)
def validate(self, cluster): nn_count = sum([ng.count for ng in u.get_node_groups(cluster, 'namenode')]) if nn_count != 1: raise ex.InvalidComponentCountException('namenode', 1, nn_count) jt_count = sum([ng.count for ng in u.get_node_groups(cluster, 'jobtracker')]) if jt_count > 1: raise ex.InvalidComponentCountException('jobtracker', '0 or 1', jt_count) tt_count = sum([ng.count for ng in u.get_node_groups(cluster, 'tasktracker')]) if jt_count == 0 and tt_count > 0: raise ex.RequiredServiceMissingException( 'jobtracker', required_by='tasktracker') mng_count = sum([ng.count for ng in u.get_node_groups(cluster, 'manager')]) if mng_count != 1: raise ex.InvalidComponentCountException('manager', 1, mng_count)
def validate(self, cluster): nn_count = sum( [ng.count for ng in u.get_node_groups(cluster, 'namenode')]) if nn_count != 1: raise ex.InvalidComponentCountException('namenode', 1, nn_count) jt_count = sum( [ng.count for ng in u.get_node_groups(cluster, 'jobtracker')]) if jt_count > 1: raise ex.InvalidComponentCountException('jobtracker', '0 or 1', jt_count) tt_count = sum( [ng.count for ng in u.get_node_groups(cluster, 'tasktracker')]) if jt_count == 0 and tt_count > 0: raise ex.RequiredServiceMissingException('jobtracker', required_by='tasktracker') mng_count = sum( [ng.count for ng in u.get_node_groups(cluster, 'manager')]) if mng_count != 1: raise ex.InvalidComponentCountException('manager', 1, mng_count)
def _get_inst_count(cluster, process): return sum([ng.count for ng in u.get_node_groups(cluster, process)])
def _get_inst_count(cluster, process): return sum([ng.count for ng in u.get_node_groups(cluster, process)])
def test_get_node_groups(self): self.assertEqual(u.get_node_groups(self.c1), self.c1.node_groups) self.assertEqual(u.get_node_groups(self.c1, "wrong-process"), []) self.assertEqual(u.get_node_groups(self.c1, 'dn'), [self.ng2, self.ng3])