def main(options, args): #logger = ssdlog.make_logger('checkstat', options) ro.init() st = ro.remoteObjectProxy(options.statussvc) insdata = INSdata() statusDict = {} lookupDict = {} # Get all the names of the 'ALIVE' status tables for the instruments for insname in insdata.getNames(): if insname == 'VGW': continue inscode = insdata.getCodeByName(insname) tblname = '%3.3sS0001' % inscode alias = 'GEN2.STATUS.TBLTIME.%s' % tblname statusDict[alias] = 0 lookupDict[alias] = insname # Additional tables to check for tblname in ('TSCS', 'TSCL', 'TSCV', 'VGWD', 'VGWQ'): alias = 'GEN2.STATUS.TBLTIME.%s' % tblname statusDict[alias] = 0 lookupDict[alias] = tblname fetchDict = st.fetch(statusDict) if options.sorttime: times = fetchDict.items() times.sort(_timecmp) keys = [(alias, lookupDict[alias]) for alias in \ map(lambda x: x[0], times)] else: keys = lookupDict.items() keys.sort(lambda x, y: cmp(x[1], y[1])) #print keys for alias, name in keys: timeval = fetchDict[alias] if timeval == '##NODATA##': time_s = 'No record' elif isinstance(timeval, float): time_s = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(timeval)) else: time_s = 'ERROR: %s' % str(timeval) print "%-8.8s %s" % (name, time_s)
# # Make data directories for active instruments. Expects env var # DATAHOME to be set. # import sys, os from cfg.INS import INSdata as INSconfig ic = INSconfig() for name in ic.getNames(active=True): dirpath = os.path.join(os.environ['DATAHOME'], name) if not os.path.isdir(dirpath): print "Making %s..." % dirpath os.mkdir(dirpath)