Пример #1
0
    def test_scale_celery_task(self, mock_scale_by_runs, mock_scale_by_tasks):
        with self.settings(CELERY_SCALE_BY_RUN=True):
            scale_celery_task(16000)
            mock_scale_by_runs.assert_called_once_with(16000)

        with self.settings(CELERY_SCALE_BY_RUN=False):
            scale_celery_task(16000)
            celery_tasks = get_celery_tasks_scale_by_task()
            mock_scale_by_tasks.assert_called_once_with(celery_tasks, 16000)
Пример #2
0
import os

import celery
import django
from django.core.cache import cache

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "eventkit_cloud.settings.prod")
django.setup()

from eventkit_cloud.celery import app
from eventkit_cloud.tasks.scheduled_tasks import scale_by_runs, scale_celery_task

if __name__ == '__main__':
    scale_celery_task(30000)