]> jspc29.x-matter.uni-frankfurt.de Git - mvdsensorcontrol.git/commitdiff
epics_log.py → also log LAST_RUN:{UNIX,ISO}
authorMaps <maps@ikf>
Thu, 22 Aug 2019 13:14:13 +0000 (15:14 +0200)
committerMaps <maps@ikf>
Thu, 22 Aug 2019 13:14:13 +0000 (15:14 +0200)
tools/epics_log.py

index f529bdb650b6ad54be53cdd7a066726b1de2139e..724a0109ea9d40447c2dd3dc490371ba9724b94d 100755 (executable)
@@ -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)