euscanwww: settable options for _run_in_chunks()
Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
parent
8fdac1014c
commit
1ae2dcba50
@ -8,6 +8,8 @@ from celery.task import task, periodic_task
|
|||||||
from celery.task.schedules import crontab
|
from celery.task.schedules import crontab
|
||||||
from celery.task.sets import TaskSet
|
from celery.task.sets import TaskSet
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
from djeuscan.models import Package, RefreshPackageQuery
|
from djeuscan.models import Package, RefreshPackageQuery
|
||||||
from djeuscan.processing.regen_rrds import regen_rrds
|
from djeuscan.processing.regen_rrds import regen_rrds
|
||||||
from djeuscan.processing.update_counters import update_counters
|
from djeuscan.processing.update_counters import update_counters
|
||||||
@ -32,7 +34,9 @@ def _chunks(it, n):
|
|||||||
yield [first] + list(islice(it, n - 1))
|
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.
|
Launches a TaskSet at a time with <concurrently> subtasks.
|
||||||
Each subtask has <n> packages to handle
|
Each subtask has <n> packages to handle
|
||||||
|
@ -235,6 +235,9 @@ CELERY_RESULT_BACKEND = "amqp"
|
|||||||
BROKER_CONNECTION_TIMEOUT = 3600
|
BROKER_CONNECTION_TIMEOUT = 3600
|
||||||
CELERYD_CONCURRENCY = 4
|
CELERYD_CONCURRENCY = 4
|
||||||
|
|
||||||
|
TASKS_CONCURRENTLY = 8
|
||||||
|
TASKS_SUBTASK_PACKAGES = 32
|
||||||
|
|
||||||
# LDAP authentication
|
# LDAP authentication
|
||||||
# TODO: Test data - change me!
|
# TODO: Test data - change me!
|
||||||
AUTH_LDAP_SERVER_URI = "ldap://localhost"
|
AUTH_LDAP_SERVER_URI = "ldap://localhost"
|
||||||
|
Loading…
Reference in New Issue
Block a user