Commit 9f47484d authored by mvdbeek's avatar mvdbeek Committed by Chabrier Patrick
Browse files

Register job monitor as postfork function

parent 4a345b99
......@@ -209,7 +209,7 @@ class JobHandlerQueue(Monitors):
try:
# If jobs are locked, there's nothing to monitor and we skip
# to the sleep.
if not self.app.job_manager.job_lock:
if hasattr(self.app, 'job_manager') and not self.app.job_manager.job_lock:
self.__monitor_step()
except Exception:
log.exception("Exception in monitor_step")
......
......@@ -3,6 +3,7 @@ from __future__ import absolute_import
import logging
import threading
from galaxy.web.stack import register_postfork_function
from .sleeper import Sleeper
log = logging.getLogger(__name__)
......@@ -27,7 +28,11 @@ class Monitors(object):
self.sleeper = Sleeper()
self.monitor_thread = threading.Thread(name=name, target=monitor_func)
self.monitor_thread.setDaemon(True)
if start:
self._start = start
register_postfork_function(self.start_monitoring)
def start_monitoring(self):
if self._start:
self.monitor_thread.start()
def stop_monitoring(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment