diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-09-27 20:08:12 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-09-27 20:08:12 +0000 |
commit | 7a2c40292207fdafc61834fb10d0ef50f79b5b6c (patch) | |
tree | 200bea7b7b60108428a4eaa9dd4dc0e0a03f6a58 | |
parent | 8046f567f89181213c23a2a0f11d3a6f7f6507c0 (diff) | |
parent | f8fbb30412edc41a1df05c7938db9dc973357f5c (diff) | |
download | taskflow-7a2c40292207fdafc61834fb10d0ef50f79b5b6c.tar.gz |
Merge "Mention issue with more than one thread and reduce workers"
-rw-r--r-- | taskflow/examples/wbe_simple_linear.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/taskflow/examples/wbe_simple_linear.py b/taskflow/examples/wbe_simple_linear.py index e28579f..bfec2d8 100644 --- a/taskflow/examples/wbe_simple_linear.py +++ b/taskflow/examples/wbe_simple_linear.py @@ -53,7 +53,12 @@ USE_FILESYSTEM = False BASE_SHARED_CONF = { 'exchange': 'taskflow', } -WORKERS = 2 + +# Until https://github.com/celery/kombu/issues/398 is resolved it is not +# recommended to run many worker threads in this example due to the types +# of errors mentioned in that issue. +MEMORY_WORKERS = 2 +FILE_WORKERS = 1 WORKER_CONF = { # These are the tasks the worker can execute, they *must* be importable, # typically this list is used to restrict what workers may execute to @@ -90,6 +95,7 @@ if __name__ == "__main__": tmp_path = None if USE_FILESYSTEM: + worker_count = FILE_WORKERS tmp_path = tempfile.mkdtemp(prefix='wbe-example-') shared_conf.update({ 'transport': 'filesystem', @@ -100,6 +106,7 @@ if __name__ == "__main__": }, }) else: + worker_count = MEMORY_WORKERS shared_conf.update({ 'transport': 'memory', 'transport_options': { @@ -115,8 +122,8 @@ if __name__ == "__main__": try: # Create a set of workers to simulate actual remote workers. - print('Running %s workers.' % (WORKERS)) - for i in range(0, WORKERS): + print('Running %s workers.' % (worker_count)) + for i in range(0, worker_count): worker_conf['topic'] = 'worker-%s' % (i + 1) worker_topics.append(worker_conf['topic']) w = worker.Worker(**worker_conf) |