Instantiate logger per process.

Using the logger instance that was created by the master process,
caused deadlocks by processes trying to write log messages.
This is here solved, by instantiating only after child process starts.

Change-Id: I57384fa970c15f78bee67851da089db4731ccbf8
Story: 2005817
Task: 33561
This commit is contained in:
Idan Hefetz 2019-06-02 11:15:23 +00:00
parent 42300efadf
commit dfd0cc9d1e

View File

@ -45,7 +45,7 @@ from vitrage import messaging
from vitrage import rpc as vitrage_rpc
from vitrage import storage
LOG = log.getLogger(__name__)
LOG = None
# Supported message types
WAIT_FOR_WORKER_START = 'wait_for_worker_start'
@ -163,8 +163,10 @@ class GraphWorkersManager(cotyledon.ServiceManager):
So that new/deleted templates are added/removed
"""
LOG.info("Worker processes - starting...")
self._submit_and_wait(self._all_queues, (WAIT_FOR_WORKER_START,))
global LOG
if not LOG:
LOG = log.getLogger(__name__)
LOG.info("Worker processes - ready!")
def submit_template_event(self, event):
@ -232,6 +234,9 @@ class GraphCloneWorkerBase(coord.Service):
raise NotImplementedError
def run(self):
global LOG
if not LOG:
LOG = log.getLogger(__name__)
super(GraphCloneWorkerBase, self).run()
self._entity_graph.notifier._subscriptions = [] # Quick n dirty
self._init_instance()