本文整理汇总了Python中ion.util.enhanced_resource_registry_client.EnhancedResourceRegistryClient.find_resources_by_name方法的典型用法代码示例。如果您正苦于以下问题:Python EnhancedResourceRegistryClient.find_resources_by_name方法的具体用法?Python EnhancedResourceRegistryClient.find_resources_by_name怎么用?Python EnhancedResourceRegistryClient.find_resources_by_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ion.util.enhanced_resource_registry_client.EnhancedResourceRegistryClient
的用法示例。
在下文中一共展示了EnhancedResourceRegistryClient.find_resources_by_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AgentConfigurationBuilder
# 需要导入模块: from ion.util.enhanced_resource_registry_client import EnhancedResourceRegistryClient [as 别名]
# 或者: from ion.util.enhanced_resource_registry_client.EnhancedResourceRegistryClient import find_resources_by_name [as 别名]
#.........这里部分代码省略.........
log.debug("_generate_org_governance_name for %s", self.agent_instance_obj.name)
log.debug("retrieve the Org governance name to which this agent instance belongs")
try:
org_obj = self.RR2.find_subject(RT.Org, PRED.hasResource, self.agent_instance_obj._id, id_only=False)
return org_obj.org_governance_name
except NotFound:
return ''
except:
raise
def _generate_device_type(self):
log.debug("_generate_device_type for %s", self.agent_instance_obj.name)
return type(self._get_device()).__name__
def _generate_driver_config(self):
log.debug("_generate_driver_config for %s", self.agent_instance_obj.name)
# get default config
driver_config = self.agent_instance_obj.driver_config
agent_obj = self._get_agent()
# Create driver config.
add_driver_config = {
'workdir' : tempfile.gettempdir(),
'dvr_mod' : agent_obj.driver_module,
'dvr_cls' : agent_obj.driver_class
}
self._augment_dict("Agent driver_config", driver_config, add_driver_config)
return driver_config
def _get_param_dict_by_name(self, name):
dict_obj = self.RR2.find_resources_by_name(RT.ParameterDictionary, name)[0]
parameter_contexts = \
self.RR2.find_parameter_contexts_of_parameter_dictionary_using_has_parameter_context(dict_obj._id)
return DatasetManagementService.build_parameter_dictionary(dict_obj, parameter_contexts)
def _find_streamdef_for_dp_and_pdict(self, dp_id, pdict_id):
# Given a pdict_id and a data_product_id find the stream def in the middle
pdict_stream_defs = self.RR2.find_stream_definition_ids_by_parameter_dictionary_using_has_parameter_dictionary(pdict_id)
stream_def_id = self.RR2.find_stream_definition_id_of_data_product_using_has_stream_definition(dp_id)
result = stream_def_id if stream_def_id in pdict_stream_defs else None
return result
def _generate_stream_config(self):
log.debug("_generate_stream_config for %s", self.agent_instance_obj.name)
dsm = self.clients.dataset_management
psm = self.clients.pubsub_management
agent_obj = self._get_agent()
device_obj = self._get_device()
streams_dict = {}
for stream_cfg in agent_obj.stream_configurations:
#create a stream def for each param dict to match against the existing data products
streams_dict[stream_cfg.stream_name] = {'param_dict_name':stream_cfg.parameter_dictionary_name}
#retrieve the output products
# TODO: What about platforms? other things?
device_id = device_obj._id
data_product_objs = self.RR2.find_data_products_of_instrument_device_using_has_output_product(device_id)
stream_config = {}
示例2: AgentConfigurationBuilder
# 需要导入模块: from ion.util.enhanced_resource_registry_client import EnhancedResourceRegistryClient [as 别名]
# 或者: from ion.util.enhanced_resource_registry_client.EnhancedResourceRegistryClient import find_resources_by_name [as 别名]
#.........这里部分代码省略.........
log.debug("_generate_org_governance_name for %s", self.agent_instance_obj.name)
log.debug("retrieve the Org governance name to which this agent instance belongs")
try:
org_obj = self.RR2.find_subject(RT.Org, PRED.hasResource, self.agent_instance_obj._id, id_only=False)
return org_obj.org_governance_name
except NotFound:
return ''
except:
raise
def _generate_device_type(self):
log.debug("_generate_device_type for %s", self.agent_instance_obj.name)
return type(self._get_device()).__name__
def _generate_driver_config(self):
log.debug("_generate_driver_config for %s", self.agent_instance_obj.name)
# get default config
driver_config = self.agent_instance_obj.driver_config
agent_obj = self._get_agent()
# Create driver config.
add_driver_config = {
'workdir' : tempfile.gettempdir(),
'dvr_mod' : agent_obj.driver_module,
'dvr_cls' : agent_obj.driver_class
}
self._augment_dict("Agent driver_config", driver_config, add_driver_config)
return driver_config
def _get_param_dict_by_name(self, name):
dict_obj = self.RR2.find_resources_by_name(RT.ParameterDictionary, name)[0]
parameter_contexts = \
self.RR2.find_parameter_contexts_of_parameter_dictionary_using_has_parameter_context(dict_obj._id)
return DatasetManagementService.build_parameter_dictionary(dict_obj, parameter_contexts)
def _meet_in_the_middle(self,dp_id, pdict_id):
# Given a pdict_id and a data_product_id find the stream def in the middle
pdict_stream_defs = self.RR2.find_stream_definition_ids_by_parameter_dictionary_using_has_parameter_dictionary(pdict_id)
stream_def_id = self.RR2.find_stream_definition_id_of_data_product_using_has_stream_definition(dp_id)
result = stream_def_id if stream_def_id in pdict_stream_defs else None
return result
def _generate_stream_config(self):
log.debug("_generate_stream_config for %s", self.agent_instance_obj.name)
dsm = self.clients.dataset_management
psm = self.clients.pubsub_management
agent_obj = self._get_agent()
device_obj = self._get_device()
streams_dict = {}
for stream_cfg in agent_obj.stream_configurations:
#create a stream def for each param dict to match against the existing data products
streams_dict[stream_cfg.stream_name] = {'param_dict_name':stream_cfg.parameter_dictionary_name,
#'stream_def_id':stream_def_id,
'records_per_granule': stream_cfg.records_per_granule,
'granule_publish_rate':stream_cfg.granule_publish_rate,
}
#retrieve the output products
device_id = device_obj._id
data_product_objs = self.RR2.find_data_products_of_instrument_device_using_has_output_product(device_id)