Avoid blocking on subprocess during rug shutdown
Currently the rug cannot be cleanly killed. It looks like its blocking on some un-terminated sub-processes. This ensures that the rug api is terminated on shutdown, and also stops the notification publisher. Change-Id: I4a69f8a7e410e39c3abea4b3f2fdb8813814177b Closes-bug: #1451949
This commit is contained in:
parent
cdf2411115
commit
67f9a1b223
|
@ -26,7 +26,7 @@ import threading
|
|||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
|
||||
from akanda.rug.common.i18n import _, _LE, _LI
|
||||
from akanda.rug.common.i18n import _LE, _LI
|
||||
from akanda.rug.common import config as ak_cfg
|
||||
from akanda.rug import daemon
|
||||
from akanda.rug import health
|
||||
|
@ -196,12 +196,12 @@ def main(argv=sys.argv[1:]):
|
|||
try:
|
||||
shuffle_notifications(notification_queue, sched)
|
||||
finally:
|
||||
# Terminate the scheduler and its workers
|
||||
LOG.info(_LI('stopping processing'))
|
||||
LOG.info(_LI('Stopping scheduler.'))
|
||||
sched.stop()
|
||||
# Terminate the listening process
|
||||
LOG.debug(_('stopping %s'), notification_proc.name)
|
||||
notification_proc.terminate()
|
||||
LOG.debug(_('stopping %s'), metadata_proc.name)
|
||||
metadata_proc.terminate()
|
||||
LOG.info(_LI('exiting'))
|
||||
LOG.info(_LI('Stopping notification publisher.'))
|
||||
publisher.stop()
|
||||
|
||||
# Terminate the subprocesses
|
||||
for subproc in [notification_proc, metadata_proc, rug_api_proc]:
|
||||
LOG.info(_LI('Stopping %s.'), subproc.name)
|
||||
subproc.terminate()
|
||||
|
|
|
@ -80,7 +80,7 @@ class TestMainPippo(base.RugTestBase):
|
|||
spec=ak_notifications.NoopPublisher)
|
||||
main.main(argv=self.argv)
|
||||
self.assertEqual(len(notifications.Publisher.mock_calls), 0)
|
||||
self.assertEqual(len(notifications.NoopPublisher.mock_calls), 1)
|
||||
self.assertEqual(len(notifications.NoopPublisher.mock_calls), 2)
|
||||
|
||||
@mock.patch('akanda.rug.main.shuffle_notifications')
|
||||
def test_ceilometer_enabled(self, shuffle_notifications, health,
|
||||
|
@ -91,7 +91,7 @@ class TestMainPippo(base.RugTestBase):
|
|||
notifications.NoopPublisher = mock.Mock(
|
||||
spec=ak_notifications.NoopPublisher)
|
||||
main.main(argv=self.argv)
|
||||
self.assertEqual(len(notifications.Publisher.mock_calls), 1)
|
||||
self.assertEqual(len(notifications.Publisher.mock_calls), 2)
|
||||
self.assertEqual(len(notifications.NoopPublisher.mock_calls), 0)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue