From: Maps Date: Thu, 22 Aug 2019 13:14:13 +0000 (+0200) Subject: epics_log.py → also log LAST_RUN:{UNIX,ISO} X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=c28ec891e27d3854e27a0f1b98660bcd1255e438;p=mvdsensorcontrol.git epics_log.py → also log LAST_RUN:{UNIX,ISO} --- diff --git a/tools/epics_log.py b/tools/epics_log.py index f529bdb..724a010 100755 --- a/tools/epics_log.py +++ b/tools/epics_log.py @@ -6,7 +6,8 @@ if called manually, this script was called like this: ./epics_log.py /local.1/htdocs/mvdconfig/setup/PRESTO_2018_readout.xml --epics-ca-addr-list 192.168.10.46 """ -import argparse, sys, os +import argparse, sys, os, time +from datetime import datetime as dt # external dependencies import lxml.etree # (OpenSuse package: python3-lxml) import caproto # (No OpenSuse package / pip install caproto) @@ -53,7 +54,7 @@ def caput_many(pvlist, values): # VARIANT caproto threaded client Batch mode import caproto.threading.client - import time, functools + import functools ctx = caproto.threading.client.Context(timeout=context_timeout) pvs = ctx.get_pvs(*pvlist) start = time.time() @@ -149,6 +150,8 @@ try: pv = f"{args.pv_prefix}SENSOR:{name}:{fname}" updates.append((pv, value)) eprint(section_divider) + updates.append((f"{args.pv_prefix}LAST_RUN:UNIX", time.time())) + updates.append((f"{args.pv_prefix}LAST_RUN:ISO", dt.utcnow().replace(microsecond=0).isoformat()+'Z')) pvs = [update[0] for update in updates] values = [update[1] for update in updates] results = caput_many(pvs, values)