diff options
| author | Stanislav Kudriashev <skudriashev@griddynamics.com> | 2013-12-19 17:48:06 +0200 |
|---|---|---|
| committer | Stanislav Kudriashev <skudriashev@griddynamics.com> | 2014-02-19 14:50:49 +0200 |
| commit | 082b5c54d50c0c15146222f42f20c1e30661c111 (patch) | |
| tree | c8faeb4b056ebdb4f87446667affb3f5de0d66aa /taskflow/examples/wrapped_exception.py | |
| parent | 32e8c3da61b0dea2ffbbdd96f2c97c11fe8f3323 (diff) | |
| download | taskflow-082b5c54d50c0c15146222f42f20c1e30661c111.tar.gz | |
Run action-engine tests with worker-based engine
Change-Id: I00398fd2387b261c577f5d3eba9e2aebae3ba165
Diffstat (limited to 'taskflow/examples/wrapped_exception.py')
| -rw-r--r-- | taskflow/examples/wrapped_exception.py | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/taskflow/examples/wrapped_exception.py b/taskflow/examples/wrapped_exception.py index cf1d8f7..b2be032 100644 --- a/taskflow/examples/wrapped_exception.py +++ b/taskflow/examples/wrapped_exception.py @@ -16,7 +16,6 @@ # License for the specific language governing permissions and limitations # under the License. -import contextlib import logging import os import sys @@ -36,6 +35,7 @@ import taskflow.engines from taskflow import exceptions from taskflow.patterns import unordered_flow as uf from taskflow import task +from taskflow.tests import utils from taskflow.utils import misc # INTRO: In this example we create two tasks which can trigger exceptions @@ -62,20 +62,6 @@ def print_wrapped(text): print("-" * (len(text))) -@contextlib.contextmanager -def wrap_all_failures(): - """Convert any exceptions to WrappedFailure. - - When you expect several failures, it may be convenient - to wrap any exception with WrappedFailure in order to - unify error handling. - """ - try: - yield - except Exception: - raise exceptions.WrappedFailure([misc.Failure()]) - - class FirstException(Exception): """Exception that first task raises.""" @@ -112,7 +98,7 @@ def run(**store): SecondTask() ) try: - with wrap_all_failures(): + with utils.wrap_all_failures(): taskflow.engines.run(flow, store=store, engine_conf='parallel') except exceptions.WrappedFailure as ex: |
