Commit d7b396ac authored by Michael Fladischer's avatar Michael Fladischer

New upstream version 4.1.0

parent 53047e39
......@@ -219,9 +219,26 @@ Kevin Richardson, 2016/06/29
Andrew Stewart, 2016/07/04
Xin Li, 2016/08/03
Alli Witheford, 2016/09/29
Alan Justino da Silva, 2016/10/14
Marat Sharafutdinov, 2016/11/04
Viktor Holmqvist, 2016/12/02
Rick Wargo, 2016/12/02
zhengxiaowai, 2016/12/07
Michael Howitz, 2016/12/08
Andreas Pelme, 2016/12/13
Mike Chen, 2016/12/20
Alejandro Pernin, 2016/12/23
Yuval Shalev, 2016/12/27
Morgan Doocy, 2017/01/02
Arcadiy Ivanov, 2017/01/08
Ryan Hiebert, 2017/01/20
Jianjian Yu, 2017/04/09
Brian May, 2017/04/10
Dmytro Petruk, 2017/04/12
Joey Wilhelm, 2017/04/12
Yoichi Nakayama, 2017/04/25
Simon Schmidt, 2017/05/19
Anthony Lukach, 2017/05/23
Samuel Dion-Girardeau, 2017/05/29
Aydin Sen, 2017/06/14
Preston Moore, 2017/06/18
This diff is collapsed.
......@@ -42,7 +42,7 @@ The documentation portion of Celery (the rendered contents of the
"docs" directory of a software distribution or checkout) is supplied
under the "Creative Commons Attribution-ShareAlike 4.0
International" (CC BY-SA 4.0) License as described by
http://creativecommons.org/licenses/by-sa/4.0/
https://creativecommons.org/licenses/by-sa/4.0/
Footnotes
=========
......
Metadata-Version: 1.1
Name: celery
Version: 4.0.2
Version: 4.1.0
Summary: Distributed Task Queue.
Home-page: http://celeryproject.org
Author: Ask Solem
......@@ -10,9 +10,9 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
|build-status| |license| |wheel| |pyversion| |pyimp|
:Version: 4.0.2 (latentcall)
:Version: 4.1.0 (latentcall)
:Web: http://celeryproject.org/
:Download: http://pypi.python.org/pypi/celery/
:Download: https://pypi.python.org/pypi/celery/
:Source: https://github.com/celery/celery/
:Keywords: task, queue, job, async, rabbitmq, amqp, redis,
python, distributed, actors
......@@ -162,8 +162,8 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
.. _`Eventlet`: http://eventlet.net/
.. _`gevent`: http://gevent.org/
.. _RabbitMQ: http://rabbitmq.com
.. _Redis: http://redis.io
.. _RabbitMQ: https://rabbitmq.com
.. _Redis: https://redis.io
.. _SQLAlchemy: http://sqlalchemy.org
Framework Integration
......@@ -190,15 +190,15 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
development easier, and sometimes they add important hooks like closing
database connections at ``fork``.
.. _`Django`: http://djangoproject.com/
.. _`Django`: https://djangoproject.com/
.. _`Pylons`: http://pylonsproject.org/
.. _`Flask`: http://flask.pocoo.org/
.. _`web2py`: http://web2py.com/
.. _`Bottle`: http://bottlepy.org/
.. _`Bottle`: https://bottlepy.org/
.. _`Pyramid`: http://docs.pylonsproject.org/en/latest/docs/pyramid.html
.. _`pyramid_celery`: http://pypi.python.org/pypi/pyramid_celery/
.. _`celery-pylons`: http://pypi.python.org/pypi/celery-pylons
.. _`web2py-celery`: http://code.google.com/p/web2py-celery/
.. _`pyramid_celery`: https://pypi.python.org/pypi/pyramid_celery/
.. _`celery-pylons`: https://pypi.python.org/pypi/celery-pylons
.. _`web2py-celery`: https://code.google.com/p/web2py-celery/
.. _`Tornado`: http://www.tornadoweb.org/
.. _`tornado-celery`: https://github.com/mher/tornado-celery/
......@@ -331,7 +331,7 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
Download the latest version of Celery from PyPI:
http://pypi.python.org/pypi/celery/
https://pypi.python.org/pypi/celery/
You can install it by doing the following,:
......@@ -372,7 +372,7 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
With git
~~~~~~~~
Please the Contributing section.
Please see the Contributing section.
.. _getting-help:
......@@ -387,7 +387,7 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
For discussions about the usage, development, and future of Celery,
please join the `celery-users`_ mailing list.
.. _`celery-users`: http://groups.google.com/group/celery-users/
.. _`celery-users`: https://groups.google.com/group/celery-users/
.. _irc-channel:
......@@ -397,7 +397,7 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
Come chat with us on IRC. The **#celery** channel is located at the `Freenode`_
network.
.. _`Freenode`: http://freenode.net
.. _`Freenode`: https://freenode.net
.. _bug-tracker:
......@@ -412,7 +412,7 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
Wiki
====
http://wiki.github.com/celery/celery/
https://wiki.github.com/celery/celery/
.. _contributing-short:
......@@ -454,15 +454,15 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
.. |wheel| image:: https://img.shields.io/pypi/wheel/celery.svg
:alt: Celery can be installed via wheel
:target: http://pypi.python.org/pypi/celery/
:target: https://pypi.python.org/pypi/celery/
.. |pyversion| image:: https://img.shields.io/pypi/pyversions/celery.svg
:alt: Supported Python versions.
:target: http://pypi.python.org/pypi/celery/
:target: https://pypi.python.org/pypi/celery/
.. |pyimp| image:: https://img.shields.io/pypi/implementation/celery.svg
:alt: Support Python implementations.
:target: http://pypi.python.org/pypi/celery/
:target: https://pypi.python.org/pypi/celery/
Keywords: task job queue distributed messaging actor
......@@ -477,6 +477,7 @@ Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Operating System :: OS Independent
......@@ -2,9 +2,9 @@
|build-status| |license| |wheel| |pyversion| |pyimp|
:Version: 4.0.2 (latentcall)
:Version: 4.1.0 (latentcall)
:Web: http://celeryproject.org/
:Download: http://pypi.python.org/pypi/celery/
:Download: https://pypi.python.org/pypi/celery/
:Source: https://github.com/celery/celery/
:Keywords: task, queue, job, async, rabbitmq, amqp, redis,
python, distributed, actors
......@@ -154,8 +154,8 @@ It supports...
.. _`Eventlet`: http://eventlet.net/
.. _`gevent`: http://gevent.org/
.. _RabbitMQ: http://rabbitmq.com
.. _Redis: http://redis.io
.. _RabbitMQ: https://rabbitmq.com
.. _Redis: https://redis.io
.. _SQLAlchemy: http://sqlalchemy.org
Framework Integration
......@@ -182,15 +182,15 @@ The integration packages aren't strictly necessary, but they can make
development easier, and sometimes they add important hooks like closing
database connections at ``fork``.
.. _`Django`: http://djangoproject.com/
.. _`Django`: https://djangoproject.com/
.. _`Pylons`: http://pylonsproject.org/
.. _`Flask`: http://flask.pocoo.org/
.. _`web2py`: http://web2py.com/
.. _`Bottle`: http://bottlepy.org/
.. _`Bottle`: https://bottlepy.org/
.. _`Pyramid`: http://docs.pylonsproject.org/en/latest/docs/pyramid.html
.. _`pyramid_celery`: http://pypi.python.org/pypi/pyramid_celery/
.. _`celery-pylons`: http://pypi.python.org/pypi/celery-pylons
.. _`web2py-celery`: http://code.google.com/p/web2py-celery/
.. _`pyramid_celery`: https://pypi.python.org/pypi/pyramid_celery/
.. _`celery-pylons`: https://pypi.python.org/pypi/celery-pylons
.. _`web2py-celery`: https://code.google.com/p/web2py-celery/
.. _`Tornado`: http://www.tornadoweb.org/
.. _`tornado-celery`: https://github.com/mher/tornado-celery/
......@@ -323,7 +323,7 @@ Downloading and installing from source
Download the latest version of Celery from PyPI:
http://pypi.python.org/pypi/celery/
https://pypi.python.org/pypi/celery/
You can install it by doing the following,:
......@@ -364,7 +364,7 @@ pip commands:
With git
~~~~~~~~
Please the Contributing section.
Please see the Contributing section.
.. _getting-help:
......@@ -379,7 +379,7 @@ Mailing list
For discussions about the usage, development, and future of Celery,
please join the `celery-users`_ mailing list.
.. _`celery-users`: http://groups.google.com/group/celery-users/
.. _`celery-users`: https://groups.google.com/group/celery-users/
.. _irc-channel:
......@@ -389,7 +389,7 @@ IRC
Come chat with us on IRC. The **#celery** channel is located at the `Freenode`_
network.
.. _`Freenode`: http://freenode.net
.. _`Freenode`: https://freenode.net
.. _bug-tracker:
......@@ -404,7 +404,7 @@ to our issue tracker at https://github.com/celery/celery/issues/
Wiki
====
http://wiki.github.com/celery/celery/
https://wiki.github.com/celery/celery/
.. _contributing-short:
......@@ -446,13 +446,13 @@ file in the top distribution directory for the full license text.
.. |wheel| image:: https://img.shields.io/pypi/wheel/celery.svg
:alt: Celery can be installed via wheel
:target: http://pypi.python.org/pypi/celery/
:target: https://pypi.python.org/pypi/celery/
.. |pyversion| image:: https://img.shields.io/pypi/pyversions/celery.svg
:alt: Supported Python versions.
:target: http://pypi.python.org/pypi/celery/
:target: https://pypi.python.org/pypi/celery/
.. |pyimp| image:: https://img.shields.io/pypi/implementation/celery.svg
:alt: Support Python implementations.
:target: http://pypi.python.org/pypi/celery/
:target: https://pypi.python.org/pypi/celery/
Metadata-Version: 1.1
Name: celery
Version: 4.0.2
Version: 4.1.0
Summary: Distributed Task Queue.
Home-page: http://celeryproject.org
Author: Ask Solem
......@@ -10,9 +10,9 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
|build-status| |license| |wheel| |pyversion| |pyimp|
:Version: 4.0.2 (latentcall)
:Version: 4.1.0 (latentcall)
:Web: http://celeryproject.org/
:Download: http://pypi.python.org/pypi/celery/
:Download: https://pypi.python.org/pypi/celery/
:Source: https://github.com/celery/celery/
:Keywords: task, queue, job, async, rabbitmq, amqp, redis,
python, distributed, actors
......@@ -162,8 +162,8 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
.. _`Eventlet`: http://eventlet.net/
.. _`gevent`: http://gevent.org/
.. _RabbitMQ: http://rabbitmq.com
.. _Redis: http://redis.io
.. _RabbitMQ: https://rabbitmq.com
.. _Redis: https://redis.io
.. _SQLAlchemy: http://sqlalchemy.org
Framework Integration
......@@ -190,15 +190,15 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
development easier, and sometimes they add important hooks like closing
database connections at ``fork``.
.. _`Django`: http://djangoproject.com/
.. _`Django`: https://djangoproject.com/
.. _`Pylons`: http://pylonsproject.org/
.. _`Flask`: http://flask.pocoo.org/
.. _`web2py`: http://web2py.com/
.. _`Bottle`: http://bottlepy.org/
.. _`Bottle`: https://bottlepy.org/
.. _`Pyramid`: http://docs.pylonsproject.org/en/latest/docs/pyramid.html
.. _`pyramid_celery`: http://pypi.python.org/pypi/pyramid_celery/
.. _`celery-pylons`: http://pypi.python.org/pypi/celery-pylons
.. _`web2py-celery`: http://code.google.com/p/web2py-celery/
.. _`pyramid_celery`: https://pypi.python.org/pypi/pyramid_celery/
.. _`celery-pylons`: https://pypi.python.org/pypi/celery-pylons
.. _`web2py-celery`: https://code.google.com/p/web2py-celery/
.. _`Tornado`: http://www.tornadoweb.org/
.. _`tornado-celery`: https://github.com/mher/tornado-celery/
......@@ -331,7 +331,7 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
Download the latest version of Celery from PyPI:
http://pypi.python.org/pypi/celery/
https://pypi.python.org/pypi/celery/
You can install it by doing the following,:
......@@ -372,7 +372,7 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
With git
~~~~~~~~
Please the Contributing section.
Please see the Contributing section.
.. _getting-help:
......@@ -387,7 +387,7 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
For discussions about the usage, development, and future of Celery,
please join the `celery-users`_ mailing list.
.. _`celery-users`: http://groups.google.com/group/celery-users/
.. _`celery-users`: https://groups.google.com/group/celery-users/
.. _irc-channel:
......@@ -397,7 +397,7 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
Come chat with us on IRC. The **#celery** channel is located at the `Freenode`_
network.
.. _`Freenode`: http://freenode.net
.. _`Freenode`: https://freenode.net
.. _bug-tracker:
......@@ -412,7 +412,7 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
Wiki
====
http://wiki.github.com/celery/celery/
https://wiki.github.com/celery/celery/
.. _contributing-short:
......@@ -454,15 +454,15 @@ Description: .. image:: http://docs.celeryproject.org/en/latest/_images/celery-b
.. |wheel| image:: https://img.shields.io/pypi/wheel/celery.svg
:alt: Celery can be installed via wheel
:target: http://pypi.python.org/pypi/celery/
:target: https://pypi.python.org/pypi/celery/
.. |pyversion| image:: https://img.shields.io/pypi/pyversions/celery.svg
:alt: Supported Python versions.
:target: http://pypi.python.org/pypi/celery/
:target: https://pypi.python.org/pypi/celery/
.. |pyimp| image:: https://img.shields.io/pypi/implementation/celery.svg
:alt: Support Python implementations.
:target: http://pypi.python.org/pypi/celery/
:target: https://pypi.python.org/pypi/celery/
Keywords: task job queue distributed messaging actor
......@@ -477,6 +477,7 @@ Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Operating System :: OS Independent
......@@ -55,6 +55,7 @@ celery/backends/cassandra.py
celery/backends/consul.py
celery/backends/couchbase.py
celery/backends/couchdb.py
celery/backends/dynamodb.py
celery/backends/elasticsearch.py
celery/backends/filesystem.py
celery/backends/mongodb.py
......@@ -209,6 +210,7 @@ docs/history/changelog-2.4.rst
docs/history/changelog-2.5.rst
docs/history/changelog-3.0.rst
docs/history/changelog-3.1.rst
docs/history/changelog-4.0.rst
docs/history/index.rst
docs/history/whatsnew-2.5.rst
docs/history/whatsnew-3.0.rst
......@@ -246,6 +248,7 @@ docs/internals/reference/celery.backends.couchdb.rst
docs/internals/reference/celery.backends.database.models.rst
docs/internals/reference/celery.backends.database.rst
docs/internals/reference/celery.backends.database.session.rst
docs/internals/reference/celery.backends.dynamodb.rst
docs/internals/reference/celery.backends.elasticsearch.rst
docs/internals/reference/celery.backends.filesystem.rst
docs/internals/reference/celery.backends.mongodb.rst
......@@ -464,6 +467,7 @@ requirements/extras/consul.txt
requirements/extras/couchbase.txt
requirements/extras/couchdb.txt
requirements/extras/django.txt
requirements/extras/dynamodb.txt
requirements/extras/elasticsearch.txt
requirements/extras/eventlet.txt
requirements/extras/gevent.txt
......@@ -521,6 +525,7 @@ t/unit/backends/test_consul.py
t/unit/backends/test_couchbase.py
t/unit/backends/test_couchdb.py
t/unit/backends/test_database.py
t/unit/backends/test_dynamodb.py
t/unit/backends/test_elasticsearch.py
t/unit/backends/test_filesystem.py
t/unit/backends/test_mongodb.py
......
pytz>dev
billiard>=3.5.0.2,<3.6.0
kombu>=4.0.2,<5.0
billiard<3.6.0,>=3.5.0.2
kombu<5.0,>=4.0.2
[auth]
pyOpenSSL
......@@ -20,6 +20,9 @@ pycouchdb
[django]
Django>=1.8
[dynamodb]
boto3==1.4.3
[elasticsearch]
elasticsearch
......@@ -48,7 +51,7 @@ pyro4
redis>=2.10.5
[riak]
riak >=2.0
riak>=2.0
[slmq]
softlayer_messaging>=1.0.3
......
......@@ -14,7 +14,7 @@ from collections import namedtuple
SERIES = 'latentcall'
__version__ = '4.0.2'
__version__ = '4.1.0'
__author__ = 'Ask Solem'
__contact__ = 'ask@celeryproject.org'
__homepage__ = 'http://celeryproject.org'
......
......@@ -21,7 +21,7 @@ from celery.local import try_import
from celery.utils.nodenames import anon_nodename
from celery.utils.saferepr import saferepr
from celery.utils.text import indent as textindent
from celery.utils.time import maybe_make_aware, to_utc
from celery.utils.time import maybe_make_aware
from . import routes as _routes
......@@ -331,7 +331,9 @@ class AMQP(object):
now + timedelta(seconds=expires), tz=timezone,
)
eta = eta and eta.isoformat()
expires = expires and expires.isoformat()
# If we retry a task `expires` will already be ISO8601-formatted.
if not isinstance(expires, string_t):
expires = expires and expires.isoformat()
if argsrepr is None:
argsrepr = saferepr(args, self.argsrepr_maxsize)
......@@ -407,17 +409,11 @@ class AMQP(object):
if countdown: # convert countdown to ETA
self._verify_seconds(countdown, 'countdown')
now = now or self.app.now()
timezone = timezone or self.app.timezone
eta = now + timedelta(seconds=countdown)
if utc:
eta = to_utc(eta).astimezone(timezone)
if isinstance(expires, numbers.Real):
self._verify_seconds(expires, 'expires')
now = now or self.app.now()
timezone = timezone or self.app.timezone
expires = now + timedelta(seconds=expires)
if utc:
expires = to_utc(expires).astimezone(timezone)
eta = eta and eta.isoformat()
expires = expires and expires.isoformat()
......@@ -525,7 +521,7 @@ class AMQP(object):
exchange_type = 'direct'
# convert to anon-exchange, when exchange not set and direct ex.
if not exchange or not routing_key and exchange_type == 'direct':
if (not exchange or not routing_key) and exchange_type == 'direct':
exchange, routing_key = '', qname
elif exchange is None:
# not topic exchange, and exchange not undefined
......@@ -544,7 +540,7 @@ class AMQP(object):
sender=name, body=body,
exchange=exchange, routing_key=routing_key,
declare=declare, headers=headers2,
properties=kwargs, retry_policy=retry_policy,
properties=properties, retry_policy=retry_policy,
)
ret = producer.publish(
body,
......@@ -561,9 +557,18 @@ class AMQP(object):
send_after_publish(sender=name, body=body, headers=headers2,
exchange=exchange, routing_key=routing_key)
if sent_receivers: # XXX deprecated
send_task_sent(sender=name, task_id=body['id'], task=name,
args=body['args'], kwargs=body['kwargs'],
eta=body['eta'], taskset=body['taskset'])
if isinstance(body, tuple): # protocol version 2
send_task_sent(
sender=name, task_id=headers2['id'], task=name,
args=body[0], kwargs=body[1],
eta=headers2['eta'], taskset=headers2['group'],
)
else: # protocol version 1
send_task_sent(
sender=name, task_id=body['id'], task=name,
args=body['args'], kwargs=body['kwargs'],
eta=body['eta'], taskset=body['taskset'],
)
if sent_event:
evd = event_dispatcher or default_evd
exname = exchange
......
......@@ -29,7 +29,8 @@ BACKEND_ALIASES = {
'riak': 'celery.backends.riak:RiakBackend',
'file': 'celery.backends.filesystem:FilesystemBackend',
'disabled': 'celery.backends.base:DisabledBackend',
'consul': 'celery.backends.consul:ConsulBackend'
'consul': 'celery.backends.consul:ConsulBackend',
'dynamodb': 'celery.backends.dynamodb:DynamoDBBackend',
}
......
......@@ -870,7 +870,8 @@ class Celery(object):
def now(self):
"""Return the current time and date as a datetime."""
return self.loader.now(utc=self.conf.enable_utc)
from datetime import datetime
return datetime.utcnow().replace(tzinfo=self.timezone)
def select_queues(self, queues=None):
"""Select subset of queues.
......@@ -1231,6 +1232,10 @@ class Celery(object):
def producer_pool(self):
return self.amqp.producer_pool
def uses_utc_timezone(self):
"""Check if the application uses the UTC timezone."""
return self.conf.timezone == 'UTC' or self.conf.timezone is None
@cached_property
def timezone(self):
"""Current timezone for this app.
......@@ -1239,9 +1244,12 @@ class Celery(object):
:setting:`timezone` setting.
"""
conf = self.conf
tz = conf.timezone
tz = conf.timezone or 'UTC'
if not tz:
return (timezone.get_timezone('UTC') if conf.enable_utc
else timezone.local)
return timezone.get_timezone(conf.timezone)
if conf.enable_utc:
return timezone.get_timezone('UTC')
else:
if not conf.timezone:
return timezone.local
return timezone.get_timezone(tz)
App = Celery # noqa: E305 XXX compat
......@@ -152,6 +152,7 @@ NAMESPACES = Namespace(
redis=Namespace(
__old__=old_ns('celery_redis'),
backend_use_ssl=Option(type='dict'),
db=Option(type='int'),
host=Option(type='string'),
max_connections=Option(type='int'),
......@@ -178,6 +179,13 @@ NAMESPACES = Namespace(
persistent=Option(None, type='bool'),
serializer=Option('json'),
),
elasticsearch=Namespace(
__old__=old_ns('celery_elasticsearch'),
retry_on_timeout=Option(type='bool'),
max_retries=Option(type='int'),
timeout=Option(type='float'),
),
riak=Namespace(
__old__=old_ns('celery_riak'),
......@@ -277,7 +285,7 @@ NAMESPACES = Namespace(
'WARNING', old={'celery_redirect_stdouts_level'},
),
send_task_events=Option(
False, type='bool', old={'celeryd_send_events'},
False, type='bool', old={'celery_send_events'},
),
state_db=Option(),
task_log_format=Option(DEFAULT_TASK_LOG_FMT),
......
......@@ -19,6 +19,7 @@ from celery.result import EagerResult
from celery.utils import abstract
from celery.utils.functional import mattrgetter, maybe_list
from celery.utils.imports import instantiate
from celery.utils.nodenames import gethostname
from celery.utils.serialization import raise_with_context
from .annotations import resolve_all as resolve_all_annotations
......@@ -604,7 +605,7 @@ class Task(object):
Arguments:
args (Tuple): Positional arguments to retry with.
kwargs (Dict): Keyword arguments to retry with.
exc (Exception): Custom exception to report when the max restart
exc (Exception): Custom exception to report when the max retry
limit has been exceeded (default:
:exc:`~@MaxRetriesExceededError`).
......@@ -726,6 +727,7 @@ class Task(object):
'is_eager': True,
'logfile': logfile,
'loglevel': loglevel or 0,
'hostname': gethostname(),
'callbacks': maybe_list(link),
'errbacks': maybe_list(link_error),
'headers': headers,
......@@ -848,7 +850,7 @@ class Task(object):
chord = None
if self.request.chain:
for t in self.request.chain:
for t in reversed(self.request.chain):
sig |= signature(t, app=self.app)
sig.freeze(self.request.id,
......
......@@ -49,7 +49,6 @@ __all__ = [
]
logger = get_logger(__name__)
info = logger.info
#: Format string used to log task success.
LOG_SUCCESS = """\
......@@ -116,6 +115,14 @@ _patched = {}
trace_ok_t = namedtuple('trace_ok_t', ('retval', 'info', 'runtime', 'retstr'))
def info(fmt, context):
"""Log 'fmt % context' with severity 'INFO'.
'context' is also passed in extra with key 'data' for custom handlers.
"""
logger.info(fmt, context, extra={'data': context})
def task_has_custom(task, attr):
"""Return true if the task overrides ``attr``."""
return mro_lookup(task.__class__, attr, stop={BaseTask, object},
......
......@@ -70,7 +70,7 @@ FMT_REPLACE_SETTING = '{replace:<36} -> {with_}'
def appstr(app):
"""String used in __repr__ etc, to id app instances."""
return '{0}:{1:#x}'.format(app.main or '__main__', id(app))
return '{0} at {1:#x}'.format(app.main or '__main__', id(app))
class Settings(ConfigurationView):
......
......@@ -277,6 +277,10 @@ def _shutdown_handler(worker, sig='TERM', how='Warm',
if callback:
callback(worker)
safe_say('worker: {0} shutdown (MainProcess)'.format(how))
signals.worker_shutting_down.send(
sender=worker.hostname, sig=sig, how=how,
exitcode=exitcode,
)
if active_thread_count() > 1:
setattr(state, {'Warm': 'should_stop',
'Cold': 'should_terminate'}[how], exitcode)
......
......@@ -29,7 +29,7 @@ from celery._state import get_current_task
from celery.exceptions import (
ChordError, TimeoutError, TaskRevokedError, ImproperlyConfigured,
)
from celery.five import items
from celery.five import items, string
from celery.result import (
GroupResult, ResultBase, allow_join_result, result_from_tuple,
)
......@@ -237,7 +237,7 @@ class Backend(object):
serializer = self.serializer if serializer is None else serializer
if serializer in EXCEPTION_ABLE_CODECS:
return get_pickleable_exception(exc)
return {'exc_type': type(exc).__name__, 'exc_message': str(exc)}
return {'exc_type': type(exc).__name__, 'exc_message': string(exc)}
def exception_to_python(self, exc):
"""Convert serialized exception to Python exception."""
......
......@@ -24,7 +24,7 @@ try:
except ImportError: # pragma: no cover
raise ImproperlyConfigured(
'The database result backend requires SQLAlchemy to be installed.'
'See http://pypi.python.org/pypi/SQLAlchemy')
'See https://pypi.python.org/pypi/SQLAlchemy')
logger = logging.getLogger(__name__)
......
# -*- coding: utf-8 -*-
"""AWS DynamoDB result store backend."""
from __future__ import absolute_import, unicode_literals
from collections import namedtuple
from time import time, sleep
from kombu.utils.url import _parse_url as parse_url
from celery.exceptions import ImproperlyConfigured
from celery.utils.log import get_logger
from celery.five import string
from .base import KeyValueStoreBackend
try: