move sehistory specific stuff from influx.py to seinflux.py

This commit is contained in:
2025-02-26 10:39:54 +01:00
parent 78ceecbb53
commit 258ab809a9
7 changed files with 317 additions and 257 deletions

View File

@ -32,9 +32,12 @@ def short_hostname(host):
- treat case where -129129xxxx is appended
"""
host = socket.gethostbyaddr(host)[0]
match = re.match(r'([^.-]+)(?:-129129\d{6}|(-[~.]*|)).psi.ch', host)
if match:
host = match.group(1) + (match.group(2) or '')
if host == 'localhost':
host = socket.gethostname()
else:
match = re.match(r'([^.-]+)(?:-129129\d{6}|(-[~.]*|)).psi.ch', host)
if match:
host = match.group(1) + (match.group(2) or '')
return host
@ -246,8 +249,9 @@ class EventStream:
# note: a stream with buffered content might not be ready to emit any event, because
# of filtering
def __init__(self, *udp, **streams):
def __init__(self, *udp, instrument=None, **streams):
self.streams = streams
self.instrument = instrument
self.udp = {v.socket.fileno(): v for v in udp}
def wait_ready(self, timeout):