本文整理汇总了Python中pyon.util.containers.DotDict.platform_device_id方法的典型用法代码示例。如果您正苦于以下问题:Python DotDict.platform_device_id方法的具体用法?Python DotDict.platform_device_id怎么用?Python DotDict.platform_device_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyon.util.containers.DotDict
的用法示例。
在下文中一共展示了DotDict.platform_device_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _make_associations
# 需要导入模块: from pyon.util.containers import DotDict [as 别名]
# 或者: from pyon.util.containers.DotDict import platform_device_id [as 别名]
def _make_associations(self):
"""
create one of each resource and association used by OMS
to guard against problems in ion-definitions
"""
#raise unittest.SkipTest("https://jira.oceanobservatories.org/tasks/browse/CISWCORE-41")
"""
the tree we're creating (observatory, sites, platforms, instruments)
rows are lettered, colums numbered.
- first row is implied a
- first column is implied 1
- site Z, just because
O--Sz
|
S--S2--P3--I4
|
Sb-Pb2-Ib3
|
P--I2 <- PlatformDevice, InstrumentDevice2
|
Pb <- PlatformDevice b
|
I <- InstrumentDevice
"""
org_id = self.OMS.create_marine_facility(any_old(RT.Org))
def create_under_org(resource_type, extra_fields=None):
obj = any_old(resource_type, extra_fields)
if RT.InstrumentDevice == resource_type:
resource_id = self.IMS.create_instrument_device(obj)
else:
resource_id, _ = self.RR.create(obj)
self.OMS.assign_resource_to_observatory_org(resource_id=resource_id, org_id=org_id)
return resource_id
#stuff we control
observatory_id = create_under_org(RT.Observatory)
subsite_id = create_under_org(RT.Subsite)
subsite2_id = create_under_org(RT.Subsite)
subsiteb_id = create_under_org(RT.Subsite)
subsitez_id = create_under_org(RT.Subsite)
platform_site_id = create_under_org(RT.PlatformSite)
platform_siteb_id = create_under_org(RT.PlatformSite)
platform_siteb2_id = create_under_org(RT.PlatformSite)
platform_site3_id = create_under_org(RT.PlatformSite)
instrument_site_id = create_under_org(RT.InstrumentSite)
instrument_site2_id = create_under_org(RT.InstrumentSite)
instrument_siteb3_id = create_under_org(RT.InstrumentSite)
instrument_site4_id = create_under_org(RT.InstrumentSite)
#stuff we associate to
instrument_device_id = create_under_org(RT.InstrumentDevice)
instrument_device2_id = create_under_org(RT.InstrumentDevice)
platform_device_id = create_under_org(RT.PlatformDevice)
platform_deviceb_id = create_under_org(RT.PlatformDevice)
instrument_model_id, _ = self.RR.create(any_old(RT.InstrumentModel))
platform_model_id, _ = self.RR.create(any_old(RT.PlatformModel))
deployment_id, _ = self.RR.create(any_old(RT.Deployment))
#observatory
self.RR.create_association(observatory_id, PRED.hasSite, subsite_id)
self.RR.create_association(observatory_id, PRED.hasSite, subsitez_id)
#site
self.RR.create_association(subsite_id, PRED.hasSite, subsite2_id)
self.RR.create_association(subsite_id, PRED.hasSite, subsiteb_id)
self.RR.create_association(subsite2_id, PRED.hasSite, platform_site3_id)
self.RR.create_association(subsiteb_id, PRED.hasSite, platform_siteb2_id)
self.RR.create_association(subsiteb_id, PRED.hasSite, platform_site_id)
#platform_site(s)
self.RR.create_association(platform_site3_id, PRED.hasSite, instrument_site4_id)
self.RR.create_association(platform_siteb2_id, PRED.hasSite, instrument_siteb3_id)
self.RR.create_association(platform_site_id, PRED.hasSite, instrument_site2_id)
self.RR.create_association(platform_site_id, PRED.hasSite, platform_siteb_id)
self.RR.create_association(platform_siteb_id, PRED.hasSite, instrument_site_id)
self.RR.create_association(platform_siteb_id, PRED.hasDevice, platform_deviceb_id)
#test network parent link
self.OMS.assign_device_to_network_parent(platform_device_id, platform_deviceb_id)
self.RR.create_association(platform_site_id, PRED.hasModel, platform_model_id)
self.RR.create_association(platform_site_id, PRED.hasDevice, platform_device_id)
self.RR.create_association(platform_site_id, PRED.hasDeployment, deployment_id)
#instrument_site(s)
self.RR.create_association(instrument_site_id, PRED.hasModel, instrument_model_id)
self.RR.create_association(instrument_site_id, PRED.hasDevice, instrument_device_id)
self.RR.create_association(instrument_site_id, PRED.hasDeployment, deployment_id)
self.RR.create_association(instrument_site2_id, PRED.hasDevice, instrument_device2_id)
#.........这里部分代码省略.........
示例2: _create_platform_configuration
# 需要导入模块: from pyon.util.containers import DotDict [as 别名]
# 或者: from pyon.util.containers.DotDict import platform_device_id [as 别名]
def _create_platform_configuration(self, platform_id, parent_platform_id=None):
"""
This method is an adaptation of test_agent_instance_config in
test_instrument_management_service_integration.py
@param platform_id
@param parent_platform_id
@return a DotDict with various of the constructed elements associated
to the platform.
"""
tdom, sdom = time_series_domain()
sdom = sdom.dump()
tdom = tdom.dump()
#
# TODO will each platform have its own param dictionary?
#
param_dict_name = 'platform_eng_parsed'
parsed_rpdict_id = self.DSC.read_parameter_dictionary_by_name(
param_dict_name,
id_only=True)
self.parsed_stream_def_id = self.PSC.create_stream_definition(
name='parsed',
parameter_dictionary_id=parsed_rpdict_id)
def _make_platform_agent_structure(agent_config=None):
if None is agent_config: agent_config = {}
driver_config = copy.deepcopy(DVR_CONFIG)
driver_config['attributes'] = self._platform_attributes[platform_id]
driver_config['ports'] = self._platform_ports[platform_id]
log.debug("driver_config: %s", driver_config)
# instance creation
platform_agent_instance_obj = any_old(RT.PlatformAgentInstance, {
'driver_config': driver_config})
platform_agent_instance_obj.agent_config = agent_config
platform_agent_instance_id = self.IMS.create_platform_agent_instance(platform_agent_instance_obj)
# agent creation
platform_agent_obj = any_old(RT.PlatformAgent, {
"stream_configurations": self._get_platform_stream_configs(),
'driver_module': DVR_MOD,
'driver_class': DVR_CLS})
platform_agent_id = self.IMS.create_platform_agent(platform_agent_obj)
# device creation
platform_device_id = self.IMS.create_platform_device(any_old(RT.PlatformDevice))
# data product creation
dp_obj = any_old(RT.DataProduct, {"temporal_domain":tdom, "spatial_domain": sdom})
dp_id = self.DP.create_data_product(data_product=dp_obj, stream_definition_id=self.parsed_stream_def_id)
self.DAMS.assign_data_product(input_resource_id=platform_device_id, data_product_id=dp_id)
self.DP.activate_data_product_persistence(data_product_id=dp_id)
self.addCleanup(self.DP.delete_data_product, dp_id)
# assignments
self.RR2.assign_platform_agent_instance_to_platform_device_with_has_agent_instance(platform_agent_instance_id, platform_device_id)
self.RR2.assign_platform_agent_to_platform_agent_instance_with_has_agent_definition(platform_agent_id, platform_agent_instance_id)
self.RR2.assign_platform_device_to_org_with_has_resource(platform_agent_instance_id, self.org_id)
#######################################
# dataset
log.debug('data product = %s', dp_id)
stream_ids, _ = self.RR.find_objects(dp_id, PRED.hasStream, None, True)
log.debug('Data product stream_ids = %s', stream_ids)
stream_id = stream_ids[0]
# Retrieve the id of the OUTPUT stream from the out Data Product
dataset_ids, _ = self.RR.find_objects(dp_id, PRED.hasDataset, RT.Dataset, True)
log.debug('Data set for data_product_id1 = %s', dataset_ids[0])
#######################################
return platform_agent_instance_id, platform_agent_id, platform_device_id, stream_id
log.debug("Making the structure for a platform agent")
# TODO Note: the 'platform_config' entry is a mechanism that the
# platform agent expects to know the platform_id and parent_platform_id.
# Determine how to finally indicate this info.
platform_config = {
'platform_id': platform_id,
'parent_platform_id': parent_platform_id,
}
child_agent_config = {
'platform_config': platform_config
}
platform_agent_instance_child_id, _, platform_device_child_id, stream_id = \
_make_platform_agent_structure(child_agent_config)
platform_agent_instance_child_obj = self.RR2.read(platform_agent_instance_child_id)
self.platform_device_parent_id = platform_device_child_id
p_obj = DotDict()
p_obj.platform_id = platform_id
#.........这里部分代码省略.........