From f26a5722a517611ddcdcc7712a51ef061698d17f Mon Sep 17 00:00:00 2001 From: Artur Stawiarski Date: Wed, 28 Oct 2015 21:15:01 +0000 Subject: [PATCH 1/4] "pyamqp" should be suggest way of defining the protocol for rabbitmq Kombu will try to use librabbitmq if available and when using nameko on standalone basis (without eventlet and monkey patching). This will throw exception due to incompatibility between the two. Using "pyamqp" instead of "amqp" will force Kombu to always use the pure Python implementation and not attempt to use librabbitmq. "amqp" is an alias for "pymyqp" anyway. --- docs/cli.rst | 2 +- docs/similar_projects.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/cli.rst b/docs/cli.rst index f5659065a..ecee0be11 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -25,7 +25,7 @@ and providing a simple YAML configuration file: # foobar.yaml - AMQP_URI: 'amqp://guest:guest@localhost' + AMQP_URI: 'pyamqp://guest:guest@localhost' WEB_SERVER_ADDRESS: '0.0.0.0:8000' diff --git a/docs/similar_projects.rst b/docs/similar_projects.rst index 69bd3307b..11530a4f0 100644 --- a/docs/similar_projects.rst +++ b/docs/similar_projects.rst @@ -20,4 +20,4 @@ Kombu `Kombu `_ is a Python messaging library, used by both Celery and Nameko. It exposes a high-level interface for AMQP and includes support for "virtual" transports, so can be run with non-AMQP transports such as Redis, ZeroMQ and MongoDB. -Nameko's AMQP features are built using Kombu but don't include support for the "virtual" transports. +Nameko's AMQP features are built using Kombu but don't include support for the "virtual" transports. Also, due to the usage of `eventlet `_ for green concurrency, Nameko can't make use of C extensions such as `librabbitmq `_ that Kombu uses by default. \ No newline at end of file From 89cfe463573eefb40164f1b41fe08a25e4f11b93 Mon Sep 17 00:00:00 2001 From: Artur Stawiarski Date: Thu, 5 Nov 2015 11:50:13 +0000 Subject: [PATCH 2/4] Added more information about eventlet and c-extensions to draw attention to possible problems --- docs/examples/standalone_events.py | 2 +- docs/examples/standalone_rpc.py | 2 +- docs/key_concepts.rst | 2 ++ docs/similar_projects.rst | 9 ++++++++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/examples/standalone_events.py b/docs/examples/standalone_events.py index d9703c6fb..3ee41b3e6 100644 --- a/docs/examples/standalone_events.py +++ b/docs/examples/standalone_events.py @@ -1,7 +1,7 @@ from nameko.standalone.events import event_dispatcher config = { - 'AMQP_URI': AMQP_URI # e.g. "amqp://guest:guest@localhost" + 'AMQP_URI': AMQP_URI # e.g. "pyamqp://guest:guest@localhost" } dispatch = event_dispatcher(config) diff --git a/docs/examples/standalone_rpc.py b/docs/examples/standalone_rpc.py index 52f5dc94b..2efedeb0a 100644 --- a/docs/examples/standalone_rpc.py +++ b/docs/examples/standalone_rpc.py @@ -1,7 +1,7 @@ from nameko.standalone.rpc import ClusterRpcProxy config = { - 'AMQP_URI': AMQP_URI # e.g. "amqp://guest:guest@localhost" + 'AMQP_URI': AMQP_URI # e.g. "pyamqp://guest:guest@localhost" } with ClusterRpcProxy(config) as cluster_rpc: diff --git a/docs/key_concepts.rst b/docs/key_concepts.rst index 2c59e0657..acd950357 100644 --- a/docs/key_concepts.rst +++ b/docs/key_concepts.rst @@ -82,6 +82,8 @@ Each worker executes in its own greenthread. The maximum number of concurrent wo Workers are stateless so are inherently thread safe, but dependencies should ensure they are unique per worker or otherwise safe to be accessed concurrently by multiple workers. +Unfortunately, many C-extensions that are using sockets and that would normally be considered thread-safe may not work with greenthreads. Among them `librabbitmq `_, `MySQLdb ` and others. + .. _extensions: Extensions diff --git a/docs/similar_projects.rst b/docs/similar_projects.rst index 11530a4f0..c9047e2e3 100644 --- a/docs/similar_projects.rst +++ b/docs/similar_projects.rst @@ -20,4 +20,11 @@ Kombu `Kombu `_ is a Python messaging library, used by both Celery and Nameko. It exposes a high-level interface for AMQP and includes support for "virtual" transports, so can be run with non-AMQP transports such as Redis, ZeroMQ and MongoDB. -Nameko's AMQP features are built using Kombu but don't include support for the "virtual" transports. Also, due to the usage of `eventlet `_ for green concurrency, Nameko can't make use of C extensions such as `librabbitmq `_ that Kombu uses by default. \ No newline at end of file +Nameko's AMQP features are built using Kombu but don't include support for the "virtual" transports. + +Also, due to the usage of `eventlet `_ for green concurrency, Nameko can't make use of C extensions such as `librabbitmq `_ that Kombu uses by default if it's available. If you want to have `librabbitmq `_ in your environment for other purposes than Nameko, you can force Kombu to use standard Python implementation of AMQP by defining broker urls as ``pyamqp://`` instead of ``amqp://`` + +Eventlet +-------- + +`Eventlet `_ is a Python library that provides concurrency via "greenthreads". You can check more details on how it's used by Nameko in :ref:`Concurrency ` section. \ No newline at end of file From eff6725c546e415a8f15dfd6a4ee54f903a22367 Mon Sep 17 00:00:00 2001 From: Artur Stawiarski Date: Thu, 5 Nov 2015 12:11:31 +0000 Subject: [PATCH 3/4] added missing words to spelling wordlist --- docs/similar_projects.rst | 2 +- docs/spelling_wordlist.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/similar_projects.rst b/docs/similar_projects.rst index c9047e2e3..14d74eb40 100644 --- a/docs/similar_projects.rst +++ b/docs/similar_projects.rst @@ -22,7 +22,7 @@ Kombu Nameko's AMQP features are built using Kombu but don't include support for the "virtual" transports. -Also, due to the usage of `eventlet `_ for green concurrency, Nameko can't make use of C extensions such as `librabbitmq `_ that Kombu uses by default if it's available. If you want to have `librabbitmq `_ in your environment for other purposes than Nameko, you can force Kombu to use standard Python implementation of AMQP by defining broker urls as ``pyamqp://`` instead of ``amqp://`` +Also, due to the usage of `eventlet `_ for green concurrency, Nameko can't make use of C-extensions such as `librabbitmq `_ that Kombu uses by default if it's available. If you want to have `librabbitmq `_ in your environment for other purposes than Nameko, you can force Kombu to use standard Python implementation of AMQP by defining broker urls as ``pyamqp://`` instead of ``amqp://`` Eventlet -------- diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index b77fb39cd..c1058ce7c 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -56,6 +56,7 @@ javascript kombu kwarg kwargs +librabbitmq lifealike lifecycle localhost @@ -72,6 +73,7 @@ mixin monolith monolithic monospaced +mysqldb nameko namespace onefinestay @@ -82,6 +84,7 @@ pre programmatically pseudocode py +pyamqp pyrabbit pytest rabbitmq From 4d1d1540171ebc6a0151dd26a0fb571a936295f4 Mon Sep 17 00:00:00 2001 From: Artur Stawiarski Date: Thu, 5 Nov 2015 12:25:08 +0000 Subject: [PATCH 4/4] added missing words to spelling wordlist --- docs/spelling_wordlist.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index c1058ce7c..6e3f1a279 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -33,6 +33,7 @@ deserialized deserializers deserializes deserializing +e entrypoint entrypoints eventlet @@ -41,6 +42,7 @@ freenode greenthread greenthreads homebrew +i init initialize initialized @@ -107,6 +109,7 @@ serialized serializers serializes serializing +shutdown specialization specialize specialized @@ -120,6 +123,7 @@ submodules subpackages teardown testability +timeouts traceback tracebacks tuple @@ -130,9 +134,11 @@ unregister unregistered unregisters utils +urls visualize visualized visualizing +vs webapp websocket websockets