本文整理汇总了Python中pyon.ion.event.EventSubscriber.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python EventSubscriber.__init__方法的具体用法?Python EventSubscriber.__init__怎么用?Python EventSubscriber.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyon.ion.event.EventSubscriber
的用法示例。
在下文中一共展示了EventSubscriber.__init__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyon.ion.event import EventSubscriber [as 别名]
# 或者: from pyon.ion.event.EventSubscriber import __init__ [as 别名]
def __init__(self, read_process_fn=None, process_id='', desired_state=None, *args, **kwargs):
if not process_id:
raise BadRequest("ProcessStateGate trying to wait on invalid process (id = '%s')" % process_id)
EventSubscriber.__init__(self, *args,
callback=self.trigger_cb,
event_type="ProcessLifecycleEvent",
origin=process_id,
origin_type="DispatchedProcess",
**kwargs)
self.desired_state = desired_state
self.process_id = process_id
self.read_process_fn = read_process_fn
self.last_chance = None
self.first_chance = None
_ = ProcessStateEnum._str_map[self.desired_state] # make sure state exists
log.info("ProcessStateGate is going to wait on process '%s' for state '%s'",
self.process_id,
ProcessStateEnum._str_map[self.desired_state])