]> review.fuel-infra Code Review - openstack-build/heat-build.git/commit
Add a wrappertask decorator
authorZane Bitter <zbitter@redhat.com>
Tue, 7 May 2013 13:10:10 +0000 (15:10 +0200)
committerZane Bitter <zbitter@redhat.com>
Tue, 7 May 2013 13:10:10 +0000 (15:10 +0200)
commit772f8b9e812ced3fe21425870bcde3b765cd73ab
tree9550b270b7ed360adc17c87b6aacff2939f64de3
parent3d21cdb263c14a06c14208169e72d565fc0424d5
Add a wrappertask decorator

It is common that we might want to create a task that is a light wrapper
around another task. This allows us to, for example, call some clean-up
function after a PollingTaskGroup has completed. We really want to make
sure that any exceptions caused by timeout or cancellation get passed on to
the subtask as well.

Python 3 sports the "yield from" keyword (PEP 380) that effectively allows
the sort of nesting of generators that we want to do here. This change
provides a decorator function that allows the decorated generator function
to do the same thing using the "yield" keyword, even in Python 2.

Change-Id: I110141f2891ed35b8ffe98ec6ae8b42738f7db64
heat/engine/scheduler.py
heat/tests/test_scheduler.py