本文整理汇总了Python中st2common.persistence.trigger.Trigger.update方法的典型用法代码示例。如果您正苦于以下问题:Python Trigger.update方法的具体用法?Python Trigger.update怎么用?Python Trigger.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类st2common.persistence.trigger.Trigger
的用法示例。
在下文中一共展示了Trigger.update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cleanup_trigger_db_for_rule
# 需要导入模块: from st2common.persistence.trigger import Trigger [as 别名]
# 或者: from st2common.persistence.trigger.Trigger import update [as 别名]
def cleanup_trigger_db_for_rule(rule_db):
# rule.trigger is actually trigger_db ref.
existing_trigger_db = get_trigger_db_by_ref(rule_db.trigger)
if not existing_trigger_db or not existing_trigger_db.parameters:
# nothing to be done here so moving on.
LOG.debug('ref_count decrement for %s not required.', existing_trigger_db)
return
Trigger.update(existing_trigger_db, dec__ref_count=1)
Trigger.delete_if_unreferenced(existing_trigger_db)
示例2: increment_trigger_ref_count
# 需要导入模块: from st2common.persistence.trigger import Trigger [as 别名]
# 或者: from st2common.persistence.trigger.Trigger import update [as 别名]
def increment_trigger_ref_count(rule_api):
"""
Given the rule figures out the TriggerType with parameter and increments
reference count on the appropriate Trigger.
:param rule_api: Rule object used to infer the Trigger.
:type rule_api: ``RuleApi``
"""
trigger_dict = _get_trigger_dict_given_rule(rule_api)
# Special reference counting for trigger with parameters.
if trigger_dict.get('parameters', None):
trigger_db = _get_trigger_db(trigger_dict)
Trigger.update(trigger_db, inc__ref_count=1)