added hook for optional history writer
- activated with envrionment variable FRAPPY_HISTORY - using the (currently) private package 'frappyhistory' Change-Id: I8f747b29d8311af677ed77268a4c38c8d71b08c2 Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25064 Tested-by: Markus Zolliker <markus.zolliker@psi.ch> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
@ -33,6 +33,7 @@ from collections import OrderedDict
|
||||
from secop.errors import ConfigError
|
||||
from secop.lib import formatException, get_class, getGeneralConfig
|
||||
from secop.modules import Attached
|
||||
from secop.params import PREDEFINED_ACCESSIBLES
|
||||
|
||||
try:
|
||||
from daemon import DaemonContext
|
||||
@ -43,7 +44,6 @@ try:
|
||||
except ImportError:
|
||||
DaemonContext = None
|
||||
|
||||
|
||||
try:
|
||||
import systemd.daemon
|
||||
except ImportError:
|
||||
@ -273,3 +273,10 @@ class Server:
|
||||
if not event.wait(timeout=max(0, deadline - time.time())):
|
||||
self.log.info('WARNING: timeout when starting %s' % name)
|
||||
self.log.info('all modules and pollers started')
|
||||
history_path = os.environ.get('FRAPPY_HISTORY')
|
||||
if history_path:
|
||||
from secop.historywriter import FrappyHistoryWriter # pylint: disable=import-outside-toplevel
|
||||
writer = FrappyHistoryWriter(history_path, PREDEFINED_ACCESSIBLES.keys(), self.dispatcher)
|
||||
# treat writer as a connection
|
||||
self.dispatcher.add_connection(writer)
|
||||
writer.init(self.dispatcher.handle_describe(writer, None, None))
|
||||
|
Reference in New Issue
Block a user