def get_wvr_errors(lock=None): """ Prints WVR errors in a human-readable way. If a lock is provided, will try to obtain lock before reading errors. """ if lock: with lock: wvrc = wvrComm() errs = wvrc.getWvrAlarms() else: wvrc = wvrComm() errs = wvrc.getWvrAlarms() for i in range(len(ERR_CLASSES)): ERR_CLASS = ERR_CLASSES[i] err = errs[i] for j in range(len(ERR_CLASS)): if 1 << j & err: try: print ERR_CLASS[j] except IndexError: print "Unknown Error"
#! /usr/bin/env python ### # A super simple wrapper to clear an existing wvr Alarm. # only clear the Alarm after you have understood the details of the Alarm and recorded it in the Observation log. # If you encounter a new Alarm or something seems otherwise absnormal, contact Denis ([email protected]) before clearing Alarms. ### import wvrComm wvr = wvrComm.wvrComm(debug=False) answer = raw_input( "\nWARNING: You are about to clear existing WVR Alarms. Are you sure you want to proceed ? Only 'y' will proceed: " ) if answer == 'y': wvr.clearWvrAlarms() else: print "Did nothing"
""" """ import os import time import wvrComm from optparse import OptionParser if __name__ == '__main__': usage = ''' ''' #creating class ... wvr = wvrComm.wvrComm() #options .... parser = OptionParser(usage=usage) parser.add_option("-i", dest="interval", type='int', default=60, help="interval to sample") (options, args) = parser.parse_args() interval = options.interval prefix = time.strftime('%Y%m%d_%H%M%S') filename = prefix + '_wvrHealthMonitor.txt'