Get cancellation grace period correctly

This changes the logic of getting cancellation grace
period of task runner before closing it: to move the
liveness check into the cancel_all() method in the
scheduler rather than ask the resource if it's IN_PROGRESS.

Change-Id: Ia2a03de227ff15cdce1b3dbb6cd6bff6c5a50a15
Partial-Bug: 1693495
changes/87/477087/4
huangtianhua 5 years ago
parent 30c87bae3d
commit 8c62e96947
  1. 3
      heat/engine/resource.py
  2. 5
      heat/engine/scheduler.py

@ -1132,9 +1132,6 @@ class Resource(status.ResourceStatus):
properties.update_translation(rules, client_resolve=client_resolve)
def cancel_grace_period(self):
if self.status != self.IN_PROGRESS:
return None
canceller = getattr(self,
'handle_%s_cancel' % self.action.lower(),
None)

@ -472,7 +472,10 @@ class DependencyTaskGroup(object):
return grace_period
for k, r in six.iteritems(self._runners):
gp = get_grace_period(k)
if not r.started() or r.done():
gp = None
else:
gp = get_grace_period(k)
try:
r.cancel(grace_period=gp)
except Exception as ex:

Loading…
Cancel
Save