本文整理汇总了Python中charms.layer.apache_bigtop_base.Bigtop.install_component方法的典型用法代码示例。如果您正苦于以下问题:Python Bigtop.install_component方法的具体用法?Python Bigtop.install_component怎么用?Python Bigtop.install_component使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类charms.layer.apache_bigtop_base.Bigtop
的用法示例。
在下文中一共展示了Bigtop.install_component方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: install_component
# 需要导入模块: from charms.layer.apache_bigtop_base import Bigtop [as 别名]
# 或者: from charms.layer.apache_bigtop_base.Bigtop import install_component [as 别名]
def install_component(namenode, resourcemanager):
'''Install only if nn and rm have sent their FQDNs.'''
if namenode.namenodes() and resourcemanager.resourcemanagers():
set_state('components.installed')
options = layer.options('apache-bigtop-base')
components = options.get("bigtop_component_list")
hookenv.status_set('maintenance', 'installing {}'.format(components))
nn_fqdn = namenode.namenodes()[0]
rm_fqdn = resourcemanager.resourcemanagers()[0]
bigtop = Bigtop()
hosts = {'namenode': nn_fqdn, 'resourcemanager': rm_fqdn}
bigtop.install_component(RM=rm_fqdn, NN=nn_fqdn)
for component in components.split():
try:
for port in get_layer_opts().exposed_ports(component):
hookenv.open_port(port)
except AttributeError:
hookenv.log("Not opening ports for component {}".format(component))
hookenv.status_set('active', 'ready')
else:
hookenv.status_set('waiting',
'waiting for namenode and resource manager to become ready')