本文整理汇总了Python中sandesh_http.SandeshHttp.create_http_response方法的典型用法代码示例。如果您正苦于以下问题:Python SandeshHttp.create_http_response方法的具体用法?Python SandeshHttp.create_http_response怎么用?Python SandeshHttp.create_http_response使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sandesh_http.SandeshHttp
的用法示例。
在下文中一共展示了SandeshHttp.create_http_response方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send
# 需要导入模块: from sandesh_http import SandeshHttp [as 别名]
# 或者: from sandesh_http.SandeshHttp import create_http_response [as 别名]
def send(self, isseq=False, seqno=0, context='',
more=False, sandesh=sandesh_global):
try:
self.validate()
except e:
sandesh._logger.error('sandesh "%s" validation failed [%s]' %
(self.__class__.__name__, e))
return -1
if isseq is True:
self._seqnum = seqno
else:
uve_type_map = sandesh._uve_type_maps.get_uve_type_map(
self.__class__.__name__)
if uve_type_map is None:
return -1
self._seqnum = self.next_seqnum()
uve_type_map.update_uve(self)
self._context = context
self._more = more
if self._context.find('http://') == 0:
SandeshHttp.create_http_response(self, sandesh)
else:
if self.handle_test(sandesh):
return 0
if sandesh._client:
sandesh._client.send_uve_sandesh(self)
else:
sandesh._logger.debug(self.log())
return 0
示例2: send
# 需要导入模块: from sandesh_http import SandeshHttp [as 别名]
# 或者: from sandesh_http.SandeshHttp import create_http_response [as 别名]
def send(self, isseq=False, seqno=0, context='',
more=False, sandesh=sandesh_global,
level=SandeshLevel.SYS_NOTICE):
try:
self.validate()
except e:
sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed)
return -1
if self._type == SandeshType.UVE and \
self._level == SandeshLevel.INVALID:
self._level = level
if isseq is True:
self._seqnum = seqno
self._hints |= SANDESH_SYNC_HINT
else:
uve_type_map = sandesh._uve_type_maps.get_uve_type_map(
self.__class__.__name__)
if uve_type_map is None:
sandesh._logger.error('sandesh uve <%s> not registered %s'\
% (self.__class__.__name__, str(sandesh._uve_type_maps._uve_global_map)))
sandesh.drop_tx_sandesh(self,
SandeshTxDropReason.ValidationFailed)
return -1
self._seqnum = self.next_seqnum()
if not uve_type_map.update_uve(self):
sandesh._logger.error('Failed to update sandesh in cache')
sandesh.drop_tx_sandesh(self,
SandeshTxDropReason.ValidationFailed)
return -1
self._context = context
self._more = more
if self._context.find('http://') == 0 or \
self._context.find('https://') == 0:
SandeshHttp.create_http_response(self, sandesh)
else:
if self.handle_test(sandesh):
return 0
if sandesh._client:
if sandesh.is_sending_all_messages_disabled():
sandesh.drop_tx_sandesh(self,
SandeshTxDropReason.SendingDisabled, self.level())
return -1
# SandeshUVE has an implicit send level of SandeshLevel.SYS_UVE
# which is irrespective of the level set by the user in the
# send. This is needed so that the send queue does not grow
# unbounded. Once the send queue's sending level reaches
# SandeshLevel.SYS_UVE we will reset the connection to the
# collector to initiate resync of the UVE cache
if SandeshLevel.SYS_UVE >= sandesh.send_level():
sandesh._client.close_sm_session()
sandesh._client.send_uve_sandesh(self)
else:
sandesh._logger.debug(self.log())
return 0
示例3: send_trace
# 需要导入模块: from sandesh_http import SandeshHttp [as 别名]
# 或者: from sandesh_http.SandeshHttp import create_http_response [as 别名]
def send_trace(self, context='', more=False,
sandesh=sandesh_global):
try:
self.validate()
except e:
sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed)
return -1
self._context = context
self._more = more
if self._context.find('http://') == 0:
SandeshHttp.create_http_response(self, sandesh)
else:
if self.handle_test(sandesh):
return 0
sandesh.send_sandesh(self)
return 0
示例4: send_trace
# 需要导入模块: from sandesh_http import SandeshHttp [as 别名]
# 或者: from sandesh_http.SandeshHttp import create_http_response [as 别名]
def send_trace(self, context='', more=False,
sandesh=sandesh_global):
try:
self.validate()
except e:
sandesh._logger.error('sandesh "%s" validation failed [%s]' %
(self.__class__.__name__, e))
return -1
self._context = context
self._more = more
if self._context.find('http://') == 0:
SandeshHttp.create_http_response(self, sandesh)
else:
if self.handle_test(sandesh):
return 0
sandesh.send_sandesh(self)
return 0
示例5: send
# 需要导入模块: from sandesh_http import SandeshHttp [as 别名]
# 或者: from sandesh_http.SandeshHttp import create_http_response [as 别名]
def send(self, isseq=False, seqno=0, context='',
more=False, sandesh=sandesh_global):
try:
self.validate()
except e:
sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed)
return -1
if isseq is True:
self._seqnum = seqno
self._hints |= SANDESH_SYNC_HINT
else:
uve_type_map = sandesh._uve_type_maps.get_uve_type_map(
self.__class__.__name__)
if uve_type_map is None:
sandesh._logger.error('sandesh uve <%s> not registered %s'\
% (self.__class__.__name__, str(sandesh._uve_type_maps._uve_global_map)))
sandesh.drop_tx_sandesh(self,
SandeshTxDropReason.ValidationFailed)
return -1
self._seqnum = self.next_seqnum()
if not uve_type_map.update_uve(self):
sandesh._logger.error('Failed to update sandesh in cache')
sandesh.drop_tx_sandesh(self,
SandeshTxDropReason.ValidationFailed)
return -1
self._context = context
self._more = more
if self._context.find('http://') == 0:
SandeshHttp.create_http_response(self, sandesh)
else:
if self.handle_test(sandesh):
return 0
if sandesh._client:
sandesh._client.send_uve_sandesh(self)
else:
sandesh._logger.debug(self.log())
return 0