本文整理汇总了Python中pyasm.command.Trigger.append_static_trigger方法的典型用法代码示例。如果您正苦于以下问题:Python Trigger.append_static_trigger方法的具体用法?Python Trigger.append_static_trigger怎么用?Python Trigger.append_static_trigger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.command.Trigger
的用法示例。
在下文中一共展示了Trigger.append_static_trigger方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add
# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import append_static_trigger [as 别名]
def add(key, cache):
CACHE[key] = cache
# when adding a new event, register its events
events = cache.get_refresh_events()
from pyasm.command import Trigger
for event in events:
#print "registering: ", event
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", "pyasm.command.SearchTypeCacheTrigger")
Trigger.append_static_trigger(trigger)
示例2: __init__
# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import append_static_trigger [as 别名]
def __init__(self, **kwargs):
super(TransactionQueueManager, self).__init__(**kwargs)
trigger = TransactionQueueServersTrigger()
trigger.execute()
self.servers = Container.get("TransactionQueueServers")
# add a static trigger
event = "change|sthpw/sync_server"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", "tactic.command.TransactionQueueServersTrigger")
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=True)
示例3: add_static_triggers
# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import append_static_trigger [as 别名]
def add_static_triggers(cls):
# event sthpw/trigger
from pyasm.command import Trigger
event = "change|sthpw/task"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
#trigger.set_value("mode", "same process,same transaction")
trigger.set_value("class_name", "tactic.command.RelatedTaskUpdateTrigger")
Trigger.append_static_trigger(trigger)
event = "change|sthpw/task|status"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
#trigger.set_value("mode", "same process,same transaction")
trigger.set_value("class_name", "tactic.command.TaskCompleteTrigger")
Trigger.append_static_trigger(trigger)
示例4: __init__
# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import append_static_trigger [as 别名]
def __init__(my):
my.job = None
my.jobs = []
my.check_interval = 1
my.max_jobs = 2
trigger = TransactionQueueServersTrigger()
trigger.execute()
my.servers = Container.get("TransactionQueueServers")
# add a static trigger
event = "change|sthpw/sync_server"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", "tactic.command.TransactionQueueServersTrigger")
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=True)
super(TransactionQueueManager, my).__init__()
示例5: execute
# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import append_static_trigger [as 别名]
def execute(self):
# get the cache list
login_cache = Cache.get("logins")
logins = login_cache.get_attr("logins")
print logins
# in memory triggers?
events = login_cache.get_events()
for event in events:
trigger_sobj = SearchType.create("sthpw/trigger")
trigger_sobj.set_value("event", event)
trigger_sobj.set_value("class_name", "pyasm.search.cache.CacheTrigger")
Trigger.append_static_trigger(trigger_sobj)
login = logins[0]
print "email [%s]" % login.get_value("email")
login.set_value("email", "[email protected]")
print "email [%s]" % login.get_value("email")
login.commit()
示例6: execute
# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import append_static_trigger [as 别名]
def execute(my):
event = "change|config/widget_config"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", "pyasm.web.web_init.SidebarTrigger")
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=True)
event = "change|sthpw/schema"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", "pyasm.web.web_init.SidebarTrigger")
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=True)
# when the palette column of the project changes
event = "change|sthpw/project|palette"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", "pyasm.web.web_init.SidebarTrigger")
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=True)
# when the palette column of the project changes
event = "change|sthpw/pref_setting"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", "pyasm.web.web_init.SidebarTrigger")
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=True)
event = "change|sthpw/login_in_group"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", "pyasm.web.web_init.SidebarTrigger")
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=True)
event = "change|sthpw/login_group"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", "pyasm.web.web_init.SidebarTrigger")
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=True)
# FIXME: should this really be a web_init trigger. This needs
# to be run even from batch commands
event = "change|sthpw/task|status"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", "pyasm.web.web_init.StatusLogTrigger")
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=True)
event = "insert|sthpw/login"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", "pyasm.web.web_init.DisplayNameTrigger")
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=True)
#from tactic.command.queue import JobTask
#JobTask.start()
from pyasm.biz import Snapshot
Snapshot.add_integral_trigger()
示例7: init
# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import append_static_trigger [as 别名]
def init(my, startup=False):
#workflow = Config.get_value("services", "workflow")
#if workflow not in [True, 'true']:
# return
print "Starting Workflow Engine"
# initialize the triggers for the workflow
event = "process|pending"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", ProcessPendingTrigger)
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=startup)
event = "process|action"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", ProcessActionTrigger)
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=startup)
event = "process|complete"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", ProcessCompleteTrigger)
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=startup)
event = "process|approve"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", ProcessApproveTrigger)
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=startup)
event = "process|revise"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", ProcessReviseTrigger)
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=startup)
event = "process|error"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", ProcessErrorTrigger)
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=startup)
# by default a stataus change to a trigger calls the node's trigger
event = "change|sthpw/task|status"
trigger = SearchType.create("sthpw/trigger")
trigger.set_value("event", event)
trigger.set_value("class_name", TaskStatusChangeTrigger)
trigger.set_value("mode", "same process,same transaction")
Trigger.append_static_trigger(trigger, startup=startup)