本文整理汇总了Python中buildbot.status.persistent_queue.IndexedQueue.pushItem方法的典型用法代码示例。如果您正苦于以下问题:Python IndexedQueue.pushItem方法的具体用法?Python IndexedQueue.pushItem怎么用?Python IndexedQueue.pushItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类buildbot.status.persistent_queue.IndexedQueue
的用法示例。
在下文中一共展示了IndexedQueue.pushItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: StatusPush
# 需要导入模块: from buildbot.status.persistent_queue import IndexedQueue [as 别名]
# 或者: from buildbot.status.persistent_queue.IndexedQueue import pushItem [as 别名]
#.........这里部分代码省略.........
if self.path and os.path.isdir(self.path):
state_path = os.path.join(self.path, 'state')
json.dump(self.state, open(state_path, 'w'), sort_keys=True,
indent=2)
# Make sure all Deferreds are called on time and in a sane order.
defers = filter(None, [d, StatusReceiverMultiService.stopService(self)])
return defer.DeferredList(defers)
def push(self, event, **objs):
"""Push a new event.
The new event will be either:
- Queued in memory to reduce network usage
- Queued to disk when the sink server is down
- Pushed (along the other queued items) to the server
"""
if self.blackList and event in self.blackList:
return
# First, generate the packet.
packet = {}
packet['id'] = self.state['next_id']
self.state['next_id'] += 1
packet['timestamp'] = str(datetime.datetime.utcnow())
packet['project'] = self.status.getTitle()
packet['started'] = self.state['started']
packet['event'] = event
packet['payload'] = {}
for obj_name, obj in objs.items():
if hasattr(obj, 'asDict'):
obj = obj.asDict()
if self.filter:
obj = FilterOut(obj)
packet['payload'][obj_name] = obj
self.queue.pushItem(packet)
if self.task is None or not self.task.active():
# No task queued since it was probably idle, let's queue a task.
return self.queueNextServerPush()
#### Events
def initialPush(self):
# Push everything we want to push from the initial configuration.
self.push('start', status=self.status)
def finalPush(self):
self.push('shutdown', status=self.status)
def requestSubmitted(self, request):
self.push('requestSubmitted', request=request)
def requestCancelled(self, builder, request):
self.push('requestCancelled', builder=builder, request=request)
def buildsetSubmitted(self, buildset):
self.push('buildsetSubmitted', buildset=buildset)
def builderAdded(self, builderName, builder):
self.push('builderAdded', builderName=builderName, builder=builder)
return self
def builderChangedState(self, builderName, state):
self.push('builderChangedState', builderName=builderName, state=state)
def buildStarted(self, builderName, build):
self.push('buildStarted', build=build)
return self