From 33f4bdfef0df0db876fcebc98734240c18b98c4e Mon Sep 17 00:00:00 2001 From: Feodor Tersin Date: Thu, 3 Sep 2015 09:09:52 +0300 Subject: [PATCH] Replace local cpu_count with processutils.get_worker_count This function was added to oslo_concurrency, therefore there is no reason for ec2api to have its own one. Change-Id: I0947883b60df8b820534a9f044ec93b06a6f3dfc --- ec2api/service.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/ec2api/service.py b/ec2api/service.py index bad8ec58..3a11b812 100644 --- a/ec2api/service.py +++ b/ec2api/service.py @@ -14,8 +14,7 @@ """Generic Node base class for all workers that run on hosts.""" -import multiprocessing - +from oslo_concurrency import processutils from oslo_config import cfg from oslo_log import log as logging from oslo_utils import importutils @@ -80,7 +79,7 @@ class WSGIService(object): self.port = getattr(CONF, '%s_listen_port' % name, 0) self.use_ssl = getattr(CONF, '%s_use_ssl' % name, False) self.workers = (getattr(CONF, '%s_workers' % name, None) or - self.cpu_count()) + processutils.get_worker_count()) if self.workers and self.workers < 1: worker_name = '%s_workers' % name msg = (_("%(worker_name)s value of %(workers)s is invalid, " @@ -105,12 +104,6 @@ class WSGIService(object): """ self.server.reset() - def cpu_count(self): - try: - return multiprocessing.cpu_count() - except NotImplementedError: - return 1 - def _get_manager(self): """Initialize a Manager object appropriate for this service.