diff options
Diffstat (limited to 'openstack')
-rw-r--r-- | openstack/common/service.py | 4 | ||||
-rw-r--r-- | openstack/common/setup.py | 11 | ||||
-rw-r--r-- | openstack/common/threadgroup.py | 8 |
3 files changed, 11 insertions, 12 deletions
diff --git a/openstack/common/service.py b/openstack/common/service.py index 6b180aa..48aeb9d 100644 --- a/openstack/common/service.py +++ b/openstack/common/service.py @@ -51,7 +51,7 @@ class Launcher(object): :returns: None """ - self._services = threadgroup.ThreadGroup('launcher') + self._services = threadgroup.ThreadGroup() eventlet_backdoor.initialize_if_enabled() @staticmethod @@ -310,7 +310,7 @@ class Service(object): """Service object for binaries running on hosts.""" def __init__(self, threads=1000): - self.tg = threadgroup.ThreadGroup('service', threads) + self.tg = threadgroup.ThreadGroup(threads) def start(self): pass diff --git a/openstack/common/setup.py b/openstack/common/setup.py index 087a954..403f9ee 100644 --- a/openstack/common/setup.py +++ b/openstack/common/setup.py @@ -34,11 +34,12 @@ def parse_mailmap(mailmap='.mailmap'): if os.path.exists(mailmap): with open(mailmap, 'r') as fp: for l in fp: - l = l.strip() - if not l.startswith('#') and ' ' in l: - canonical_email, alias = [x for x in l.split(' ') - if x.startswith('<')] - mapping[alias] = canonical_email + try: + canonical_email, alias = re.match( + r'[^#]*?(<.+>).*(<.+>).*', l).groups() + except AttributeError: + continue + mapping[alias] = canonical_email return mapping diff --git a/openstack/common/threadgroup.py b/openstack/common/threadgroup.py index 1f80fef..a87497f 100644 --- a/openstack/common/threadgroup.py +++ b/openstack/common/threadgroup.py @@ -38,8 +38,7 @@ class Thread(object): :class:`ThreadGroup`. The Thread will notify the :class:`ThreadGroup` when it has done so it can be removed from the threads list. """ - def __init__(self, name, thread, group): - self.name = name + def __init__(self, thread, group): self.thread = thread self.thread.link(_thread_done, group=group, thread=self) @@ -57,8 +56,7 @@ class ThreadGroup(object): when need be). * provide an easy API to add timers. """ - def __init__(self, name, thread_pool_size=10): - self.name = name + def __init__(self, thread_pool_size=10): self.pool = greenpool.GreenPool(thread_pool_size) self.threads = [] self.timers = [] @@ -72,7 +70,7 @@ class ThreadGroup(object): def add_thread(self, callback, *args, **kwargs): gt = self.pool.spawn(callback, *args, **kwargs) - th = Thread(callback.__name__, gt, self) + th = Thread(gt, self) self.threads.append(th) def thread_done(self, thread): |