def validate(self, cluster): nn_count = sum([ng.count for ng in utils.get_node_groups(cluster, "namenode")]) if nn_count != 1: raise ex.NotSingleNameNodeException(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.NotSingleJobTrackerException(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.NotSingleOozieException(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.TaskTrackersWithoutJobTracker() if oozie_count > 0: raise ex.OozieWithoutJobTracker() if hive_count > 0: raise ex.HiveWithoutJobTracker() if hive_count not in [0, 1]: raise ex.NotSingleHiveException(hive_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.NotSingleNameNodeException(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.NotSingleJobTrackerException(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.NotSingleOozieException(oozie_count) if jt_count == 0: tt_count = sum([ ng.count for ng in utils.get_node_groups(cluster, "tasktracker") ]) if tt_count > 0: raise ex.TaskTrackersWithoutJobTracker() if oozie_count > 0: raise ex.OozieWithoutJobTracker()
def check_for_jobtracker_and_tasktracker(self, cluster): jt_count = sum( [ng.count for ng in utils.get_node_groups(cluster, "JOBTRACKER")]) if jt_count not in [0, 1]: raise ex.NotSingleJobTrackerException(jt_count) tt_count = sum( [ng.count for ng in utils.get_node_groups(cluster, "TASKTRACKER")]) if jt_count is 0 and tt_count > 0: raise ex.TaskTrackersWithoutJobTracker()
def check_for_jobtracker_and_tasktracker(self, cluster): jt_count = sum([ng.count for ng in utils.get_node_groups(cluster, "JOBTRACKER")]) if jt_count not in [0, 1]: raise ex.NotSingleJobTrackerException(jt_count) tt_count = sum([ng.count for ng in utils.get_node_groups(cluster, "TASKTRACKER")]) if jt_count is 0 and tt_count > 0: raise ex.TaskTrackersWithoutJobTracker()
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 validate(self, cluster): nn_count = sum([ng.count for ng in u.get_node_groups(cluster, 'namenode')]) if nn_count != 1: raise ex.NotSingleNameNodeException(nn_count) jt_count = sum([ng.count for ng in u.get_node_groups(cluster, 'jobtracker')]) if jt_count > 1: raise ex.NotSingleJobTrackerException(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.TaskTrackersWithoutJobTracker() mng_count = sum([ng.count for ng in u.get_node_groups(cluster, 'manager')]) if mng_count != 1: raise i_ex.NotSingleManagerException(mng_count)
def test_get_node_groups(self): self.assertListEqual(u.get_node_groups(self.c1), self.c1.node_groups) self.assertListEqual(u.get_node_groups(self.c1, ["wrong-process"]), []) self.assertListEqual(u.get_node_groups(self.c1, ["dn", "tt"]), [self.ng2]) self.assertListEqual(u.get_node_groups(self.c1, "dn"), [self.ng2, self.ng3]) self.assertListEqual(u.get_node_groups(self.c1, ["dn"]), [self.ng2, self.ng3]) self.assertListEqual(u.get_node_groups(self.c1, ["jt", "tt"]), [])
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 test_get_node_groups(self): self.assertListEqual(u.get_node_groups(self.c1), self.c1.node_groups) self.assertListEqual(u.get_node_groups(self.c1, ["wrong-process"]), []) self.assertListEqual(u.get_node_groups(self.c1, ['dn', 'tt']), [self.ng2]) self.assertListEqual(u.get_node_groups(self.c1, 'dn'), [self.ng2, self.ng3]) self.assertListEqual(u.get_node_groups(self.c1, ['dn']), [self.ng2, self.ng3]) self.assertListEqual(u.get_node_groups(self.c1, ['jt', 'tt']), [])
def test_get_node_groups(self): self.assertListEqual(u.get_node_groups(self.c1), self.c1.node_groups) self.assertListEqual(u.get_node_groups(self.c1, "wrong-process"), []) self.assertListEqual(u.get_node_groups(self.c1, 'dn'), [self.ng2, self.ng3])
def check_for_ambari_server(self, cluster): count = sum([ng.count for ng in utils.get_node_groups(cluster, "AMBARI_SERVER")]) if count != 1: raise NotSingleAmbariServerException(count)
def check_for_namenode(self, cluster): count = sum([ng.count for ng in utils.get_node_groups(cluster, "NAMENODE")]) if count != 1: raise ex.NotSingleNameNodeException(count)
def check_for_ambari_server(self, cluster): count = sum([ ng.count for ng in utils.get_node_groups(cluster, "AMBARI_SERVER") ]) if count != 1: raise NotSingleAmbariServerException(count)
def check_for_namenode(self, cluster): count = sum( [ng.count for ng in utils.get_node_groups(cluster, "NAMENODE")]) if count != 1: raise ex.NotSingleNameNodeException(count)