• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.get_instances_count函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sahara.plugins.utils.get_instances_count函数的典型用法代码示例。如果您正苦于以下问题:Python get_instances_count函数的具体用法?Python get_instances_count怎么用?Python get_instances_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_instances_count函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _check_yarn

def _check_yarn(cluster):
    rm_count = utils.get_instances_count(cluster, common.RESOURCEMANAGER)
    nm_count = utils.get_instances_count(cluster, common.NODEMANAGER)
    hs_count = utils.get_instances_count(cluster, common.HISTORYSERVER)
    at_count = utils.get_instances_count(cluster, common.APP_TIMELINE_SERVER)

    if cluster.cluster_configs.get("general", {}).get(
            common.RESOURCEMANAGER_HA):
        _check_zk_ha(cluster)

        if rm_count != 2:
            raise ex.InvalidComponentCountException(common.RESOURCEMANAGER, 2,
                                                    rm_count)
    else:
        if rm_count != 1:
            raise ex.InvalidComponentCountException(common.RESOURCEMANAGER, 1,
                                                    rm_count)

    if hs_count != 1:
        raise ex.InvalidComponentCountException(common.HISTORYSERVER, 1,
                                                hs_count)
    if at_count != 1:
        raise ex.InvalidComponentCountException(common.APP_TIMELINE_SERVER, 1,
                                                at_count)
    if nm_count == 0:
        raise ex.InvalidComponentCountException(common.NODEMANAGER,
                                                _("1 or more"), nm_count)
开发者ID:Imperat,项目名称:sahara,代码行数:27,代码来源:validation.py


示例2: _check_storm

def _check_storm(cluster):
    dr_count = utils.get_instances_count(cluster, common.DRPC_SERVER)
    ni_count = utils.get_instances_count(cluster, common.NIMBUS)
    su_count = utils.get_instances_count(cluster, common.STORM_UI_SERVER)
    sv_count = utils.get_instances_count(cluster, common.SUPERVISOR)
    if dr_count > 1:
        raise ex.InvalidComponentCountException(common.DRPC_SERVER,
                                                _("0 or 1"), dr_count)
    if ni_count > 1:
        raise ex.InvalidComponentCountException(common.NIMBUS,
                                                _("0 or 1"), ni_count)
    if su_count > 1:
        raise ex.InvalidComponentCountException(common.STORM_UI_SERVER,
                                                _("0 or 1"), su_count)
    if dr_count == 0 and ni_count == 1:
        raise ex.RequiredServiceMissingException(
            common.DRPC_SERVER, required_by=common.NIMBUS)
    if dr_count == 1 and ni_count == 0:
        raise ex.RequiredServiceMissingException(
            common.NIMBUS, required_by=common.DRPC_SERVER)
    if su_count == 1 and (dr_count == 0 or ni_count == 0):
        raise ex.RequiredServiceMissingException(
            common.NIMBUS, required_by=common.STORM_UI_SERVER)
    if dr_count == 1 and sv_count == 0:
        raise ex.RequiredServiceMissingException(
            common.SUPERVISOR, required_by=common.DRPC_SERVER)
    if sv_count > 0 and dr_count == 0:
        raise ex.RequiredServiceMissingException(
            common.DRPC_SERVER, required_by=common.SUPERVISOR)
开发者ID:crobby,项目名称:sahara,代码行数:29,代码来源:validation.py


示例3: _check_hdfs

def _check_hdfs(cluster):
    nn_count = utils.get_instances_count(cluster, common.NAMENODE)
    dn_count = utils.get_instances_count(cluster, common.DATANODE)
    if nn_count != 1:
        raise ex.InvalidComponentCountException(common.NAMENODE, 1, nn_count)
    if dn_count == 0:
        raise ex.InvalidComponentCountException(
            common.DATANODE, _("1 or more"), dn_count)
开发者ID:crobby,项目名称:sahara,代码行数:8,代码来源:validation.py


示例4: _check_ambari

def _check_ambari(cluster):
    am_count = utils.get_instances_count(cluster, common.AMBARI_SERVER)
    zk_count = utils.get_instances_count(cluster, common.ZOOKEEPER_SERVER)
    if am_count != 1:
        raise ex.InvalidComponentCountException(common.AMBARI_SERVER, 1,
                                                am_count)
    if zk_count == 0:
        raise ex.InvalidComponentCountException(common.ZOOKEEPER_SERVER,
                                                _("1 or more"), zk_count)
开发者ID:crobby,项目名称:sahara,代码行数:9,代码来源:validation.py


示例5: _check_hbase

def _check_hbase(cluster):
    hm_count = utils.get_instances_count(cluster, common.HBASE_MASTER)
    hr_count = utils.get_instances_count(cluster, common.HBASE_REGIONSERVER)
    if hm_count > 1:
        raise ex.InvalidComponentCountException(common.HBASE_MASTER,
                                                _("0 or 1"), hm_count)
    if hm_count == 1 and hr_count == 0:
        raise ex.RequiredServiceMissingException(
            common.HBASE_REGIONSERVER, required_by=common.HBASE_MASTER)
    if hr_count > 0 and hm_count == 0:
        raise ex.RequiredServiceMissingException(
            common.HBASE_MASTER, required_by=common.HBASE_REGIONSERVER)
开发者ID:crobby,项目名称:sahara,代码行数:12,代码来源:validation.py


示例6: _check_ranger

def _check_ranger(cluster):
    ra_count = utils.get_instances_count(cluster, common.RANGER_ADMIN)
    ru_count = utils.get_instances_count(cluster, common.RANGER_USERSYNC)
    if ra_count > 1:
        raise ex.InvalidComponentCountException(common.RANGER_ADMIN,
                                                _("0 or 1"), ra_count)
    if ru_count > 1:
        raise ex.InvalidComponentCountException(common.RANGER_USERSYNC,
                                                _("0 or 1"), ru_count)
    if ra_count == 1 and ru_count == 0:
        raise ex.RequiredServiceMissingException(
            common.RANGER_USERSYNC, required_by=common.RANGER_ADMIN)
    if ra_count == 0 and ru_count == 1:
        raise ex.RequiredServiceMissingException(
            common.RANGER_ADMIN, required_by=common.RANGER_USERSYNC)
开发者ID:crobby,项目名称:sahara,代码行数:15,代码来源:validation.py


示例7: _check_hive

def _check_hive(cluster):
    hs_count = utils.get_instances_count(cluster, common.HIVE_SERVER)
    hm_count = utils.get_instances_count(cluster, common.HIVE_METASTORE)
    if hs_count > 1:
        raise ex.InvalidComponentCountException(common.HIVE_SERVER,
                                                _("0 or 1"), hs_count)
    if hm_count > 1:
        raise ex.InvalidComponentCountException(common.HIVE_METASTORE,
                                                _("0 or 1"), hm_count)
    if hs_count == 0 and hm_count == 1:
        raise ex.RequiredServiceMissingException(
            common.HIVE_SERVER, required_by=common.HIVE_METASTORE)
    if hs_count == 1 and hm_count == 0:
        raise ex.RequiredServiceMissingException(
            common.HIVE_METASTORE, required_by=common.HIVE_SERVER)
开发者ID:crobby,项目名称:sahara,代码行数:15,代码来源:validation.py


示例8: validate_job_execution

 def validate_job_execution(self, cluster, job, data):
     oozie_count = plugin_utils.get_instances_count(cluster,
                                                    p_common.OOZIE_SERVER)
     if oozie_count != 1:
         raise pex.InvalidComponentCountException(
             p_common.OOZIE_SERVER, "1", oozie_count)
     super(EDPOozieEngine, self).validate_job_execution(cluster, job, data)
开发者ID:crobby,项目名称:sahara,代码行数:7,代码来源:edp_engine.py


示例9: validate_job_execution

    def validate_job_execution(self, cluster, job, data):
        oo_count = u.get_instances_count(cluster, 'OOZIE_SERVER')
        if oo_count != 1:
            raise pl_ex.InvalidComponentCountException(
                'OOZIE_SERVER', '1', oo_count)

        super(EdpOozieEngine, self).validate_job_execution(cluster, job, data)
开发者ID:metasensus,项目名称:sahara,代码行数:7,代码来源:edp_engine.py


示例10: _check_yarn

def _check_yarn(cluster):
    rm_count = utils.get_instances_count(cluster, common.RESOURCEMANAGER)
    nm_count = utils.get_instances_count(cluster, common.NODEMANAGER)
    hs_count = utils.get_instances_count(cluster, common.HISTORYSERVER)
    at_count = utils.get_instances_count(cluster, common.APP_TIMELINE_SERVER)
    if rm_count != 1:
        raise ex.InvalidComponentCountException(common.RESOURCEMANAGER, 1,
                                                rm_count)
    if hs_count != 1:
        raise ex.InvalidComponentCountException(common.HISTORYSERVER, 1,
                                                hs_count)
    if at_count != 1:
        raise ex.InvalidComponentCountException(common.APP_TIMELINE_SERVER, 1,
                                                at_count)
    if nm_count == 0:
        raise ex.InvalidComponentCountException(common.NODEMANAGER,
                                                _("1 or more"), nm_count)
开发者ID:crobby,项目名称:sahara,代码行数:17,代码来源:validation.py


示例11: _check_hdfs

def _check_hdfs(cluster):
    nn_count = utils.get_instances_count(cluster, common.NAMENODE)
    dn_count = utils.get_instances_count(cluster, common.DATANODE)

    if cluster.cluster_configs.get("general", {}).get(common.NAMENODE_HA):
        _check_zk_ha(cluster)
        _check_jn_ha(cluster)

        if nn_count != 2:
            raise ex.InvalidComponentCountException(common.NAMENODE, 2,
                                                    nn_count)
    else:
        if nn_count != 1:
            raise ex.InvalidComponentCountException(common.NAMENODE, 1,
                                                    nn_count)
    if dn_count == 0:
        raise ex.InvalidComponentCountException(
            common.DATANODE, _("1 or more"), dn_count)
开发者ID:frgaudet,项目名称:sahara,代码行数:18,代码来源:validation.py


示例12: _check_zk_ha

def _check_zk_ha(cluster):
    zk_count = utils.get_instances_count(cluster, common.ZOOKEEPER_SERVER)
    if zk_count < 3:
        raise ex.InvalidComponentCountException(
            common.ZOOKEEPER_SERVER,
            _("3 or more. Odd number"),
            zk_count, _("At least 3 ZooKeepers are required for HA"))
    if zk_count % 2 != 1:
        raise ex.InvalidComponentCountException(
            common.ZOOKEEPER_SERVER,
            _("Odd number"),
            zk_count, _("Odd number of ZooKeepers are required for HA"))
开发者ID:Imperat,项目名称:sahara,代码行数:12,代码来源:validation.py


示例13: _check_jn_ha

def _check_jn_ha(cluster):
    jn_count = utils.get_instances_count(cluster, common.JOURNAL_NODE)
    if jn_count < 3:
        raise ex.InvalidComponentCountException(
            common.JOURNAL_NODE,
            _("3 or more. Odd number"),
            jn_count, _("At least 3 JournalNodes are required for HA"))
    if jn_count % 2 != 1:
        raise ex.InvalidComponentCountException(
            common.JOURNAL_NODE,
            _("Odd number"),
            jn_count, _("Odd number of JournalNodes are required for HA"))
开发者ID:Imperat,项目名称:sahara,代码行数:12,代码来源:validation.py


示例14: validate_job_execution

    def validate_job_execution(self, cluster, job, data):
        if not self.edp_supported(cluster.hadoop_version):
            raise ex.InvalidDataException(
                _("Cloudera {base} or higher required to run {type}" "jobs").format(
                    base=EdpSparkEngine.edp_base_version, type=job.type
                )
            )

        shs_count = u.get_instances_count(cluster, "SPARK_YARN_HISTORY_SERVER")
        if shs_count != 1:
            raise pl_ex.InvalidComponentCountException("SPARK_YARN_HISTORY_SERVER", "1", shs_count)

        super(EdpSparkEngine, self).validate_job_execution(cluster, job, data)
开发者ID:uladz,项目名称:sahara,代码行数:13,代码来源:edp_engine.py


示例15: validate_job_execution

    def validate_job_execution(self, cluster, job, data):
        if not self.edp_supported(cluster.hadoop_version):
            raise exc.InvalidDataException(
                _('Ambari plugin of {base} or higher required to run {type} '
                  'jobs').format(
                    base=EDPSparkEngine.edp_base_version, type=job.type))

        spark_nodes_count = plugin_utils.get_instances_count(
            cluster, p_common.SPARK_JOBHISTORYSERVER)
        if spark_nodes_count != 1:
            raise pex.InvalidComponentCountException(
                p_common.SPARK_JOBHISTORYSERVER, '1', spark_nodes_count)

        super(EDPSparkEngine, self).validate_job_execution(
            cluster, job, data)
开发者ID:egafford,项目名称:sahara,代码行数:15,代码来源:edp_engine.py


示例16: get_instances_count

 def get_instances_count(self, node_process=None):
     name = _get_node_process_name(node_process)
     return u.get_instances_count(self.cluster, name)
开发者ID:snowind,项目名称:sahara,代码行数:3,代码来源:base_cluster_context.py


示例17: _check_oozie

def _check_oozie(cluster):
    count = utils.get_instances_count(cluster, common.OOZIE_SERVER)
    if count > 1:
        raise ex.InvalidComponentCountException(common.OOZIE_SERVER,
                                                _("0 or 1"), count)
开发者ID:crobby,项目名称:sahara,代码行数:5,代码来源:validation.py


示例18: get_instances_count

 def get_instances_count(self, node_process=None):
     return u.get_instances_count(self.cluster, node_process)
开发者ID:a9261,项目名称:sahara,代码行数:2,代码来源:cluster_info.py


示例19: get_instances_count

 def get_instances_count(self, node_process=None):
     if node_process is not None:
         node_process = su.get_node_process_name(node_process)
     return u.get_instances_count(self.cluster, node_process)
开发者ID:egafford,项目名称:sahara,代码行数:4,代码来源:base_cluster_context.py


示例20: _check_spark

def _check_spark(cluster):
    count = utils.get_instances_count(cluster, common.SPARK_JOBHISTORYSERVER)
    if count > 1:
        raise ex.InvalidComponentCountException(common.SPARK_JOBHISTORYSERVER,
                                                _("0 or 1"), count)
开发者ID:crobby,项目名称:sahara,代码行数:5,代码来源:validation.py



注:本文中的sahara.plugins.utils.get_instances_count函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.get_datanodes函数代码示例发布时间:2022-05-27
下一篇:
Python utils.get_instances函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap