Commit d012dd24 authored by pm22d12's avatar pm22d12
Browse files

Fix #48

parent 74a658b3
......@@ -10,6 +10,8 @@
# message_broker: null
# --
# send_notification_messages: false
# --
# ui_worker: false
# --- Folder paths
# paths:
......
......@@ -22,6 +22,7 @@ class GlobalConfig(object):
max_activated_files_by_loop: 100
message_broker: null
send_notification_messages: false
ui_worker: false
paths:
workspace: /tmp/downloader/workspace
appdata: /srv/downloader/
......
......@@ -276,11 +276,14 @@ class Scheduler(object):
self.updateAndReadProviderConfig()
# init the UI worker
try:
self.__workerUI = WorkerUI(Controller.SCHD_LOGGER_NAME, self.__globalConfig, options.verbose)
except BaseException:
self._log.exception("Bad UI worker config")
sys.exit(EXIT_BAD_CONFIG)
if self.__globalConfig["general.ui_worker"]:
try:
self.__workerUI = WorkerUI(Controller.SCHD_LOGGER_NAME, self.__globalConfig, options.verbose)
except BaseException:
self._log.exception("Bad UI worker config")
sys.exit(EXIT_BAD_CONFIG)
else:
self._log.debug("Start downloader without UI worker")
# Init signal handler
self.initSignalTrap()
......@@ -310,7 +313,8 @@ class Scheduler(object):
self.configSummary(logging.INFO)
# start the UI worker thread
self.__workerUI.start()
if self.__globalConfig["general.ui_worker"]:
self.__workerUI.start()
# start the download threads
for d in self.__downloads:
......@@ -883,11 +887,12 @@ class Scheduler(object):
d.join(join_timeout)
# terminate the UI worker
if self.__workerUI.isAlive():
self._log.debug("workerUI is alive")
self.__workerUI.join(join_timeout)
else:
threading.Thread.join(self.__workerUI, join_timeout)
if self.__globalConfig["general.ui_worker"]:
if self.__workerUI.isAlive():
self._log.debug("workerUI is alive")
self.__workerUI.join(join_timeout)
else:
threading.Thread.join(self.__workerUI, join_timeout)
self.cleanEndingSubProcess(nowait=False)
self.cleanJobFile()
......
# distribution
wheel>=0.32.2 #MIT
twine>=1.12.1 # Apache-2.0
# quality
pylint
autopep8
# test
pytest
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