Browse Source

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
Zane Bitter 4 months ago
parent
commit
fef1c1543b

+ 6
- 0
oslo_service/threadgroup.py View File

@@ -16,6 +16,7 @@ import logging
16 16
 import threading
17 17
 import warnings
18 18
 
19
+from debtcollector import removals
19 20
 import eventlet
20 21
 from eventlet import greenpool
21 22
 
@@ -374,9 +375,14 @@ class ThreadGroup(object):
374 375
                 return True
375 376
         return False
376 377
 
378
+    @removals.remove(removal_version='?')
377 379
     def cancel(self, *throw_args, **kwargs):
378 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 386
         If called without the ``timeout`` argument, this does **not** stop any
381 387
         running threads, but prevents any threads in the group that have not
382 388
         yet started from running, then returns immediately. Timers are not

+ 5
- 0
releasenotes/notes/threadgroup-cancel-bd89d72f383a3d9b.yaml View File

@@ -0,0 +1,5 @@
1
+---
2
+deprecations:
3
+  - |
4
+    The ``ThreadGroup.cancel()`` method is deprecated and will be removed in a
5
+    future major release.

+ 1
- 0
requirements.txt View File

@@ -3,6 +3,7 @@
3 3
 # process, which may cause wedges in the gate later.
4 4
 
5 5
 WebOb>=1.7.1 # MIT
6
+debtcollector>=1.2.0 # Apache 2.0
6 7
 eventlet!=0.18.3,!=0.20.1,>=0.18.2 # MIT
7 8
 fixtures>=3.0.0 # Apache-2.0/BSD
8 9
 greenlet>=0.4.10 # MIT

Loading…
Cancel
Save