本文整理汇总了Python中st2common.persistence.trigger.TriggerInstance.get_all方法的典型用法代码示例。如果您正苦于以下问题:Python TriggerInstance.get_all方法的具体用法?Python TriggerInstance.get_all怎么用?Python TriggerInstance.get_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类st2common.persistence.trigger.TriggerInstance
的用法示例。
在下文中一共展示了TriggerInstance.get_all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_no_timestamp_doesnt_delete
# 需要导入模块: from st2common.persistence.trigger import TriggerInstance [as 别名]
# 或者: from st2common.persistence.trigger.TriggerInstance import get_all [as 别名]
def test_no_timestamp_doesnt_delete(self):
now = date_utils.get_datetime_utc_now()
instance_db = TriggerInstanceDB(trigger='purge_tool.dummy.trigger',
payload={'hola': 'hi', 'kuraci': 'chicken'},
occurrence_time=now - timedelta(days=20))
TriggerInstance.add_or_update(instance_db)
self.assertEqual(len(TriggerInstance.get_all()), 1)
purge_trigger_instances()
self.assertEqual(len(TriggerInstance.get_all()), 1)
示例2: test_no_timestamp_doesnt_delete
# 需要导入模块: from st2common.persistence.trigger import TriggerInstance [as 别名]
# 或者: from st2common.persistence.trigger.TriggerInstance import get_all [as 别名]
def test_no_timestamp_doesnt_delete(self):
now = date_utils.get_datetime_utc_now()
instance_db = TriggerInstanceDB(trigger='purge_tool.dummy.trigger',
payload={'hola': 'hi', 'kuraci': 'chicken'},
occurrence_time=now - timedelta(days=20))
TriggerInstance.add_or_update(instance_db)
self.assertEqual(len(TriggerInstance.get_all()), 1)
expected_msg = 'Specify a valid timestamp'
self.assertRaisesRegexp(ValueError, expected_msg,
purge_trigger_instances,
logger=LOG, timestamp=None)
self.assertEqual(len(TriggerInstance.get_all()), 1)
示例3: test_purge
# 需要导入模块: from st2common.persistence.trigger import TriggerInstance [as 别名]
# 或者: from st2common.persistence.trigger.TriggerInstance import get_all [as 别名]
def test_purge(self):
now = date_utils.get_datetime_utc_now()
instance_db = TriggerInstanceDB(trigger='purge_tool.dummy.trigger',
payload={'hola': 'hi', 'kuraci': 'chicken'},
occurrence_time=now - timedelta(days=20),
status=TRIGGER_INSTANCE_PROCESSED)
TriggerInstance.add_or_update(instance_db)
instance_db = TriggerInstanceDB(trigger='purge_tool.dummy.trigger',
payload={'hola': 'hi', 'kuraci': 'chicken'},
occurrence_time=now - timedelta(days=5),
status=TRIGGER_INSTANCE_PROCESSED)
TriggerInstance.add_or_update(instance_db)
self.assertEqual(len(TriggerInstance.get_all()), 2)
purge_trigger_instances(logger=LOG, timestamp=now - timedelta(days=10))
self.assertEqual(len(TriggerInstance.get_all()), 1)
示例4: get_all
# 需要导入模块: from st2common.persistence.trigger import TriggerInstance [as 别名]
# 或者: from st2common.persistence.trigger.TriggerInstance import get_all [as 别名]
def get_all(self, **kw):
"""
List all triggerinstances.
Handles requests:
GET /triggerinstances/
"""
trigger_instance_apis = [TriggerInstanceAPI.from_model(trigger_instance_db)
for trigger_instance_db in TriggerInstance.get_all(**kw)]
return trigger_instance_apis