本文整理汇总了Python中job.Job.notify方法的典型用法代码示例。如果您正苦于以下问题:Python Job.notify方法的具体用法?Python Job.notify怎么用?Python Job.notify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类job.Job
的用法示例。
在下文中一共展示了Job.notify方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: notify
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import notify [as 别名]
def notify(self, evt):
Job.notify(self, evt)
log.debug("Notified of event: %s" % str(evt.__class__))
if isinstance(evt, simple.ConnectCompleteEvent) and \
evt.getSource() == self.connect_job:
self.conn = evt.getConnection()
self.run()
elif isinstance(evt, simple.ConnectFailedEvent) and \
evt.getSource() == self.connect_job:
log.error("Failed to connect to agent")
print "Failed to connect to agent"
self.getAgent().setState(agent.STOPPING)
elif isinstance(evt, agent.MessageReceivedEvent) and \
isinstance(evt.getMessage(), message.Response):
if isinstance(evt.getMessage(), agent.OkResponse) and \
self.key == evt.getMessage().getRequestKey():
print "Shutdown Acknowledged"
self.getAgent().setState(agent.STOPPING)
elif isinstance(evt.getMessage(), agent.DeniedResponse) and \
self.key == evt.getMessage().getRequestKey():
print "Shutdown Denied"
self.getAgent().setState(agent.STOPPING)
示例2: notify
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import notify [as 别名]
def notify(self, evt):
Job.notify(self, evt)
if isinstance(evt, simple.ConnectCompleteEvent):
self.conn = evt.getConnection()
self.run()
elif isinstance(evt, agent.MessageReceivedEvent):
if isinstance(evt.getMessage(), simple.StatusResponse) and \
self.key == evt.getMessage().getRequestKey():
print "Status Acknowledged"
print str(evt.getMessage())
self.getAgent().setState(agent.STOPPING)
if isinstance(evt.getMessage(), agent.DeniedResponse) and \
self.key == evt.getMessage().getRequestKey():
print "Status Denied"
self.getAgent().setState(agent.STOPPING)