Пример #1
0
    def test_tasks(self, index_fun):
        """Tests to make sure tasks are added and run"""
        q = question()
        # Don't call self.refresh here since that calls generate_tasks().

        eq_(index_fun.call_count, 0)

        q.save()
        generate_tasks()

        eq_(index_fun.call_count, 1)
Пример #2
0
    def test_tasks(self, index_fun):
        """Tests to make sure tasks are added and run"""
        q = QuestionFactory()
        # Don't call self.refresh here since that calls generate_tasks().

        eq_(index_fun.call_count, 0)

        q.save()
        generate_tasks()

        eq_(index_fun.call_count, 1)
Пример #3
0
    def refresh(self, run_tasks=True):
        index = es_utils.WRITE_INDEX

        if run_tasks:
            # Any time we're doing a refresh, we're making sure that
            # the index is ready to be queried. Given that, it's
            # almost always the case that we want to run all the
            # generated tasks, then refresh.
            generate_tasks()

        get_es().refresh(index)
        get_es().health(wait_for_status='yellow')
Пример #4
0
    def refresh(self, run_tasks=True):
        es = get_es()

        if run_tasks:
            # Any time we're doing a refresh, we're making sure that
            # the index is ready to be queried. Given that, it's
            # almost always the case that we want to run all the
            # generated tasks, then refresh.
            generate_tasks()

        for index in es_utils.all_write_indexes():
            es.indices.refresh(index=index)

        es.cluster.health(wait_for_status='yellow')
Пример #5
0
    def refresh(self, run_tasks=True):
        es = get_es()

        if run_tasks:
            # Any time we're doing a refresh, we're making sure that
            # the index is ready to be queried. Given that, it's
            # almost always the case that we want to run all the
            # generated tasks, then refresh.
            generate_tasks()

        for index in es_utils.all_write_indexes():
            es.indices.refresh(index=index)

        es.cluster.health(wait_for_status='yellow')
Пример #6
0
    def test_tasks_squashed(self, index_fun):
        """Tests to make sure tasks are squashed"""
        q = question()
        # Don't call self.refresh here since that calls generate_tasks().

        eq_(index_fun.call_count, 0)

        q.save()
        q.save()
        q.save()
        q.save()

        eq_(index_fun.call_count, 0)

        generate_tasks()

        eq_(index_fun.call_count, 1)
Пример #7
0
    def test_tasks_squashed(self, index_fun):
        """Tests to make sure tasks are squashed"""
        q = QuestionFactory()
        # Don't call self.refresh here since that calls generate_tasks().

        eq_(index_fun.call_count, 0)

        q.save()
        q.save()
        q.save()
        q.save()

        eq_(index_fun.call_count, 0)

        generate_tasks()

        eq_(index_fun.call_count, 1)
Пример #8
0
def remove_expired_registration_profiles():
    """"Cleanup expired registration profiles and users that not activated."""
    RegistrationProfile.objects.delete_expired_users()
    generate_tasks()
 def handle(self, **options):
     RegistrationProfile.objects.delete_expired_users()
     generate_tasks()