proper logging, add signal handler for graceful termination
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import time
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from configparser import ConfigParser
|
||||
from sehistory.influx import InfluxDBWrapper, abs_range, round_range, Table
|
||||
@ -400,7 +401,7 @@ class SEHistory(InfluxDBWrapper):
|
||||
if prevts is not None and (previns is None or (ts or ETERNITY) < prevts):
|
||||
ts = prevts + 0.001
|
||||
except Exception as e:
|
||||
print(f'Exception in get_instrument {e!r}')
|
||||
logging.warning('Exception in get_instrument: %r', e)
|
||||
tags['stream'] = stream
|
||||
if flag:
|
||||
tags['instrument'] = instrument
|
||||
@ -417,8 +418,7 @@ class SEHistory(InfluxDBWrapper):
|
||||
ts, flag = table[-1][:2]
|
||||
if flag:
|
||||
addtags = {k: v for k, v in table.tags.items()
|
||||
if k not in {'instrument', '_measurement', '_field'}}
|
||||
print(ts, addtags)
|
||||
if k not in {'instrument', '_measurement', '_field'}}
|
||||
self._add_point('_stream_', 'on', False, ts + 0.001,
|
||||
addtags)
|
||||
self.flush()
|
||||
|
Reference in New Issue
Block a user