示例#1
0
 def test_autodiscover_tasks(self):
     base._RACE_PROTECTION = True
     try:
         base.autodiscover_tasks(['foo'])
     finally:
         base._RACE_PROTECTION = False
     with patch('celery.loaders.base.find_related_module') as frm:
         base.autodiscover_tasks(['foo'])
         self.assertTrue(frm.called)
示例#2
0
 def test_autodiscover_tasks(self):
     base._RACE_PROTECTION = True
     try:
         base.autodiscover_tasks(['foo'])
     finally:
         base._RACE_PROTECTION = False
     with patch('celery.loaders.base.find_related_module') as frm:
         base.autodiscover_tasks(['foo'])
         self.assertTrue(frm.called)
示例#3
0
 def test_autodiscover_tasks(self):
     base._RACE_PROTECTION = True
     try:
         base.autodiscover_tasks(["foo"])
     finally:
         base._RACE_PROTECTION = False
     with patch("celery.loaders.base.find_related_module") as frm:
         base.autodiscover_tasks(["foo"])
         frm.assert_called()
示例#4
0
def load_from_file(modname):
    """Load plugins djang-style rather than with plugins

    Reuse celery util which just loads the 'preprocessors' module from all
    INSTALLED_APPS.
    """

    appnames = [config.name for config in apps.get_app_configs()]
    # This will run all decorated function automatically
    autodiscover_tasks(appnames, modname)
# -*- coding: utf-8 -*-
# (c) 2017 Andreas Motl <*****@*****.**>
# Must import here to enable communication with Celery
from uspto.celery.app import celery_app
from celery.loaders.base import autodiscover_tasks

# Register application tasks
autodiscover_tasks(['uspto.pbd', 'uspto.peds'])