summaryrefslogtreecommitdiff
path: root/taskflow/utils
diff options
context:
space:
mode:
authorGreg Hill <greg.hill@rackspace.com>2015-11-10 19:42:37 -0600
committerJoshua Harlow <harlowja@yahoo-inc.com>2015-11-17 17:03:41 -0800
commitcd922d4e466f27a470208ceba4beb8c1f4da2db3 (patch)
tree5bbc130d0648a66f79a88a7f8bf42c0103a2fc8d /taskflow/utils
parent805ce7e909eacd9e383eb708726d7674cf4dbae0 (diff)
downloadtaskflow-cd922d4e466f27a470208ceba4beb8c1f4da2db3.tar.gz
Add optional 'defer_reverts' behavior
This makes it possible to REVERT a subflow and have it also revert the parent flow if the parent flow doesn't have its own retry strategy. We will probably want to make this new behavior the default or only behavior in a future release. Change-Id: Iea5ac366380ba7396a87d0185703549fb0c2f825
Diffstat (limited to 'taskflow/utils')
-rw-r--r--taskflow/utils/misc.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/taskflow/utils/misc.py b/taskflow/utils/misc.py
index ca8faa5..e837a42 100644
--- a/taskflow/utils/misc.py
+++ b/taskflow/utils/misc.py
@@ -595,3 +595,11 @@ def is_iterable(obj):
"""
return (not isinstance(obj, six.string_types) and
isinstance(obj, collections.Iterable))
+
+
+def ensure_dict(obj):
+ """Copy an existing dictionary or default to empty dict...."""
+ if not obj:
+ return {}
+ # default to a shallow copy to avoid most ownership issues
+ return dict(obj)