From e9dfb10c2c08b73e4c5610f91bacb5c083e23ce5 Mon Sep 17 00:00:00 2001 From: Changbin Liu Date: Wed, 5 Feb 2014 16:34:59 -0500 Subject: [PATCH] Add ZooKeeper backend to examples Change-Id: I8c9408465392307ede2ff61e0524700e4c51ccad --- taskflow/examples/example_utils.py | 6 ++++++ taskflow/examples/resume_from_backend.py | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/taskflow/examples/example_utils.py b/taskflow/examples/example_utils.py index d3069db6..a8dedbdf 100644 --- a/taskflow/examples/example_utils.py +++ b/taskflow/examples/example_utils.py @@ -61,6 +61,12 @@ def _make_conf(backend_uri): 'path': parsed_url.path, 'connection': backend_uri, } + elif backend_type in ('zookeeper',): + conf = { + 'path': parsed_url.path, + 'hosts': parsed_url.netloc, + 'connection': backend_uri, + } else: conf = { 'connection': backend_uri, diff --git a/taskflow/examples/resume_from_backend.py b/taskflow/examples/resume_from_backend.py index dece074c..d9ebe712 100644 --- a/taskflow/examples/resume_from_backend.py +++ b/taskflow/examples/resume_from_backend.py @@ -44,6 +44,19 @@ import example_utils # noqa # to start an engine, have a task stop the engine from doing future work (if # a multi-threaded engine is being used, then the currently active work is not # preempted) and then resume the work later. +# +# Usage: +# +# With a filesytem directory as backend +# +# python taskflow/examples/resume_from_backend.py +# +# With ZooKeeper as backend +# +# python taskflow/examples/resume_from_backend.py \ +# zookeeper://127.0.0.1:2181/taskflow/resume_from_backend/ +# + ### UTILITY FUNCTIONS #########################################