euscanwww: settable options for _run_in_chunks()

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino 2012-06-26 18:31:35 +02:00
parent 8fdac1014c
commit 1ae2dcba50
2 changed files with 8 additions and 1 deletions

View File

@ -8,6 +8,8 @@ from celery.task import task, periodic_task
from celery.task.schedules import crontab
from celery.task.sets import TaskSet
from django.conf import settings
from djeuscan.models import Package, RefreshPackageQuery
from djeuscan.processing.regen_rrds import regen_rrds
from djeuscan.processing.update_counters import update_counters
@ -32,7 +34,9 @@ def _chunks(it, n):
yield [first] + list(islice(it, n - 1))
def _run_in_chunks(task, packages, kwargs=None, concurrently=8, n=32):
def _run_in_chunks(task, packages, kwargs=None,
concurrently=settings.TASKS_CONCURRENTLY,
n=settings.TASKS_SUBTASK_PACKAGES):
"""
Launches a TaskSet at a time with <concurrently> subtasks.
Each subtask has <n> packages to handle

View File

@ -235,6 +235,9 @@ CELERY_RESULT_BACKEND = "amqp"
BROKER_CONNECTION_TIMEOUT = 3600
CELERYD_CONCURRENCY = 4
TASKS_CONCURRENTLY = 8
TASKS_SUBTASK_PACKAGES = 32
# LDAP authentication
# TODO: Test data - change me!
AUTH_LDAP_SERVER_URI = "ldap://localhost"