fix: conductor naming convention

- The conductor will now be named as a combination of the host's name +
  its operating process_id

Change-Id: I350d03a96c738aaa50eae704efeabcedbeb670ab
This commit is contained in:
Sriram Madapusi Vasudevan
2015-05-29 17:13:26 -04:00
parent ec669cbdc2
commit 8324fbb114
3 changed files with 9 additions and 5 deletions

View File

@@ -13,6 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import socket
from oslo.config import cfg
from poppy import bootstrap
@@ -25,6 +28,6 @@ LOG = log.getLogger(__name__)
def run():
conf = cfg.CONF
conf(project='poppy', prog='poppy', args=[])
conductor_name = '{0}-{1}'.format(socket.gethostname(), os.getpid())
b = bootstrap.Bootstrap(conf)
b.distributed_task.services_controller.run_task_worker()
b.distributed_task.services_controller.run_task_worker(name=conductor_name)

View File

@@ -91,7 +91,7 @@ class ServicesController(base.ServicesController):
details=job_details)
LOG.info("%s posted" % (job))
def run_task_worker(self):
def run_task_worker(self, name):
"""Run a task flow worker (conductor).
"""
@@ -102,7 +102,7 @@ class ServicesController(base.ServicesController):
persistence=persistence) as board:
conductor = NotifyingConductor(
"Poppy service worker conductor", board, persistence,
name, board, persistence,
engine='serial')
conductor.run()

View File

@@ -52,6 +52,7 @@ class TestServiceController(base.TestCase):
self.mock_persistence_n_board.post.assert_called()
def test_run_task_worker(self):
self.distributed_task_driver.services_controller.run_task_worker()
self.distributed_task_driver.services_controller.run_task_worker(
'poppy')
self.distributed_task_driver.persistence.assert_called()
self.distributed_task_driver.job_board.assert_called()