def cmd(archive=None, opt=None, args=None, conf=None, breakDown=None, **kws): if opt.how=='raw': op = archive.fetchraw elif opt.how=='plot': op = archive.fetchplot else: raise ValueError('Unknown plot type %s'%opt.how) archs=opt.archive if len(args)==0: print 'Missing PV names' defer.returnValue(0) T0, Tend = makeTimeInterval(opt.start, opt.end) _log.debug("Time range: %s -> %s", T0, Tend) count = opt.count if opt.count>0 else conf.getint('defaultcount') for pv in args: printData = Printer(opt, pv) D = yield op(pv, printData, archs=archs, cbArgs=(archive,), T0=T0, Tend=Tend, breakDown=breakDown, count=count, chunkSize=opt.chunk, enumAsInt=opt.enumAsInt) C = yield D if printData.printName: print 'Found %s points'%C
def cmd(archive=None, opt=None, args=None, conf=None, **kws): if not opt.timefmt or opt.timefmt == 'string': def timefmt(ts): return makeTime(ts) elif opt.timefmt == 'posix': def timefmt((sec, ns)): return sec + 1e-9 * ns else: raise ValueError("Invalid time format %s" % opt.timefmt) if len(args) == 0: print 'Missing PV names' defer.returnValue(0) T = makeTimeInterval(opt.start, None)[0] _log.debug("Time: %s", T) archs = opt.archive vals, metas = yield archive.fetchsnap(args, archs=archs, T=T, chunkSize=opt.chunk, enumAsInt=opt.enumAsInt) for n, data, M in zip(args, vals, metas): print n, '\t', timefmt((M['sec'], int(M['ns']))), try: scalar = len(data) > 1 except: scalar = True if scalar: print data, print archive.severity(M['severity']), print archive.status(M['status']) else: # waveform print archive.severity(M['severity']), print archive.status(M['status']), print ', '.join(map(str, data))
def cmd(archive=None, opt=None, args=None, conf=None, **kws): if not opt.timefmt or opt.timefmt=='string': def timefmt(ts): return makeTime(ts) elif opt.timefmt=='posix': def timefmt((sec,ns)): return sec+1e-9*ns else: raise ValueError("Invalid time format %s"%opt.timefmt) if len(args)==0: print 'Missing PV names' defer.returnValue(0) T = makeTimeInterval(opt.start, None)[0] _log.debug("Time: %s", T) archs=opt.archive vals, metas = yield archive.fetchsnap(args, archs=archs, T=T, chunkSize=opt.chunk, enumAsInt=opt.enumAsInt) for n, data, M in zip(args, vals, metas): print n,'\t', timefmt((M['sec'],int(M['ns']))), try: scalar = len(data)>1 except: scalar=True if scalar: print data, print archive.severity(M['severity']), print archive.status(M['status']) else: # waveform print archive.severity(M['severity']), print archive.status(M['status']), print ', '.join(map(str,data))
def cmd(archive=None, opt=None, args=None, conf=None, breakDown=None, **kws): if opt.how == 'raw': op = archive.fetchraw elif opt.how == 'plot': op = archive.fetchplot else: raise ValueError('Unknown plot type %s' % opt.how) archs = opt.archive if len(args) == 0: print 'Missing PV names' defer.returnValue(0) T0, Tend = makeTimeInterval(opt.start, opt.end) _log.debug("Time range: %s -> %s", T0, Tend) count = opt.count if opt.count > 0 else conf.getint('defaultcount') for pv in args: printData = Printer(opt, pv) D = yield op(pv, printData, archs=archs, cbArgs=(archive, ), T0=T0, Tend=Tend, breakDown=breakDown, count=count, chunkSize=opt.chunk, enumAsInt=opt.enumAsInt) C = yield D if printData.printName: print 'Found %s points' % C
def cmd(archive=None, opt=None, args=None, conf=None, **kws): archs = opt.archive if len(args) == 0: print 'Missing PV names' defer.returnValue(0) T0, Tend = makeTimeInterval(opt.start, opt.end) TT0, TT1 = timeTuple(T0), timeTuple(Tend) count = opt.count if opt.count > 0 else conf.getint('defaultcount') h5file, _, path = opt.h5file.partition(':') if path == '': path = '/' F = h5py.File(h5file, 'a') pvgroup = F.require_group(path) Chk = opt.chunk Ds = [None] * len(args) for i, pv in enumerate(args): pvstore = pvgroup.require_group(pv) # store complete time range covering all *requests* aT0 = tuple(pvstore.attrs.get('T0', ())) try: if aT0 is None or TT0 < aT0: pvstore.attrs['T0'] = TT0 except TypeError: pvstore.attrs['T0'] = TT0 aT1 = tuple(pvstore.attrs.get('T1', ())) try: if aT1 is None or TT1 < aT1: pvstore.attrs['T1'] = TT1 except TypeError: pvstore.attrs['T1'] = TT1 P = printInfo() P.file = F P.pvstore = pvstore P.pv = pv P.metaset = pvstore.get('meta') if P.metaset is None: P.metaset = pvstore.create_dataset('meta', shape=(0, ), dtype=dbr_time, maxshape=(None, ), chunks=(Chk, ), shuffle=True, compression='gzip') P.valset = None print pv D = archive.fetchraw(pv, printData, archs=archs, cbArgs=(archive, P), T0=T0, Tend=Tend, count=count, chunkSize=Chk, enumAsInt=opt.enumAsInt) @D.addCallback def show(C, pv=pv): _log.info('%s received %s points', pv, C) Ds[i] = D yield defer.DeferredList(Ds, fireOnOneErrback=True) defer.returnValue(0)
def cmd(archive=None, opt=None, args=None, conf=None, **kws): archs=opt.archive if len(args)==0: print 'Missing PV names' defer.returnValue(0) T0, Tend = makeTimeInterval(opt.start, opt.end) TT0, TT1 = timeTuple(T0), timeTuple(Tend) count = opt.count if opt.count>0 else conf.getint('defaultcount') h5file, _, path = opt.h5file.partition(':') if path=='': path='/' F = h5py.File(h5file, 'a') pvgroup = F.require_group(path) Chk = opt.chunk Ds = [None]*len(args) for i,pv in enumerate(args): pvstore = pvgroup.require_group(pv) # store complete time range covering all *requests* aT0 = tuple(pvstore.attrs.get('T0', ())) try: if aT0 is None or TT0 < aT0: pvstore.attrs['T0'] = TT0 except TypeError: pvstore.attrs['T0'] = TT0 aT1 = tuple(pvstore.attrs.get('T1', ())) try: if aT1 is None or TT1 < aT1: pvstore.attrs['T1'] = TT1 except TypeError: pvstore.attrs['T1'] = TT1 P = printInfo() P.file = F P.pvstore = pvstore P.pv=pv P.metaset = pvstore.get('meta') if P.metaset is None: P.metaset = pvstore.create_dataset('meta', shape=(0,), dtype=dbr_time, maxshape=(None,), chunks=(Chk,), shuffle=True, compression='gzip') P.valset = None print pv D = archive.fetchraw(pv, printData, archs=archs, cbArgs=(archive, P), T0=T0, Tend=Tend, count=count, chunkSize=Chk, enumAsInt=opt.enumAsInt) @D.addCallback def show(C, pv=pv): _log.info('%s received %s points', pv,C) Ds[i] = D yield defer.DeferredList(Ds, fireOnOneErrback=True) defer.returnValue(0)