当前位置: 首页>>代码示例>>Python>>正文


Python ServerProxy.getMonitorData方法代码示例

本文整理汇总了Python中xmlrpclib.ServerProxy.getMonitorData方法的典型用法代码示例。如果您正苦于以下问题:Python ServerProxy.getMonitorData方法的具体用法?Python ServerProxy.getMonitorData怎么用?Python ServerProxy.getMonitorData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xmlrpclib.ServerProxy的用法示例。


在下文中一共展示了ServerProxy.getMonitorData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import getMonitorData [as 别名]

#.........这里部分代码省略.........
		try:
			msg = pickle.loads(self._agent.onPublisherCall(pickle.dumps(msg)))
		
		except:
			self.Reconnect()
			raise RedoTestException("Communication error with Agent %s" % self._name)
		
		if msg.type != _MsgType.Ack:
			raise PeachException("Lost connection to Agent %s during OnPublisherCall call." % self._name)
	
	def OnTestFinished(self):
		'''
		Called right after a test.
		'''
		msg = _Msg(self._id, _MsgType.OnTestFinished)
		
		try:
			msg = pickle.loads(self._agent.onTestFinished(pickle.dumps(msg)))
			
		except:
			self.Reconnect()
			raise RedoTestException("Communication error with Agent %s" % self._name)
		
		if msg.type != _MsgType.Ack:
			raise PeachException("Lost connection to Agent %s during OnTestFinished call." % self._name)
	
	def GetMonitorData(self):
		'''
		Get any monitored data.
		'''
		msg = _Msg(self._id, _MsgType.GetMonitorData)
		
		try:
			msg = pickle.loads(self._agent.getMonitorData(pickle.dumps(msg)))
			
		except:
			self.Reconnect()
			raise RedoTestException("Communication error with Agent %s" % self._name)
		
		if msg.type != _MsgType.Ack:
			raise PeachException("Lost connection to Agent %s during GetMonitorData call." % self._name)
		
		return msg.results
	
	def DetectedFault(self):
		'''
		Check if a fault was detected.
		'''
		try:
			msg = _Msg(self._id, _MsgType.DetectFault)
			msg = pickle.loads(self._agent.detectFault(pickle.dumps(msg)))
			
		except:
			self.Reconnect()
			raise RedoTestException("Communication error with Agent %s" % self._name)
		
		if msg.type != _MsgType.Ack:
			raise PeachException("Lost connection to Agent %s during GetMonitorData call." % self._name)
		
		return msg.results
	
	def OnFault(self):
		'''
		Called when a fault was detected.
		'''
		try:
开发者ID:flaub,项目名称:HotFuzz,代码行数:70,代码来源:agent.py

示例2: AgentClient

# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import getMonitorData [as 别名]

#.........这里部分代码省略.........

    def OnPublisherCall(self, method):
        Debug("> OnPublisherCall")
        msg = _Msg(self._id, _MsgType.PublisherCall)
        msg.method = method
        try:
            msg = pickle.loads(self._agent.onPublisherCall(pickle.dumps(msg)))
        except Exception as e:
            self.Reconnect()
            raise RedoTestException("Communication error with Agent %s" % self._name)
        if msg.type != _MsgType.Ack:
            raise PeachException("Lost connection to Agent %s during OnPublisherCall call." % self._name)
        Debug("< OnPublisherCall")
        return msg.results

    def OnTestFinished(self):
        """Called right after a test."""
        Debug("> OnTestFinished")
        msg = _Msg(self._id, _MsgType.OnTestFinished)
        try:
            msg = pickle.loads(self._agent.onTestFinished(pickle.dumps(msg)))
        except Exception as e:
            self.Reconnect()
            raise RedoTestException("Communication error with Agent %s" % self._name)
        if msg.type != _MsgType.Ack:
            raise PeachException("Lost connection to Agent %s during OnTestFinished call." % self._name)
        Debug("< OnTestFinished")

    def GetMonitorData(self):
        """Get any monitored data."""
        Debug("> GetMonitorData")
        msg = _Msg(self._id, _MsgType.GetMonitorData)
        try:
            msg = pickle.loads(self._agent.getMonitorData(pickle.dumps(msg)))
        except Exception as e:
            self.Reconnect()
            raise RedoTestException("Communication error with Agent %s" % self._name)
        if msg.type != _MsgType.Ack:
            raise PeachException("Lost connection to Agent %s during GetMonitorData call." % self._name)
        Debug("< GetMonitorData")
        return msg.results

    def RedoTest(self):
        """Should we repeat current test."""
        Debug("> RedoTest")
        try:
            msg = _Msg(self._id, _MsgType.RedoTest)
            msg = pickle.loads(self._agent.redoTest(pickle.dumps(msg)))
        except Exception as e:
            self.Reconnect()
            raise RedoTestException("Communication error with Agent %s" % self._name)
        if msg.type != _MsgType.Ack:
            raise PeachException("Lost connection to Agent %s during RedoTest call." % self._name)
        Debug("< RedoTest")

        return msg.results

    def DetectedFault(self):
        """Check if a fault was detected."""
        Debug("> DetectedFault")
        try:
            msg = _Msg(self._id, _MsgType.DetectFault)
            msg = pickle.loads(self._agent.detectFault(pickle.dumps(msg)))
        except Exception as e:
            self.Reconnect()
            raise RedoTestException("Communication error with Agent %s" % self._name)
开发者ID:KurSh,项目名称:peach,代码行数:70,代码来源:agent.py


注:本文中的xmlrpclib.ServerProxy.getMonitorData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。