Remove unused utility classes
Removing ThreadGroupExecutor allows to get rid of threading2 dependency. LastFedIter is also not used, so there is no reason to keep it. Change-Id: Id396ab59ebf1e2314ef620417d7cac09e1ab8d3b
This commit is contained in:
parent
11da620efd
commit
dd049eea69
@ -155,21 +155,6 @@ class TransitionNotifier(object):
|
||||
break
|
||||
|
||||
|
||||
class LastFedIter(object):
|
||||
"""An iterator which yields back the first item and then yields back
|
||||
results from the provided iterator.
|
||||
"""
|
||||
|
||||
def __init__(self, first, rest_itr):
|
||||
self.first = first
|
||||
self.rest_itr = rest_itr
|
||||
|
||||
def __iter__(self):
|
||||
yield self.first
|
||||
for i in self.rest_itr:
|
||||
yield i
|
||||
|
||||
|
||||
class Failure(object):
|
||||
"""Indicates failure"""
|
||||
# NOTE(imelnikov): flow_utils.FlowFailure uses runner, but
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
import logging
|
||||
import threading
|
||||
import threading2
|
||||
import time
|
||||
import types
|
||||
|
||||
@ -121,32 +120,6 @@ class CountDownLatch(object):
|
||||
return self.count <= 0
|
||||
|
||||
|
||||
class ThreadGroupExecutor(object):
|
||||
"""A simple thread executor that spins up new threads (or greenthreads) for
|
||||
each task to be completed (no pool limit is enforced).
|
||||
|
||||
TODO(harlowja): Likely if we use the more advanced executors that come with
|
||||
the concurrent.futures library we can just get rid of this.
|
||||
"""
|
||||
|
||||
def __init__(self, daemonize=True):
|
||||
self._threads = []
|
||||
self._group = threading2.ThreadGroup()
|
||||
self._daemonize = daemonize
|
||||
|
||||
def submit(self, fn, *args, **kwargs):
|
||||
t = threading2.Thread(target=fn, group=self._group,
|
||||
args=args, kwargs=kwargs)
|
||||
t.daemon = self._daemonize
|
||||
self._threads.append(t)
|
||||
t.start()
|
||||
|
||||
def await_termination(self, timeout=None):
|
||||
if not self._threads:
|
||||
return
|
||||
return self._group.join(timeout)
|
||||
|
||||
|
||||
class ThreadSafeMeta(type):
|
||||
"""Metaclass that adds locking to all pubic methods of a class"""
|
||||
|
||||
|
@ -7,7 +7,6 @@ sqlalchemy>=0.7,<=0.7.99
|
||||
alembic>=0.4.1
|
||||
# Very nice graph library
|
||||
networkx>=1.8.1
|
||||
threading2
|
||||
Babel>=0.9.6
|
||||
# Used for backend storage engine loading
|
||||
stevedore>=0.10
|
||||
|
Loading…
x
Reference in New Issue
Block a user