Some more scheduling config stuff in core/linspector.py.
This commit is contained in:
parent
36a2b62914
commit
118445404f
4 changed files with 26 additions and 9 deletions
|
|
@ -34,7 +34,7 @@ from linspector.core.monitors import Monitors
|
|||
|
||||
# i currently only increase the 3rd number because the goal is that 0.19 will become the first
|
||||
# stable version.
|
||||
__version__ = '0.19.21.dev1'
|
||||
__version__ = '0.19.22.dev1'
|
||||
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
||||
|
||||
logger = logging.getLogger('linspector')
|
||||
|
|
|
|||
|
|
@ -23,6 +23,12 @@ run_mode = cron
|
|||
members = superadmin@example.com,developers@example.com
|
||||
; scheduler configuration
|
||||
start_scheduler = true
|
||||
; the mode the scheduler should run. options are, process or thread. default is the thread mode. process mode will run
|
||||
; multiple processes, thread mode will run only one process with multiple threads. maybe this can be combined to run
|
||||
; multiple processes with multiple threads... dont know this actually but reading the APScheduler documentation will
|
||||
; explain this.... :) default is "thread" but Linspector will only run on one CPU core then. default threads are 1024
|
||||
; but this can be set much higher here.
|
||||
scheduler_mode = process
|
||||
max_threads = 3500
|
||||
; i recommend to set this to your number of cpu cores available when running on a dedicated linspector host. but if the
|
||||
; system is running other services you should lower this value when you have too high cpu load.
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class Configuration:
|
|||
self.__configuration.read(configuration_path + '/linspector.conf', 'utf-8')
|
||||
except Exception as err:
|
||||
raise Exception('something went wrong reading the configuration file '
|
||||
'linspector.ini in the configuration root path! ({0})'.format(err))
|
||||
'linspector.conf in the configuration root path! ({0})'.format(err))
|
||||
else:
|
||||
raise FileNotFoundError("configuration file linspector.ini not found in configuration "
|
||||
"root path!")
|
||||
|
|
|
|||
|
|
@ -45,14 +45,25 @@ class Linspector:
|
|||
jobstores = {
|
||||
'memory': MemoryJobStore()
|
||||
}
|
||||
executors = {
|
||||
'default': ThreadPoolExecutor(int(configuration.get_option('linspector',
|
||||
'max_threads'))),
|
||||
#'default': ProcessPoolExecutor(int(configuration.get_option('linspector',
|
||||
# 'max_processes')))
|
||||
}
|
||||
if configuration.get_option('linspector', 'max_threads') and not \
|
||||
configuration.get_option('linspector', 'scheduler_mode') == 'process':
|
||||
executors = {
|
||||
'default': ThreadPoolExecutor(int(configuration.get_option('linspector',
|
||||
'max_threads')))
|
||||
}
|
||||
else:
|
||||
executors = {
|
||||
'default': ThreadPoolExecutor(1024)
|
||||
}
|
||||
if configuration.get_option('linspector', 'scheduler_mode'):
|
||||
if configuration.get_option('linspector', 'scheduler_mode') == 'process':
|
||||
executors = {
|
||||
'default': ProcessPoolExecutor(int(configuration.get_option('linspector',
|
||||
'max_processes')))
|
||||
}
|
||||
job_defaults = {
|
||||
'max_instances': 10000
|
||||
# every scheduler job (monitor) must only exist once.
|
||||
'max_instances': 1
|
||||
}
|
||||
self.__scheduler['linspector'] = BackgroundScheduler(jobstores=jobstores,
|
||||
executors=executors,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue