summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZane Bitter <zbitter@redhat.com>2018-12-12 19:53:11 +1300
committerZane Bitter <zbitter@redhat.com>2018-12-20 11:11:23 +1300
commitfef1c1543b03aebac1141dc03248eff5b537fb95 (patch)
treebae057a667b72a62b1dcffd5689939d0cbd0c8b3
parentfdd65ed5e985f206e19342d97494f0868798d0e6 (diff)
Deprecate the ThreadGroup.cancel() API
This API is awkward, inefficient, incoherent, and unintuitive. The bug fix for which it was originally added was abandoned in favour of a different approach, so it was never used. It appears that no consumers are currently calling it. It would be best if none started. Add a deprecation warning to discourage its use and allow us to remove it altogether at some point in the future. Change-Id: I9559c7051024019fac957385faced645920b815c
Notes
Notes (review): Code-Review+2: Stephen Finucane <stephenfin@redhat.com> Code-Review+2: Ben Nemec <openstack@nemebean.com> Workflow+1: Ben Nemec <openstack@nemebean.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 20 Dec 2018 15:49:33 +0000 Reviewed-on: https://review.openstack.org/624595 Project: openstack/oslo.service Branch: refs/heads/master
-rw-r--r--oslo_service/threadgroup.py6
-rw-r--r--releasenotes/notes/threadgroup-cancel-bd89d72f383a3d9b.yaml5
-rw-r--r--requirements.txt1
3 files changed, 12 insertions, 0 deletions
diff --git a/oslo_service/threadgroup.py b/oslo_service/threadgroup.py
index e57efb5..51a0711 100644
--- a/oslo_service/threadgroup.py
+++ b/oslo_service/threadgroup.py
@@ -16,6 +16,7 @@ import logging
16import threading 16import threading
17import warnings 17import warnings
18 18
19from debtcollector import removals
19import eventlet 20import eventlet
20from eventlet import greenpool 21from eventlet import greenpool
21 22
@@ -374,9 +375,14 @@ class ThreadGroup(object):
374 return True 375 return True
375 return False 376 return False
376 377
378 @removals.remove(removal_version='?')
377 def cancel(self, *throw_args, **kwargs): 379 def cancel(self, *throw_args, **kwargs):
378 """Cancel unstarted threads in the group, and optionally stop the rest. 380 """Cancel unstarted threads in the group, and optionally stop the rest.
379 381
382 .. warning::
383 This method is deprecated and should not be used. It will be
384 removed in a future release.
385
380 If called without the ``timeout`` argument, this does **not** stop any 386 If called without the ``timeout`` argument, this does **not** stop any
381 running threads, but prevents any threads in the group that have not 387 running threads, but prevents any threads in the group that have not
382 yet started from running, then returns immediately. Timers are not 388 yet started from running, then returns immediately. Timers are not
diff --git a/releasenotes/notes/threadgroup-cancel-bd89d72f383a3d9b.yaml b/releasenotes/notes/threadgroup-cancel-bd89d72f383a3d9b.yaml
new file mode 100644
index 0000000..b37c925
--- /dev/null
+++ b/releasenotes/notes/threadgroup-cancel-bd89d72f383a3d9b.yaml
@@ -0,0 +1,5 @@
1---
2deprecations:
3 - |
4 The ``ThreadGroup.cancel()`` method is deprecated and will be removed in a
5 future major release.
diff --git a/requirements.txt b/requirements.txt
index 4afebff..ecca359 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -3,6 +3,7 @@
3# process, which may cause wedges in the gate later. 3# process, which may cause wedges in the gate later.
4 4
5WebOb>=1.7.1 # MIT 5WebOb>=1.7.1 # MIT
6debtcollector>=1.2.0 # Apache 2.0
6eventlet!=0.18.3,!=0.20.1,>=0.18.2 # MIT 7eventlet!=0.18.3,!=0.20.1,>=0.18.2 # MIT
7fixtures>=3.0.0 # Apache-2.0/BSD 8fixtures>=3.0.0 # Apache-2.0/BSD
8greenlet>=0.4.10 # MIT 9greenlet>=0.4.10 # MIT