diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2015-06-08 19:16:16 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@gmail.com> | 2015-06-18 22:00:16 -0700 |
commit | 40d19c7696f1e0b7d75eacbd271974ee9155c019 (patch) | |
tree | 53e126a75c2307364a4116f50d647ebefd3472b2 /taskflow/conductors | |
parent | 4f867db055eb74890dd1f46d104ea161a6bc84de (diff) | |
download | taskflow-40d19c7696f1e0b7d75eacbd271974ee9155c019.tar.gz |
Handle conductor ctrl-c more appropriately
When a conductor program is interrupted via ctrl-c
or equivalent it is much nicer log that that has happened
and to reraise that exception.
This also slightly tweaks the 99 bottles song to make it
even better, by having more pieces/tasks, which makes it
possible to kill the program during each task and see how
the resumption works when a flow is composed of segments.
Change-Id: I5d242eba9a043ef96646ba74ea5928daa0691ed0
Diffstat (limited to 'taskflow/conductors')
-rw-r--r-- | taskflow/conductors/backends/impl_blocking.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/taskflow/conductors/backends/impl_blocking.py b/taskflow/conductors/backends/impl_blocking.py index fb8a3c3..945f591 100644 --- a/taskflow/conductors/backends/impl_blocking.py +++ b/taskflow/conductors/backends/impl_blocking.py @@ -18,6 +18,7 @@ except ImportError: from contextlib2 import ExitStack # noqa from debtcollector import removals +from oslo_utils import excutils import six from taskflow.conductors import base @@ -151,6 +152,9 @@ class BlockingConductor(base.Conductor): consume = False try: f = self._dispatch_job(job) + except KeyboardInterrupt: + with excutils.save_and_reraise_exception(): + LOG.warn("Job dispatching interrupted: %s", job) except Exception: LOG.warn("Job dispatching failed: %s", job, exc_info=True) |