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