本文整理汇总了Python中Cobalt.Proxy.ComponentProxy.get_implementation方法的典型用法代码示例。如果您正苦于以下问题:Python ComponentProxy.get_implementation方法的具体用法?Python ComponentProxy.get_implementation怎么用?Python ComponentProxy.get_implementation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cobalt.Proxy.ComponentProxy
的用法示例。
在下文中一共展示了ComponentProxy.get_implementation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fetch_hardware
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import get_implementation [as 别名]
def fetch_hardware():
'''Autodetect which system we are trying to contact and perform hardware
information fetch'''
global partition_table
global node_state
global indexes
global system_type
# Generate a list of all possible nodecards in all possible partitions
system = ComponentProxy('system', defer=True)
if system_type is None:
# We are self-discovering. Can save this step if we
# already know the system type.
system_type = system.get_implementation()
if system_type in bg_types:
partition_table = dict((part['name'], part['node_card_names'])
for part in system.get_partitions([{'name': '*',
'node_card_names': '*'}]))
node_state = {}
elif system_type in cluster_types:
partition_table = {}
node_state = dict((node[0], node[1]) for node in system.get_node_status())
elif system_type in cray_types:
partition_table = {}
# Using JSON for speed and avoinding the XML-RPC marshaller.
stst = json.loads(system.get_nodes(True, None, alps_system_query_fields, True))
indexes = {}
for idx in stst:
r = stst[idx]
if r['status'] == 'busy':
indexes[idx] = r['name']
node_state = dict((k, v['status']) for k, v in stst.iteritems())
else:
raise RuntimeError('The %s system implementation is not supported by cweb')
return system_type