Esempio n. 1
0
    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)
Esempio n. 2
0
    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()
Esempio n. 3
0
    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()
Esempio n. 4
0
    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()
Esempio n. 5
0
    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)
Esempio n. 6
0
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)
Esempio n. 7
0
    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)
Esempio n. 8
0
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)
Esempio n. 9
0
 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"]), [])
Esempio n. 10
0
    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)
Esempio n. 11
0
 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']), [])
Esempio n. 12
0
 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']), [])
Esempio n. 13
0
 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])
Esempio n. 14
0
 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)
Esempio n. 15
0
 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)
Esempio n. 16
0
 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)
Esempio n. 17
0
 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)