Commit Graph

96 Commits

Author SHA1 Message Date
Jason Held 41dbbe3063 Control pattern matching (#997)
* Added pattern/matcher to Mailbox

* pattern/match for kombu 4

* Ensure kombu.matcher is covered by our documentation.

* Adds test_matcher & pidbox unit tests.

* Added tests to ensure exception is raised when matcher is not registered.

* Adds to test for destination passed in to process.
2019-02-27 20:23:12 +06:00
Paul Bailey 30f52ad329 Support SSL URL parameters correctly for rediss protocol (#1002)
* fixed rediss url parsing

* added ssl parameter test

* added ssl parameter test

* added ssl parameter test

* added ssl parameter test

* added ssl parameter test

* added no ssl module parse_url test

* added no ssl module parse_url test

* added no ssl module parse_url test

* convert to list comprehension

* simulate no ssl in test

* add missing logger
2019-02-21 09:38:03 +02:00
Peter Lithammer 844d8d0673 Handle the case when only one Redis Sentinel node is provided (#1010)
The problem is that `self.connection.client.alt` is only populated when
there's more than one client URL provided, e.g.
`"sentinel://foo;sentinel://bar"`. It will also always contain all URLs,
including the primary/first entry.

So if the `alt` list is empty, it (usually) means there was only one
client URL provided.

I also took the liberty to perform name and type changes to be more in
line with the examples and documentation in the `redis` library. The
argument is `sentinels`, not `connection_list`. And it's of the type
`List[Tuple[str, int]]`, not `List[List[str, str]]`.

Fixes #1004
2019-02-21 09:37:21 +02:00
Peter Lithammer f49188d2f7 Use "_parse_url()" util to parse Sentinel master URL (#1009)
Fixes #1007
2019-02-20 23:35:36 +06:00
Patrick Woods 2415a64776 Restore bz2 import checks in compression.py (#1003)
Removed in #938 due to assumption that it only affected Jython but
the condition can be present in systems built without bz2 support.
2019-02-08 13:26:15 +02:00
Mads Jensen 0392c34e7d Removed Python 2.6 workarounds in test_qpid.py (#995) 2019-02-05 12:57:37 +06:00
Omer Katz 43930bbcae Happify lint. 2019-02-04 08:45:20 +02:00
Lars Rinn 024cbdc4fb import collections.ABCs from correct module (#992)
* import collectionss.ABCs from correct model to silence deprecation warnings

* fix imports for legacy python
2019-01-18 00:08:28 +02:00
Omer Katz 627964c804
Added optional support for zstd compression. (#985) 2019-01-13 09:44:44 +02:00
Omer Katz 8c88d9276a Added support for lzma compression (#984)
* Added support for lzma compression.

* Ignore branch.
2019-01-10 15:00:37 +06:00
Ilya Konstantinov 5ee7c1ddcc SQS: fix trimming .fifo from queue name (#982)
* SQS: fix trimming .fifo from queue name

* add test

* fix lint error
2019-01-09 20:36:37 +02:00
Omer Katz 93a05f7261
Added optional support for brotli compression (#983)
* Added optional support for brotli compression.

* Ignore import error for coverage purposes.
2019-01-09 19:05:02 +02:00
Omer Katz a28e7a27fb Remove unused private method. 2019-01-08 17:25:03 +02:00
Matus Valo 80584c8c9b Fix failing unittests of pyamqp transport. (#978)
Failing unittests were caused by commit f16df2a17630c9804a6da614443c5e862271823f in pyamqp.
2019-01-03 17:39:42 +02:00
Omer Katz 1ad6cbd35c
Happify lint. 2018-12-20 14:42:19 +02:00
Omer Katz ddd07a2923
Happify lint. 2018-12-20 14:39:37 +02:00
Hunter Fernandes c48d201ee2 Allow setting boto3.sqs.create_queue Attributes via transport_options (#957)
* Allow setting boto3.sqs.create_queue Attributes via transport_options

* Add docs for sqs transport_options `sqs-creation-attributes`
2018-12-09 18:53:12 +02:00
Brian Price a59b44e9fb Moving the handling of Sentinel failures to the redis library itself. (#813)
* Moving the handling of Sentinel failures to the redis library itself.

Currently Celery dies if the first Sentinel servive on the list is down,
as in if you lose a machine.

* Removing the use of unittest.

* Changing how an empty list is defined.
2018-11-29 12:38:52 +06:00
Irmen de Jong aa8ea28f50 Making the pyro transport available, fix it for recent Pyro4 versions, add broker daemon (#895)
* Make the pyro transport available and fix it for recent Pyro4 version.
Implemented the missing Pyro Kombu broker to actually be able to use the Pyro transport

* code style
2018-11-25 20:40:54 +06:00
Victor Villas 4a06fc6bb8 Add boto3 default region before hardcoded default (#951)
* Add boto3 default region before hardcoded default

* Add unit tests for SQS region default behavior

* Import boto3 only inside the test

The library may not be available
2018-11-20 16:15:31 +06:00
Ash Berlin-Taylor 05152da53d Support redis-py v2 and v3 (#948)
Further to #946 this fixes the underlying issue in a easy-to-upgrade way
for end users, many of whom will have Redis installed via other means.
By having this check here and supporting both versions concurrently it
makes it easier for end users, and to use celery/kombu in projects that
use Redis elsewhere.

With this change it is possibly worth reverting #946
2018-11-19 19:33:50 +02:00
Mads Jensen bb6d16c28d Removed Jython bz2 import fallback (#938) 2018-10-28 19:05:18 +02:00
Mintu Kumar Sah 94227bbc43 Fixed Worker shutdown creates duplicate messages in SQS broker (#926)
* On restore changes message visibility instead of send new message

* Acknowledge message on hub close

* Use sqs instead of async sqs to delete message

* changes itertools to range

* Empty Hub ready

* fixed test_poller_regeneration_on_access

* Fixed typo in comment

* Simplify loop to process self._ready

* Added test case for redelivered _put

* Lint fixes

* Added test case for delete_message call
2018-10-13 16:22:16 +06:00
Vsevolod Strukchinsky b3dc920883 Fix infinity loop in create_loop (#923) 2018-09-27 21:38:21 +06:00
Bruno Alla 62087a67cf Fix a deprecation warning about logger.warn() (#924)
* Fix a deprecation warning about logger.warn()

This fixes a deprecation warning from the standard library's logging module:

> The 'warn' method is deprecated, use 'warning' instead

* Update test
2018-09-27 19:12:44 +06:00
Clemens Wolff 32633554ac Add transports based on Azure PaaS (#891)
* Add transports based on Azure PaaS

This pull request adds two new transport implementations:

- `azurestoragequeues` is implemented on top of Azure Storage
  Queues [1]. This offers a simple but scalable and low-cost PaaS
  transport for Celery users in Azure. The transport is intended to be
  used in conjunction with the Azure Block Blob Storage backend [2].

- `azureservicebus` is implemented on top of Azure Service Bus [3] and
  offers PaaS support for more demanding Celery workloads in Azure. The
  transport is intended to be used in conjunction with the Azure
  CosmosDB backend [4].

This pull request was created together with @ankurokok, @dkisselev,
@evandropaula, @martinpeck and @michaelperel.

[1] https://azure.microsoft.com/en-us/services/storage/queues/
[2] https://github.com/celery/celery/pull/4685
[3] https://azure.microsoft.com/en-us/services/service-bus/
[4] https://github.com/celery/celery/pull/4720

* Exclude Azure transports from code coverage

There is test coverage for the transports but the tests require Azure
credentials to run (passed via environment variables) so codecov doesn't
exercise them.

* Remove env vars to configure transport

* Remove abbreviations
2018-08-30 23:34:52 +06:00
Daniel Blair 200a60a228 Add support for 'rediss' scheme for secure redis connections. (#910)
Putting a 'rediss'-specific check into a generic connection module feels
like a code smell but there doesn't appear to be another way to intercept
the connection initiation code. It defaults to the least secure form, as
there is no suitable default location for `ca_certs`. The recommendation
would still be to follow the documentation and specify `broker_use_ssl` if
coming from celery.
2018-08-27 13:26:07 +03:00
Omer Katz 6939d93d7f
Added tests that verify that librabbitmq is selected when available and not selected when it is not available. (#907) 2018-08-16 04:48:33 -05:00
C Blue Neeh 9e64dafa61 Allow SimpleQueue to pass 'queue_arguments' to Queue object. (#900)
* Update SimpleQueue for queue_arguments passing

Allow SimpleQueue to pass queue_arguments to Queue object.

This allows SimpleQueue to connect to RabbitMQ queues with custom arguments like 'x-queue-mode'='lazy'.

* Missed indent

* remove trailing space

* add 'queue_args' to arguments (and documentation) for SimpleQueue

Signed-off-by: Blue Cuenca <blue.cuenca@gmail.com>

* add test to verify new argument 'queue_args'.

Signed-off-by: Blue Cuenca <blue.cuenca@gmail.com>
2018-08-16 04:00:50 -05:00
gal cohen a307726faa on worker restart - restore visible regardless to time (#905)
* on worker restart - restore visiable regardless to timme

* add test

* rename test

* rename test

* pep8

* flake8
2018-08-15 17:12:45 +06:00
KUAN Hsuan-Tso 87d6423289 fix/Broadcast-fail-by-give-queue-kwargs (#906)
* If give queue kwargs broadcast will fail

Because give Broadcast(name='xxx', queue='xxx'),
it will create one specific name for queue,
and if launch more worker for consuming this queue,
this specific name queue already exist then it will not create new queue to
binding fanout exchange.
So all worker will consuming same queue, and exchange only binding this
queue then lose the effect of broadcasting.

* modify test_Broadcast
2018-08-15 16:59:33 +06:00
Antonio Gutierrez 1160b92c27 Queue: add handling of Exchange as str to constructor (#904)
To fit with the documentation, Queue can now handle a str argument for
the exchange parameter in the constructor, as well as an actual Exchange
object.
Added relevant unit tests to avoid regressions.

Fixes: https://github.com/celery/kombu/issues/903

Signed-off-by: Antonio Gutierrez <chibby0ne@gmail.com>
2018-08-12 08:59:27 +06:00
Alan Justino da Silva 073001e341 "Reentrant" version, that allows a `celery.bin.celery.main` worker to run multiple times (#866)
* Regenerate poll()s of Hub and Redis, after shutdown

Allows the same Python process to bring a new Worker
after a shutdown (SystemExit) rescued.

See: https://botbot.me/freenode/celery/2018-04-16/?msg=99046233&page=2

* Hub.poller is now a @property

* Fixed tests that supose .poller to be settable to None

* Test hub.pooler regeneration

* No need to regenerate poller on Redis if the Hub behaves nicely
2018-08-10 17:42:50 +06:00
tothegump 152923594f Add timeout to retry_over_time (#880)
add ut
2018-08-09 16:55:30 +03:00
Matt Yule-Bennett e2a59094c2 don't cache declaration of expiring queues (#884) 2018-08-09 16:49:34 +03:00
Bryan Shelton b0512725f6 Handle librabbitmq fileno socket not connected raising ValueError (#878)
* Handle librabbitmq fileno socket not connected raises ValueError

* Test client objects set to None

* Assert that librabbitmq's conn.fileno is called
2018-05-27 20:54:37 +06:00
Asif Saifuddin Auvi 629879b422
clened up redundant call of PY3 constants (#856) 2018-04-30 00:20:05 +06:00
Asif Saifuddin Auvi 491d7f389b
used unittest and remove unittest2 (#855) 2018-04-29 23:46:59 +06:00
Alex Hill f246a66bed Prevent spurious exception on Resource.resize(0) (#826)
* Prevent spurious exception on Resource.resize(0)

`Resource.resize()` raises an exception if the pool is in use and the new size is smaller than the old size. However, it also raises this exception when the new size is zero, which should correspond to disabling the pool. Instead of shrinking the pool to zero and releasing all resources, we can simply dequeue all resources and forget about them.

* Add test for removing pool limit when in use
2018-04-08 12:06:02 +06:00
Thomas Achtemichuk 75695205f6 Rename `async` keyword to `asynchronous` (#839)
* Rename `async` keyword to `asynchronous`

* Fixes #742
* Resolves "DeprecationWarning: 'async' and 'await' will become reserved
  keywords in Python 3.7"

* Address PR feedback

* Update appveyor config

* Rename docs and tests
2018-03-19 19:28:43 +02:00
John Koehl 39e733c143 Fixes #791 - SQS queue name gets mangled in Python 2.7 environment (#794)
* Fixes #791

* Changing to recommended patch by @georgepsarakis

* Revert "Fixes #791"

This reverts commit 5593505dd9.

* Updated to make tests pass

* Made _ensure_str a private function

* Code formatting for flake8

* Added a mock of the newstr and newbytes classes to create a failing test that simulates the issue with using python-future under 2.7.
2018-01-28 09:21:05 +02:00
Mads Jensen c13d91634d Removed an always true if-check in t/integration/transport.py (#827) 2018-01-27 11:22:49 +02:00
Arcadiy Ivanov 2f9eb53128 Virtual transport timeout does not supesede period polling (#689)
fixes #688
2018-01-13 22:39:34 +06:00
dust8 e209fa6f84 Fixed ValueError caused by mongodb rc version: invalid literal for in… (#816)
* Fixed ValueError caused by mongodb rc version: invalid literal for int () with base 10

* add test fix ValueError caused by mongodb rc version
2018-01-13 20:52:52 +06:00
Omer Katz 3a7cdb07c9
Make flake8 happy. 2017-12-17 12:15:42 +02:00
Mads Jensen 65d203c71e Prefer dict literal syntax over dict() (#787)
* Prefer dict literal syntax over dict()

* An overlooked dict-constructor in transport/SQS.py
2017-09-08 07:43:59 +03:00
David Davis 2a161a4408 Make messages durable by default in qpid (#785)
We were seeing messages disappear in durable queues when restarting
qpid. This coincides with the rabbitmq code (e.g. https://git.io/v7jNV).
2017-08-20 14:32:10 +03:00
Anthony Lukach 0f4da8d450 Pass connection options from broker_options to default_channel (#769)
* Pass connection options from broker_options to default_channel (fixes #765)

* Fixup

* Fixup
2017-08-02 12:06:47 +03:00
Anthony Lukach b1e6fa5bb1 Fix SQS requests and response handling (#754)
* Fix SQS requests and response handling

* Accurately portray empty message response
2017-07-17 18:22:40 +03:00
Gabriel Amram b2f2128928 Fix infinite loop in create_loop (#760)
* Fix infinite loop in create_loop

fixes https://github.com/celery/celery/issues/3712 

Before handling the todo items we "freeze" them by copying them aside and clearing the list.
This way if an item in the todo list appends a new callable to the list itself it will be taken care of in the next iteration of the parent loop instead of producing an infinite loop by adding it to the list we're running on.

* Changed the test to be aligned with the new implementation

* passing flake8

* Avoid copying results with each iteration of the async loop.

* Pop instead of slicing.

* fixed: todos -> todo, fixed test to use MagicMock so we can use the len() method

* MagicMock not supported in 2.7, implemented __len__ on Mock instead

* added entry to changelog
2017-07-10 21:21:49 +03:00