-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for multiple celery queues
Close #163
- Loading branch information
Showing
7 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
from celery import current_app | ||
from django.conf import settings | ||
|
||
from health_check.contrib.celery.backends import CeleryHealthCheck | ||
from health_check.plugins import plugin_dir | ||
|
||
|
||
class TestAutoDiscover: | ||
def test_autodiscover(self): | ||
health_check_plugins = list(filter( | ||
lambda x: 'health_check.' in x, | ||
lambda x: 'health_check.' in x and 'celery' not in x, | ||
settings.INSTALLED_APPS | ||
)) | ||
|
||
assert len(plugin_dir._registry) == len(health_check_plugins) | ||
non_celery_plugins = [x for x in plugin_dir._registry if not issubclass(x[0], CeleryHealthCheck)] | ||
|
||
# The number of installed apps excluding celery should equal to all plugins except celery | ||
assert len(non_celery_plugins) == len(health_check_plugins) | ||
|
||
def test_discover_celery_queues(self): | ||
celery_plugins = [x for x in plugin_dir._registry if issubclass(x[0], CeleryHealthCheck)] | ||
assert len(celery_plugins) == len(current_app.amqp.queues) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .celery import app | ||
|
||
__all__ = ['app'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from celery import Celery | ||
|
||
app = Celery('testapp') | ||
app.config_from_object('django.conf:settings', namespace='CELERY') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,3 +53,8 @@ | |
SECRET_KEY = uuid.uuid4().hex | ||
|
||
USE_L10N = True | ||
|
||
CELERY_TASK_QUEUES = { | ||
'default': {}, | ||
'queue2': {} | ||
} |