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

Python general.execute_on_instances函数代码示例

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

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



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

示例1: configure_general_environment

    def configure_general_environment(self, cluster_context, instances=None):
        LOG.debug('Executing post configure hooks')

        if not instances:
            instances = cluster_context.get_instances()

        def set_user_password(instance):
            LOG.debug('Setting password for user "mapr"')
            if self.mapr_user_exists(instance):
                with instance.remote() as r:
                    r.execute_command(
                        'echo "%s:%s"|chpasswd' % ('mapr', 'mapr'),
                        run_as_root=True)
            else:
                LOG.warning(_LW('User "mapr" does not exists'))

        def create_home_mapr(instance):
            target_path = '/home/mapr'
            LOG.debug("Creating home directory for user 'mapr'")
            args = {'path': target_path}
            cmd = 'mkdir -p %(path)s && chown mapr:mapr %(path)s' % args
            if self.mapr_user_exists(instance):
                with instance.remote() as r:
                    r.execute_command(cmd, run_as_root=True)
            else:
                LOG.warning(_LW('User "mapr" does not exists'))

        util.execute_on_instances(instances, set_user_password)
        util.execute_on_instances(instances, create_home_mapr)
开发者ID:YongchaoTIAN,项目名称:sahara,代码行数:29,代码来源:base_cluster_configurer.py


示例2: _install_security_repos

    def _install_security_repos(self, cluster_context, instances):
        LOG.debug("Installing security repos")

        @el.provision_event()
        def install_security_repos(instance):
            return util.run_script(instance, ADD_SECURITY_REPO_SCRIPT, "root")

        util.execute_on_instances(instances, install_security_repos)
开发者ID:frgaudet,项目名称:sahara,代码行数:8,代码来源:base_cluster_configurer.py


示例3: _configure_ssh_connection

    def _configure_ssh_connection(self, cluster_context, instances):
        def keep_alive_connection(instance):
            echo_param = 'echo "KeepAlive yes" >> ~/.ssh/config'
            echo_timeout = 'echo "ServerAliveInterval 60" >> ~/.ssh/config'
            with instance.remote() as r:
                r.execute_command(echo_param)
                r.execute_command(echo_timeout)

        util.execute_on_instances(instances, keep_alive_connection)
开发者ID:YongchaoTIAN,项目名称:sahara,代码行数:9,代码来源:base_cluster_configurer.py


示例4: _install_ssh_keys

 def _install_ssh_keys(self, cluster_context, instances):
     slaves = cluster_context.filter_instances(instances, SPARK_SLAVE)
     masters = cluster_context.filter_instances(instances, SPARK_MASTER)
     instances = g.unique_list(masters + slaves)
     private_key = cluster_context.cluster.management_private_key
     public_key = cluster_context.cluster.management_public_key
     g.execute_on_instances(
         instances, g.install_ssh_key, 'mapr', private_key, public_key)
     g.execute_on_instances(instances, g.authorize_key, 'mapr', public_key)
开发者ID:AllenFromMinneapolis,项目名称:sahara,代码行数:9,代码来源:spark.py


示例5: _install_mapr_repo

    def _install_mapr_repo(self, cluster_context, instances):
        distro_name = cluster_context.distro.name

        @el.provision_event()
        def install_mapr_repos(instance):
            return util.run_script(instance, ADD_MAPR_REPO_SCRIPT, "root",
                                   distro_name, **cluster_context.mapr_repos)

        util.execute_on_instances(instances, install_mapr_repos)
开发者ID:frgaudet,项目名称:sahara,代码行数:9,代码来源:base_cluster_configurer.py


示例6: _install_mysql_client

    def _install_mysql_client(self, cluster_context, instances):
        LOG.debug("Installing MySQL client")
        distro_name = cluster_context.distro.name

        @el.provision_event()
        def install_mysql_client(instance):
            return util.run_script(instance, INSTALL_MYSQL_CLIENT,
                                   "root", distro_name)

        util.execute_on_instances(instances, install_mysql_client)
开发者ID:frgaudet,项目名称:sahara,代码行数:10,代码来源:base_cluster_configurer.py


示例7: _install_java

    def _install_java(self, cluster_context, instances):
        LOG.debug("Installing Java")
        distro_name = cluster_context.distro.name

        @el.provision_event()
        def install_java(instance):
            return util.run_script(instance, INSTALL_JAVA_SCRIPT,
                                   "root", distro_name)

        util.execute_on_instances(instances, install_java)
开发者ID:frgaudet,项目名称:sahara,代码行数:10,代码来源:base_cluster_configurer.py


示例8: _set_cluster_mode

    def _set_cluster_mode(self, cluster_context, instances):
        cluster_mode = cluster_context.cluster_mode
        if not cluster_mode:
            return

        command = "maprcli cluster mapreduce set -mode %s" % cluster_mode

        @el.provision_event()
        def set_cluster_mode(instance):
            return util.execute_command([instance], command, run_as="mapr")

        util.execute_on_instances(instances, set_cluster_mode)
开发者ID:frgaudet,项目名称:sahara,代码行数:12,代码来源:base_cluster_configurer.py


示例9: _write_config_files

    def _write_config_files(self, cluster_context, instances):
        LOG.debug('Writing config files')

        @el.provision_event()
        def write_config_files(instance, config_files):
            for file in config_files:
                util.write_file(instance, file.path, file.data, mode=file.mode,
                                owner="mapr")

        node_groups = util.unique_list(instances, lambda i: i.node_group)
        for node_group in node_groups:
            config_files = cluster_context.get_config_files(node_group)
            ng_instances = [i for i in node_group.instances if i in instances]
            util.execute_on_instances(ng_instances, write_config_files,
                                      config_files=config_files)

        LOG.debug("Config files are successfully written")
开发者ID:Imperat,项目名称:sahara,代码行数:17,代码来源:base_cluster_configurer.py


示例10: _wait_for_status

    def _wait_for_status(self, instances, status, sleep=3, timeout=60):
        def poll_status(instance):
            operation_name = _('Wait for {node_process} on {instance}'
                               ' to change status to "{status}"')
            args = {
                'node_process': self.ui_name,
                'instance': instance.instance_name,
                'status': status.name,
            }
            return polls.poll(
                get_status=lambda: self.status(instance) == status,
                operation_name=operation_name.format(**args),
                timeout=timeout,
                sleep=sleep,
            )

        util.execute_on_instances(instances, poll_status)
开发者ID:AlexanderYAPPO,项目名称:sahara,代码行数:17,代码来源:node_process.py


示例11: _write_config_files

    def _write_config_files(self, cluster_context, instances):
        LOG.debug('Writing config files')

        @el.provision_event()
        def write_config_files(instance, config_files):
            for path, data in six.iteritems(config_files):
                util.mkdir(instance, os.path.dirname(path), owner="root")
                util.write_file(instance, path, data, owner="root")

        node_groups = util.unique_list(instances, lambda i: i.node_group)
        for node_group in node_groups:
            config_files = cluster_context.get_config_files(node_group)
            ng_instances = [i for i in node_group.instances if i in instances]
            util.execute_on_instances(ng_instances, write_config_files,
                                      config_files=config_files)

        LOG.debug("Config files are successfully written")
开发者ID:egafford,项目名称:sahara,代码行数:17,代码来源:base_cluster_configurer.py


示例12: _configure_topology

    def _configure_topology(self, context, instances):
        def write_file(instance, path, data):
            with instance.remote() as r:
                r.write_file_to(path, data, run_as_root=True)

        LOG.debug("Configuring cluster topology")
        is_node_aware = context.is_node_aware
        if is_node_aware:
            topo = th.generate_topology_map(context.cluster, is_node_aware)
            topo = "\n".join(["%s %s" % i for i in six.iteritems(topo)]) + "\n"
            data_path = "%s/topology.data" % context.mapr_home
            script = files.get_file_text(_TOPO_SCRIPT)
            script_path = "%s/topology.sh" % context.mapr_home
            util.execute_on_instances(instances, write_file, data_path, topo)
            util.execute_on_instances(instances, util.write_file, script_path, script, "+x", "root")
        else:
            LOG.debug("Data locality is disabled.")
        LOG.info(_LI("Cluster topology successfully configured"))
开发者ID:metasensus,项目名称:sahara,代码行数:18,代码来源:base_cluster_configurer.py


示例13: _configure_topology

    def _configure_topology(self, context, instances):
        def write_file(instance, path, data):
            with instance.remote() as r:
                r.write_file_to(path, data, run_as_root=True)

        LOG.debug('Configuring cluster topology')
        is_node_aware = context.is_node_aware
        if is_node_aware:
            topo = th.generate_topology_map(context.cluster, is_node_aware)
            topo = '\n'.join(['%s %s' % i for i in six.iteritems(topo)]) + '\n'
            data_path = '%s/topology.data' % context.mapr_home
            script = files.get_file_text(_TOPO_SCRIPT)
            script_path = '%s/topology.sh' % context.mapr_home
            util.execute_on_instances(instances, write_file, data_path, topo)
            util.execute_on_instances(
                instances, util.write_file, script_path, script, '+x', 'root')
        else:
            LOG.debug('Data locality is disabled.')
        LOG.info(_LI('Cluster topology successfully configured'))
开发者ID:YongchaoTIAN,项目名称:sahara,代码行数:19,代码来源:base_cluster_configurer.py


示例14: _configure_topology

    def _configure_topology(self, context, instances):
        LOG.debug("Configuring cluster topology")

        topology_map = context.topology_map
        topology_map = ("%s %s" % item for item in six.iteritems(topology_map))
        topology_map = "\n".join(topology_map) + "\n"

        data_path = "%s/topology.data" % context.mapr_home
        script = files.get_file_text(_TOPO_SCRIPT)
        script_path = '%s/topology.sh' % context.mapr_home

        @el.provision_event()
        def write_topology_data(instance):
            util.write_file(instance, data_path, topology_map, owner="root")
            util.write_file(instance, script_path, script,
                            mode="+x", owner="root")

        util.execute_on_instances(instances, write_topology_data)

        LOG.info(_LI('Cluster topology successfully configured'))
开发者ID:frgaudet,项目名称:sahara,代码行数:20,代码来源:base_cluster_configurer.py


示例15: _prepare_bare_image

    def _prepare_bare_image(self, cluster_context, instances):
        LOG.debug("Preparing bare image")

        if d.UBUNTU == cluster_context.distro:
            LOG.debug("Installing security repos")
            util.execute_on_instances(instances, util.run_script, ADD_SECURITY_REPO_SCRIPT, "root")

        d_name = cluster_context.distro.name

        LOG.debug("Installing Java")
        util.execute_on_instances(instances, util.run_script, INSTALL_JAVA_SCRIPT, "root", d_name)
        LOG.debug("Installing Scala")
        util.execute_on_instances(instances, util.run_script, INSTALL_SCALA_SCRIPT, "root", d_name)
        LOG.debug("Installing MySQL client")
        util.execute_on_instances(instances, util.run_script, INSTALL_MYSQL_CLIENT, "root", d_name)
        LOG.debug("Bare images successfully prepared")
开发者ID:metasensus,项目名称:sahara,代码行数:16,代码来源:base_cluster_configurer.py


示例16: _prepare_bare_image

    def _prepare_bare_image(self, cluster_context, instances):
        LOG.debug('Preparing bare image')
        d_name = cluster_context.distro.name

        LOG.debug('Installing Java')
        util.execute_on_instances(
            instances, util.run_script, INSTALL_JAVA_SCRIPT, 'root', d_name)
        LOG.debug('Installing Scala')
        util.execute_on_instances(
            instances, util.run_script, INSTALL_SCALA_SCRIPT, 'root', d_name)
        LOG.debug('Installing MySQL client')
        util.execute_on_instances(
            instances, util.run_script, INSTALL_MYSQL_CLIENT, 'root', d_name)
        LOG.debug('Bare images successfully prepared')
开发者ID:YongchaoTIAN,项目名称:sahara,代码行数:14,代码来源:base_cluster_configurer.py


示例17: _install

 def _install(_context, _instances):
     g.execute_on_instances(_instances,
                            self._install_packages_on_instance,
                            _context)
开发者ID:Imperat,项目名称:sahara,代码行数:4,代码来源:service.py


示例18: _rebuild

 def _rebuild(self, cluster_context, instances):
     OOZIE.stop(filter(OOZIE.is_started, instances))
     g.execute_on_instances(
         instances, self._rebuild_oozie_war, cluster_context)
     OOZIE.start(instances)
     con.sleep(OOZIE_START_DELAY)
开发者ID:frgaudet,项目名称:sahara,代码行数:6,代码来源:oozie.py


示例19: _install_ui

 def _install_ui(self, cluster_context, instances):
     OOZIE.stop(filter(OOZIE.is_started, instances))
     g.execute_on_instances(
         instances, self._rebuild_oozie_war, cluster_context)
     OOZIE.start(instances)
开发者ID:AllenFromMinneapolis,项目名称:sahara,代码行数:5,代码来源:oozie.py


示例20: install

 def install(self, cluster_context, instances):
     g.execute_on_instances(instances, self._install_packages_on_instance,
                            cluster_context)
开发者ID:frgaudet,项目名称:sahara,代码行数:3,代码来源:service.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python config_helper.is_data_locality_enabled函数代码示例发布时间: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