def test_reap_expired_documents(self): """ Make sure the reap_expired_documents Task is present and properly configured. """ reap = celery_instance.celery.conf['CELERYBEAT_SCHEDULE']['reap_expired_documents'] expected_reap = { 'task': queue_reap_expired_documents.name, 'schedule': timedelta(days=(config.getfloat('data_reaping', 'reaper_interval'))), 'args': tuple(), } self.assertEqual(reap, expected_reap)
def test_reap_expired_documents(self): """ Make sure the reap_expired_documents Task is present and properly configured. """ reap = celery_instance.celery.conf['CELERYBEAT_SCHEDULE'][ 'reap_expired_documents'] expected_reap = { 'task': queue_reap_expired_documents.name, 'schedule': timedelta( days=(config.getfloat('data_reaping', 'reaper_interval'))), 'args': tuple(), } self.assertEqual(reap, expected_reap)
import ssl from celery import Celery from pulp.server.config import config broker_url = config.get('tasks', 'broker_url') celery = Celery('tasks', broker=broker_url) RESOURCE_MANAGER_QUEUE = 'resource_manager' CELERYBEAT_SCHEDULE = { 'reap_expired_documents': { 'task': 'pulp.server.db.reaper.reap_expired_documents', 'schedule': timedelta(days=config.getfloat('data_reaping', 'reaper_interval')), 'args': tuple(), }, 'monthly_maintenance': { 'task': 'pulp.server.maintenance.monthly.monthly_maintenance', 'schedule': timedelta(days=30), 'args': tuple(), }, } def create_mongo_config(): """ Inspects the pulp config's mongodb settings and returns a data structure that can be passed to celery for it's mongodb result backend config.
from pulp.server.config import config from pulp.server.constants import PULP_DJANGO_SETTINGS_MODULE os.environ.setdefault("DJANGO_SETTINGS_MODULE", PULP_DJANGO_SETTINGS_MODULE) broker_url = config.get('tasks', 'broker_url') celery = Celery('tasks', broker=broker_url) DEDICATED_QUEUE_EXCHANGE = 'C.dq' RESOURCE_MANAGER_QUEUE = 'resource_manager' CELERYBEAT_SCHEDULE = { 'reap_expired_documents': { 'task': 'pulp.server.db.reaper.queue_reap_expired_documents', 'schedule': timedelta(days=config.getfloat('data_reaping', 'reaper_interval')), 'args': tuple(), }, 'monthly_maintenance': { 'task': 'pulp.server.maintenance.monthly.queue_monthly_maintenance', 'schedule': timedelta(days=30), 'args': tuple(), }, 'download_deferred_content': { 'task': 'pulp.server.controllers.repository.download_deferred', 'schedule': timedelta(minutes=config.getint('lazy', 'download_interval')), 'args': tuple(), }, }
from pulp.server.config import config from pulp.server.constants import PULP_DJANGO_SETTINGS_MODULE os.environ.setdefault("DJANGO_SETTINGS_MODULE", PULP_DJANGO_SETTINGS_MODULE) broker_url = config.get("tasks", "broker_url") celery = Celery("tasks", broker=broker_url) DEDICATED_QUEUE_EXCHANGE = "C.dq" RESOURCE_MANAGER_QUEUE = "resource_manager" CELERYBEAT_SCHEDULE = { "reap_expired_documents": { "task": "pulp.server.db.reaper.queue_reap_expired_documents", "schedule": timedelta(days=config.getfloat("data_reaping", "reaper_interval")), "args": tuple(), }, "monthly_maintenance": { "task": "pulp.server.maintenance.monthly.queue_monthly_maintenance", "schedule": timedelta(days=30), "args": tuple(), }, "download_deferred_content": { "task": "pulp.server.controllers.repository.queue_download_deferred", "schedule": timedelta(minutes=config.getint("lazy", "download_interval")), "args": tuple(), }, }