当前位置: 首页>>代码示例>>Python>>正文


Python Task.invalidate_tasks方法代码示例

本文整理汇总了Python中oneanddone.tasks.models.Task.invalidate_tasks方法的典型用法代码示例。如果您正苦于以下问题:Python Task.invalidate_tasks方法的具体用法?Python Task.invalidate_tasks怎么用?Python Task.invalidate_tasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oneanddone.tasks.models.Task的用法示例。


在下文中一共展示了Task.invalidate_tasks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_invalidate_tasks_not_equals_criterion

# 需要导入模块: from oneanddone.tasks.models import Task [as 别名]
# 或者: from oneanddone.tasks.models.Task import invalidate_tasks [as 别名]
 def test_invalidate_tasks_not_equals_criterion(self):
     """
     The invalidate_tasks routine should invalidate tasks which match the
     invalidation criteria.
     This tests a not equals criterion.
     """
     bug_to_become_invalid, bug_to_stay_valid = BugzillaBugFactory.create_batch(2)
     batch = TaskImportBatchFactory.create()
     criterion = TaskInvalidationCriterionFactory.create(
         field_name='name',
         relation=TaskInvalidationCriterion.NOT_EQUAL,
         field_value='value')
     criterion.batches.add(batch)
     criterion.save()
     task1, task2 = TaskFactory.create_batch(2,
                                             batch=batch,
                                             imported_item=bug_to_become_invalid,
                                             is_invalid=False)
     task2.imported_item = bug_to_stay_valid
     task2.save()
     with patch('oneanddone.tasks.models.BugzillaUtils.request_bug') as request_bug:
         request_bug.side_effect = lambda x: {
             bug_to_become_invalid.bugzilla_id: {'name': 'value'},
             bug_to_stay_valid.bugzilla_id: {'name': 'not value'}}[x]
         eq_(Task.invalidate_tasks(), 1)
     eq_(Task.objects.get(pk=task1.pk).is_invalid, False)
     eq_(Task.objects.get(pk=task2.pk).is_invalid, True)
开发者ID:akatsoulas,项目名称:oneanddone,代码行数:29,代码来源:test_models.py

示例2: handle

# 需要导入模块: from oneanddone.tasks.models import Task [as 别名]
# 或者: from oneanddone.tasks.models.Task import invalidate_tasks [as 别名]
 def handle(self, *args, **options):
     invalidated = Task.invalidate_tasks()
     self.stdout.write('%s: %s tasks were invalidated via bug data\n' %
                       (datetime.now().isoformat(), invalidated))
     closed = TaskAttempt.close_stale_onetime_attempts()
     self.stdout.write('%s: %s stale one-time attempts were closed\n' %
                       (datetime.now().isoformat(), closed))
     closed = TaskAttempt.close_expired_task_attempts()
     self.stdout.write('%s: %s attempts for expired tasks were closed\n' %
                       (datetime.now().isoformat(), closed))
开发者ID:Anmol2307,项目名称:oneanddone,代码行数:12,代码来源:taskcleanup.py


注:本文中的oneanddone.tasks.models.Task.invalidate_tasks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。