本文整理汇总了Python中pyon.public.log.trace函数的典型用法代码示例。如果您正苦于以下问题:Python trace函数的具体用法?Python trace怎么用?Python trace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了trace函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _handler_connected_set_over_current
def _handler_connected_set_over_current(self, *args, **kwargs):
"""
"""
if log.isEnabledFor(logging.TRACE): # pragma: no cover
log.trace("%r/%s args=%s kwargs=%s" % (
self._platform_id, self.get_driver_state(),
str(args), str(kwargs)))
port_id = kwargs.get('port_id', None)
if port_id is None:
raise FSMError('set_over_current: missing port_id argument')
ma = kwargs.get('ma', None)
if ma is None:
raise FSMError('set_over_current: missing ma argument')
us = kwargs.get('us', None)
if us is None:
raise FSMError('set_over_current: missing us argument')
# TODO: provide source info if not explicitly given:
src = kwargs.get('src', 'source TBD')
try:
result = self.set_over_current(port_id, ma, us, src)
return None, result
except PlatformConnectionException as e:
return self._connection_lost(RSNPlatformDriverEvent.TURN_OFF_PORT,
args, kwargs, e)
开发者ID:kehunt06,项目名称:mi-instrument,代码行数:28,代码来源:driver.py
示例2: _handler_connected_connect_instrument
def _handler_connected_connect_instrument(self, *args, **kwargs):
"""
"""
if log.isEnabledFor(logging.TRACE): # pragma: no cover
log.trace("%r/%s args=%s kwargs=%s" % (
self._platform_id, self.get_driver_state(),
str(args), str(kwargs)))
port_id = kwargs.get('port_id', None)
if port_id is None:
raise FSMError('connect_instrument: missing port_id argument')
instrument_id = kwargs.get('instrument_id', None)
if instrument_id is None:
raise FSMError('connect_instrument: missing instrument_id argument')
attributes = kwargs.get('attributes', None)
if attributes is None:
raise FSMError('connect_instrument: missing attributes argument')
try:
result = self.connect_instrument(port_id, instrument_id, attributes)
return None, result
except PlatformConnectionException as e:
return self._connection_lost(RSNPlatformDriverEvent.CONNECT_INSTRUMENT,
args, kwargs, e)
开发者ID:jdosher,项目名称:coi-services,代码行数:27,代码来源:rsn_platform_driver.py
示例3: _update_dsa_config
def _update_dsa_config(self, dsa_instance):
"""
Update the dsa configuration prior to loading the agent. This is where we can
alter production configurations for use in a controlled test environment.
"""
rr = self.container.resource_registry
dsa_obj = rr.read_object(
object_type=RT.ExternalDatasetAgent, predicate=PRED.hasAgentDefinition, subject=dsa_instance._id, id_only=False)
log.info("dsa agent found: %s", dsa_obj)
# If we don't want to load from an egg then we need to
# alter the driver config read from preload
if self.test_config.mi_repo is not None:
dsa_obj.driver_uri = None
# Strip the custom namespace
dsa_obj.driver_module = ".".join(dsa_obj.driver_module.split('.')[1:])
log.info("saving new dsa agent config: %s", dsa_obj)
rr.update(dsa_obj)
if not self.test_config.mi_repo in sys.path: sys.path.insert(0, self.test_config.mi_repo)
log.debug("Driver module: %s", dsa_obj.driver_module)
log.debug("MI Repo: %s", self.test_config.mi_repo)
log.trace("Sys Path: %s", sys.path)
开发者ID:edwardhunter,项目名称:coi-services,代码行数:27,代码来源:dataset_test.py
示例4: _start_dataset_agent_process
def _start_dataset_agent_process(self):
# Create agent config.
name = self.test_config.instrument_device_name
rr = self.container.resource_registry
log.debug("Start dataset agent process for instrument device: %s", name)
objects,_ = rr.find_resources(RT.InstrumentDevice)
log.debug("Found Instrument Devices: %s", objects)
filtered_objs = [obj for obj in objects if obj.name == name]
if (filtered_objs) == []:
raise ConfigNotFound("No appropriate InstrumentDevice objects loaded")
instrument_device = filtered_objs[0]
log.trace("Found instrument device: %s", instrument_device)
dsa_instance = rr.read_object(subject=instrument_device._id,
predicate=PRED.hasAgentInstance,
object_type=RT.ExternalDatasetAgentInstance)
log.debug("dsa_instance found: %s", dsa_instance)
self._driver_config = dsa_instance.driver_config
self.clear_sample_data()
self.damsclient = DataAcquisitionManagementServiceClient(node=self.container.node)
proc_id = self.damsclient.start_external_dataset_agent_instance(dsa_instance._id)
client = ResourceAgentClient(instrument_device._id, process=FakeProcess())
return client
开发者ID:ateranishi,项目名称:coi-services,代码行数:30,代码来源:dataset_test.py
示例5: _get_dsa_instance
def _get_dsa_instance(self):
"""
Find the dsa instance in preload and return an instance of that object
:return:
"""
name = self.test_config.instrument_device_name
rr = self.container.resource_registry
log.debug("Start dataset agent process for instrument device: %s", name)
objects,_ = rr.find_resources(RT.InstrumentDevice)
log.debug("Found Instrument Devices: %s", objects)
filtered_objs = [obj for obj in objects if obj.name == name]
if (filtered_objs) == []:
raise ConfigNotFound("No appropriate InstrumentDevice objects loaded")
instrument_device = filtered_objs[0]
log.trace("Found instrument device: %s", instrument_device)
dsa_instance = rr.read_object(subject=instrument_device._id,
predicate=PRED.hasAgentInstance,
object_type=RT.ExternalDatasetAgentInstance)
log.info("dsa_instance found: %s", dsa_instance)
return (instrument_device, dsa_instance)
开发者ID:edwardhunter,项目名称:coi-services,代码行数:26,代码来源:dataset_test.py
示例6: recv_packet
def recv_packet(self, msg, stream_route, stream_id):
'''
The consumer callback to parse and manage the granule.
The message is ACK'd once the function returns
'''
log.trace('received granule for stream %s', stream_id)
if msg == {}:
log.error('Received empty message from stream: %s', stream_id)
return
# Message validation
if not isinstance(msg, Granule):
log.error('Ingestion received a message that is not a granule: %s', msg)
return
rdt = RecordDictionaryTool.load_from_granule(msg)
if rdt is None:
log.error('Invalid granule (no RDT) for stream %s', stream_id)
return
if not len(rdt):
log.debug('Empty granule for stream %s', stream_id)
return
self.persist_or_timeout(stream_id, rdt)
开发者ID:lukecampbell,项目名称:coi-services,代码行数:25,代码来源:science_granule_ingestion_worker.py
示例7: test_build_network_definition
def test_build_network_definition(self):
ndef = RsnOmsUtil.build_network_definition(self._rsn_oms)
if log.isEnabledFor(logging.TRACE):
# serialize object to string
serialization = NetworkUtil.serialize_network_definition(ndef)
log.trace("NetworkDefinition serialization:\n%s", serialization)
if not isinstance(self._rsn_oms, CIOMSSimulator):
# OK, no more tests if we are not using the embedded simulator
return
# Else: do some verifications against network.yml (the spec used by
# the simulator):
self.assertTrue("UPS" in ndef.platform_types)
pnode = ndef.root
self.assertEqual(pnode.platform_id, "ShoreStation")
self.assertTrue("ShoreStation_attr_1" in pnode.attrs)
self.assertTrue("ShoreStation_port_1" in pnode.ports)
sub_pnodes = pnode.subplatforms
self.assertTrue("L3-UPS1" in sub_pnodes)
self.assertTrue("Node1A" in sub_pnodes)
self.assertTrue("input_voltage" in sub_pnodes["Node1A"].attrs)
self.assertTrue("Node1A_port_1" in sub_pnodes["Node1A"].ports)
开发者ID:blazetopher,项目名称:coi-services,代码行数:28,代码来源:test_oms_util.py
示例8: setUp
def setUp(self):
self._start_container()
self.container.start_rel_from_url('res/deploy/r2deploy.yml')
self.RR = ResourceRegistryServiceClient(node=self.container.node)
self.IMS = InstrumentManagementServiceClient(node=self.container.node)
self.DAMS = DataAcquisitionManagementServiceClient(node=self.container.node)
self.DP = DataProductManagementServiceClient(node=self.container.node)
self.PSC = PubsubManagementServiceClient(node=self.container.node)
self.PDC = ProcessDispatcherServiceClient(node=self.container.node)
self.DSC = DatasetManagementServiceClient()
self.IDS = IdentityManagementServiceClient(node=self.container.node)
self.RR2 = EnhancedResourceRegistryClient(self.RR)
# Use the network definition provided by RSN OMS directly.
rsn_oms = CIOMSClientFactory.create_instance(DVR_CONFIG['oms_uri'])
self._network_definition = RsnOmsUtil.build_network_definition(rsn_oms)
# get serialized version for the configuration:
self._network_definition_ser = NetworkUtil.serialize_network_definition(self._network_definition)
if log.isEnabledFor(logging.TRACE):
log.trace("NetworkDefinition serialization:\n%s", self._network_definition_ser)
self._async_data_result = AsyncResult()
self._data_subscribers = []
self._samples_received = []
self.addCleanup(self._stop_data_subscribers)
self._async_event_result = AsyncResult()
self._event_subscribers = []
self._events_received = []
self.addCleanup(self._stop_event_subscribers)
self._start_event_subscriber()
开发者ID:newbrough,项目名称:coi-services,代码行数:35,代码来源:test_platform_launch.py
示例9: _get_dsa_client
def _get_dsa_client(self, instrument_device, dsa_instance):
"""
Launch the agent and return a client
"""
fake_process = FakeProcess()
fake_process.container = self.container
clients = DataAcquisitionManagementServiceDependentClients(fake_process)
config_builder = ExternalDatasetAgentConfigurationBuilder(clients)
try:
config_builder.set_agent_instance_object(dsa_instance)
self.agent_config = config_builder.prepare()
log.trace("Using dataset agent configuration: %s", pprint.pformat(self.agent_config))
except Exception as e:
log.error('failed to launch: %s', e, exc_info=True)
raise ServerError('failed to launch')
dispatcher = ProcessDispatcherServiceClient()
launcher = AgentLauncher(dispatcher)
log.debug("Launching agent process!")
process_id = launcher.launch(self.agent_config, config_builder._get_process_definition()._id)
if not process_id:
raise ServerError("Launched external dataset agent instance but no process_id")
config_builder.record_launch_parameters(self.agent_config)
launcher.await_launch(10.0)
return ResourceAgentClient(instrument_device._id, process=FakeProcess())
开发者ID:edwardhunter,项目名称:coi-services,代码行数:30,代码来源:dataset_test.py
示例10: add_granule
def add_granule(self,stream_id, granule):
'''
Appends the granule's data to the coverage and persists it.
'''
#--------------------------------------------------------------------------------
# Coverage determiniation and appending
#--------------------------------------------------------------------------------
dataset_id = self.get_dataset(stream_id)
if not dataset_id:
log.error('No dataset could be determined on this stream: %s', stream_id)
return
coverage = self.get_coverage(stream_id)
if not coverage:
log.error('Could not persist coverage from granule, coverage is None')
return
#--------------------------------------------------------------------------------
# Actual persistence
#--------------------------------------------------------------------------------
rdt = RecordDictionaryTool.load_from_granule(granule)
elements = len(rdt)
if not elements:
return
coverage.insert_timesteps(elements)
start_index = coverage.num_timesteps - elements
for k,v in rdt.iteritems():
if k == 'image_obj':
log.trace( '%s:', k)
else:
log.trace( '%s: %s', k, v)
slice_ = slice(start_index, None)
coverage.set_parameter_values(param_name=k, tdoa=slice_, value=v)
coverage.flush()
开发者ID:tomoreilly,项目名称:coi-services,代码行数:34,代码来源:science_granule_ingestion_worker.py
示例11: _sendto
def _sendto(self, data):
if log.isEnabledFor(logging.DEBUG):
log.debug("calling sendto(%r)" % data)
nobytes = self._sock.sendto(data, self._address)
if log.isEnabledFor(logging.TRACE):
log.trace("sendto returned: %i" % nobytes)
return nobytes
开发者ID:blazetopher,项目名称:coi-services,代码行数:7,代码来源:cgsn_client.py
示例12: got_event
def got_event(evt, *args, **kwargs):
if not self._active:
log.warn("%r: got_event called but manager has been destroyed",
self._platform_id)
return
if evt.type_ != event_type:
log.trace("%r: ignoring event type %r. Only handle %r directly",
self._platform_id, evt.type_, event_type)
return
if evt.sub_type != sub_type:
log.trace("%r: ignoring event sub_type %r. Only handle %r",
self._platform_id, evt.sub_type, sub_type)
return
state = self._agent.get_agent_state()
statuses = formatted_statuses(self.aparam_aggstatus,
self.aparam_child_agg_status,
self.aparam_rollup_status)
invalidated_children = self._agent._get_invalidated_children()
log.info("%r/%s: (%s) status report triggered by diagnostic event:\n"
"%s\n"
"%40s : %s\n",
self._platform_id, state, self.resource_id, statuses,
"invalidated_children", invalidated_children)
开发者ID:ednad,项目名称:coi-services,代码行数:29,代码来源:status_manager.py
示例13: _handler_connected_turn_off_port
def _handler_connected_turn_off_port(self, *args, **kwargs):
"""
"""
if log.isEnabledFor(logging.TRACE): # pragma: no cover
log.trace("%r/%s args=%s kwargs=%s" % (
self._platform_id, self.get_driver_state(),
str(args), str(kwargs)))
port_id = kwargs.get('port_id', None)
if port_id is None:
raise FSMError('turn_off_port: missing port_id argument')
port_id = kwargs.get('port_id', None)
instrument_id = kwargs.get('instrument_id', None)
if port_id is None and instrument_id is None:
raise FSMError('turn_off_port: at least one of port_id and '
'instrument_id argument must be given')
try:
result = self.turn_off_port(port_id=port_id, instrument_id=instrument_id)
return None, result
except PlatformConnectionException as e:
return self._connection_lost(RSNPlatformDriverEvent.TURN_OFF_PORT,
args, kwargs, e)
开发者ID:wbollenbacher,项目名称:coi-services,代码行数:25,代码来源:rsn_platform_driver.py
示例14: __application
def __application(self, environ, start_response):
input = environ['wsgi.input']
body = "\n".join(input.readlines())
# log.trace('notification received payload=%s', body)
event_instance = yaml.load(body)
log.trace('notification received event_instance=%s', str(event_instance))
if not 'url' in event_instance:
log.warn("expecting 'url' entry in notification call")
return
if not 'ref_id' in event_instance:
log.warn("expecting 'ref_id' entry in notification call")
return
url = event_instance['url']
event_type = event_instance['ref_id']
if self._url == url:
self._event_received(event_type, event_instance)
else:
log.warn("got notification call with an unexpected url=%s (expected url=%s)",
url, self._url)
# generic OK response TODO determine appropriate variations
status = '200 OK'
headers = [('Content-Type', 'text/plain')]
start_response(status, headers)
return event_type
开发者ID:kerfoot,项目名称:coi-services,代码行数:28,代码来源:oms_event_listener.py
示例15: _parse_message
def _parse_message(self, recv_message):
log.trace("_parse_message: recv_message=%r", recv_message)
dst, src, msg_type, msg = basic_message_verification(recv_message)
#
# destination must be us, CIPOP:
#
if dst != CIPOP:
raise MalformedMessage(
"unexpected destination in received message: "
"%d (we are %d)" % (dst, CIPOP))
#
# verify message type:
# TODO how does this exactly work?
#
if msg_type != CICGINT:
MalformedMessage(
"unexpected msg_type in received message: "
"%d (should be %d)" % (msg_type, CICGINT))
#
# TODO verification of source.
# ...
return src, msg_type, msg
开发者ID:ednad,项目名称:coi-services,代码行数:27,代码来源:cgsn_client.py
示例16: _register_id
def _register_id(self, alias, resid, res_obj=None, is_update=False):
"""Keep preload resource in internal dict for later reference"""
if not is_update and alias in self.resource_ids:
raise BadRequest("ID alias %s used twice" % alias)
self.resource_ids[alias] = resid
self.resource_objs[alias] = res_obj
log.trace("Added resource alias=%s to id=%s", alias, resid)
开发者ID:crchemist,项目名称:scioncc,代码行数:7,代码来源:preload.py
示例17: handle_attribute_value_event
def handle_attribute_value_event(self, driver_event):
if log.isEnabledFor(logging.TRACE): # pragma: no cover
# show driver_event as retrieved (driver_event.vals_dict might be large)
log.trace("%r: driver_event = %s", self._platform_id, driver_event)
log.trace("%r: vals_dict:\n%s",
self._platform_id, self._pp.pformat(driver_event.vals_dict))
elif log.isEnabledFor(logging.DEBUG): # pragma: no cover
log.debug("%r: driver_event = %s", self._platform_id, driver_event.brief())
stream_name = driver_event.stream_name
publisher = self._data_publishers.get(stream_name, None)
if not publisher:
log.warn('%r: no publisher configured for stream_name=%r. '
'Configured streams are: %s',
self._platform_id, stream_name, self._data_publishers.keys())
return
param_dict = self._param_dicts[stream_name]
stream_def = self._stream_defs[stream_name]
if isinstance(stream_def, str):
rdt = RecordDictionaryTool(param_dictionary=param_dict.dump(),
stream_definition_id=stream_def)
else:
rdt = RecordDictionaryTool(stream_definition=stream_def)
self._publish_granule_with_multiple_params(publisher, driver_event,
param_dict, rdt)
开发者ID:edwardhunter,项目名称:coi-services,代码行数:30,代码来源:platform_agent_stream_publisher.py
示例18: set_ports
def set_ports(pnode):
platform_id = pnode.platform_id
port_infos = rsn_oms.get_platform_ports(platform_id)
if not isinstance(port_infos, dict):
log.warn("%r: get_platform_ports returned: %s",
platform_id, port_infos)
return
if log.isEnabledFor(logging.TRACE):
log.trace("%r: port_infos: %s", platform_id, port_infos)
assert platform_id in port_infos
ports = port_infos[platform_id]
for port_id, dic in ports.iteritems():
port = PortNode(port_id, dic['network'])
port.set_on(dic['is_on'])
pnode.add_port(port)
# add connected instruments:
instrs_res = rsn_oms.get_connected_instruments(platform_id, port_id)
if not isinstance(instrs_res, dict):
log.warn("%r: port_id=%r: get_connected_instruments "
"returned: %s" % (platform_id, port_id, instrs_res))
continue
if log.isEnabledFor(logging.TRACE):
log.trace("%r: port_id=%r: get_connected_instruments "
"returned: %s" % (platform_id, port_id, instrs_res))
assert platform_id in instrs_res
assert port_id in instrs_res[platform_id]
instr = instrs_res[platform_id][port_id]
for instrument_id, attrs in instr.iteritems():
port.add_instrument(InstrumentNode(instrument_id, attrs))
开发者ID:shenrie,项目名称:coi-services,代码行数:33,代码来源:oms_util.py
示例19: _construct_stream_and_publisher
def _construct_stream_and_publisher(self, stream_name, stream_config):
if log.isEnabledFor(logging.TRACE): # pragma: no cover
log.trace("%r: _construct_stream_and_publisher: "
"stream_name:%r, stream_config:\n%s",
self._platform_id, stream_name,
self._pp.pformat(stream_config))
decoder = IonObjectDeserializer(obj_registry=get_obj_registry())
if 'stream_def_dict' not in stream_config:
# should not happen: PlatformAgent._validate_configuration validates this.
log.error("'stream_def_dict' key not in configuration for stream %r" % stream_name)
return
stream_def_dict = stream_config['stream_def_dict']
stream_def_dict['type_'] = 'StreamDefinition'
stream_def_obj = decoder.deserialize(stream_def_dict)
self._stream_defs[stream_name] = stream_def_obj
routing_key = stream_config['routing_key']
stream_id = stream_config['stream_id']
exchange_point = stream_config['exchange_point']
parameter_dictionary = stream_def_dict['parameter_dictionary']
log.debug("%r: got parameter_dictionary from stream_def_dict", self._platform_id)
self._data_streams[stream_name] = stream_id
self._param_dicts[stream_name] = ParameterDictionary.load(parameter_dictionary)
stream_route = StreamRoute(exchange_point=exchange_point, routing_key=routing_key)
publisher = self._create_publisher(stream_id, stream_route)
self._data_publishers[stream_name] = publisher
log.debug("%r: created publisher for stream_name=%r", self._platform_id, stream_name)
开发者ID:edwardhunter,项目名称:coi-services,代码行数:33,代码来源:platform_agent_stream_publisher.py
示例20: _load_uri_aliases
def _load_uri_aliases(cls):
try:
cls._uri_aliases = yaml.load(file(_URI_ALIASES_FILENAME))
if log.isEnabledFor(logging.TRACE):
log.trace("Loaded CGSN URI aliases = %s" % cls._uri_aliases)
except Exception as e:
log.warn("Cannot loaded %s: %s" % (_URI_ALIASES_FILENAME, e))
cls._uri_aliases = {}
开发者ID:ednad,项目名称:coi-services,代码行数:8,代码来源:cgsn_client_factory.py
注:本文中的pyon.public.log.trace函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论