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:
@@ -13,6 +13,9 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import os
|
||||||
|
import socket
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from poppy import bootstrap
|
from poppy import bootstrap
|
||||||
@@ -25,6 +28,6 @@ LOG = log.getLogger(__name__)
|
|||||||
def run():
|
def run():
|
||||||
conf = cfg.CONF
|
conf = cfg.CONF
|
||||||
conf(project='poppy', prog='poppy', args=[])
|
conf(project='poppy', prog='poppy', args=[])
|
||||||
|
conductor_name = '{0}-{1}'.format(socket.gethostname(), os.getpid())
|
||||||
b = bootstrap.Bootstrap(conf)
|
b = bootstrap.Bootstrap(conf)
|
||||||
b.distributed_task.services_controller.run_task_worker()
|
b.distributed_task.services_controller.run_task_worker(name=conductor_name)
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class ServicesController(base.ServicesController):
|
|||||||
details=job_details)
|
details=job_details)
|
||||||
LOG.info("%s posted" % (job))
|
LOG.info("%s posted" % (job))
|
||||||
|
|
||||||
def run_task_worker(self):
|
def run_task_worker(self, name):
|
||||||
"""Run a task flow worker (conductor).
|
"""Run a task flow worker (conductor).
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -102,7 +102,7 @@ class ServicesController(base.ServicesController):
|
|||||||
persistence=persistence) as board:
|
persistence=persistence) as board:
|
||||||
|
|
||||||
conductor = NotifyingConductor(
|
conductor = NotifyingConductor(
|
||||||
"Poppy service worker conductor", board, persistence,
|
name, board, persistence,
|
||||||
engine='serial')
|
engine='serial')
|
||||||
|
|
||||||
conductor.run()
|
conductor.run()
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ class TestServiceController(base.TestCase):
|
|||||||
self.mock_persistence_n_board.post.assert_called()
|
self.mock_persistence_n_board.post.assert_called()
|
||||||
|
|
||||||
def test_run_task_worker(self):
|
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.persistence.assert_called()
|
||||||
self.distributed_task_driver.job_board.assert_called()
|
self.distributed_task_driver.job_board.assert_called()
|
||||||
|
|||||||
Reference in New Issue
Block a user