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
(cherry picked from commit 8c62e96947
)
This commit is contained in:
parent
8cdf5473ac
commit
5034bc10af
@ -1062,9 +1062,6 @@ class Resource(object):
|
||||
)
|
||||
|
||||
def cancel_grace_period(self):
|
||||
if self.status != self.IN_PROGRESS:
|
||||
return None
|
||||
|
||||
canceller = getattr(self,
|
||||
'handle_%s_cancel' % self.action.lower(),
|
||||
None)
|
||||
|
@ -473,6 +473,9 @@ class DependencyTaskGroup(object):
|
||||
return grace_period
|
||||
|
||||
for k, r in six.iteritems(self._runners):
|
||||
if not r.started() or r.done():
|
||||
gp = None
|
||||
else:
|
||||
gp = get_grace_period(k)
|
||||
try:
|
||||
r.cancel(grace_period=gp)
|
||||
|
Loading…
Reference in New Issue
Block a user