Timezone fix in the scheduler. (0.25.5)
This commit is contained in:
parent
2aa8e9e7f1
commit
dfcdd07a84
3 changed files with 9 additions and 11 deletions
|
|
@ -20,7 +20,7 @@ from linspector.environment import Environment
|
|||
from linspector.linspector import Linspector
|
||||
from linspector.monitors import Monitors
|
||||
|
||||
__version__ = '0.25.4'
|
||||
__version__ = '0.25.5'
|
||||
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ See LICENSE.
|
|||
import datetime
|
||||
import importlib
|
||||
import random
|
||||
import time
|
||||
|
||||
from apscheduler.executors.pool import ThreadPoolExecutor, ProcessPoolExecutor
|
||||
from apscheduler.jobstores.memory import MemoryJobStore
|
||||
|
|
@ -76,13 +77,10 @@ class Linspector:
|
|||
'max_instances': 1
|
||||
}
|
||||
|
||||
if configuration.get_option('linspector', 'timezone'):
|
||||
timezone = configuration.get_option('linspector', 'timezone')
|
||||
|
||||
self._scheduler['linspector'] = BackgroundScheduler(jobstores=jobstores,
|
||||
executors=executors,
|
||||
job_defaults=job_defaults,
|
||||
timezone=timezone)
|
||||
timezone=time.tzname[0])
|
||||
|
||||
start_date = datetime.datetime.now()
|
||||
log.debug(monitors.get_monitors())
|
||||
|
|
@ -111,7 +109,8 @@ class Linspector:
|
|||
'timezone')
|
||||
else:
|
||||
# set to local system timezone as default
|
||||
timezone = datetime.datetime.now(datetime.timezone.utc).astimezone().tzname()
|
||||
#timezone = datetime.datetime.now(datetime.timezone.utc).astimezone().tzname()
|
||||
timezone = time.tzname[0]
|
||||
|
||||
# add cron and one time run jobs to Linspector. not only "interval" jobs should be
|
||||
# supported.
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ class Monitor:
|
|||
implemented): 4
|
||||
"""
|
||||
try:
|
||||
notification_list = None
|
||||
if configuration.get_option('linspector', 'notifications') or \
|
||||
monitor_configuration.get('monitor', 'notifications'):
|
||||
|
||||
|
|
@ -91,10 +92,8 @@ class Monitor:
|
|||
notification_list = configuration.get_option('linspector', 'notifications')
|
||||
elif monitor_configuration.get('monitor', 'notifications'):
|
||||
notification_list = monitor_configuration.get('monitor', 'notifications')
|
||||
else:
|
||||
notification_list = None
|
||||
|
||||
self._notification_list = notification_list.split(',')
|
||||
self._notification_list = notification_list.split(',')
|
||||
|
||||
for notification_option in notification_list.split(','):
|
||||
if notification_option not in notifications:
|
||||
|
|
@ -180,5 +179,5 @@ class Monitor:
|
|||
def set_job(self, scheduler_job):
|
||||
self._scheduler_job = scheduler_job
|
||||
|
||||
def _str_(self):
|
||||
return str(self._dict_)
|
||||
def __str__(self):
|
||||
return str(self.__dict__)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue