Skip to content

Commit

Permalink
send_task warns when CELERY_ALWAYS_EAGER is on
Browse files Browse the repository at this point in the history
  • Loading branch information
mher committed Feb 2, 2012
1 parent e33fff6 commit 703cba6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions celery/app/base.py
Expand Up @@ -13,6 +13,7 @@
from __future__ import with_statement

import os
import warnings
import platform as _platform

from contextlib import contextmanager
Expand All @@ -23,6 +24,7 @@

from .. import datastructures
from .. import platforms
from ..exceptions import AlwaysEagerIgnored
from ..utils import cached_property, instantiate, lpmerge

from .defaults import DEFAULTS, find_deprecated_settings, find
Expand Down Expand Up @@ -158,6 +160,10 @@ def send_task(self, name, args=None, kwargs=None, countdown=None,
:meth:`~celery.app.task.BaseTask.apply_async`.
"""
if self.conf.CELERY_ALWAYS_EAGER:
warnings.warn(AlwaysEagerIgnored(
"CELERY_ALWAYS_EAGER has no effect on send_task"))

router = self.amqp.Router(queues)
result_cls = result_cls or self.AsyncResult

Expand Down
4 changes: 4 additions & 0 deletions celery/exceptions.py
Expand Up @@ -84,6 +84,10 @@ class NotConfigured(UserWarning):
"""Celery has not been configured, as no config module has been found."""


class AlwaysEagerIgnored(UserWarning):
"""send_task ignores CELERY_ALWAYS_EAGER option"""


class InvalidTaskError(Exception):
"""The task has invalid data or is not properly constructed."""

Expand Down

0 comments on commit 703cba6

Please sign in to comment.