def __init__(self): """Instantiate LibrixTCDaemon class and exec init routines @param self A LibrixTCDaemon instance """ QCoreApplication.__init__(self, sys.argv) # Init LTCConfigParser self.configparser = LTCConfigParser() self.configparser.readConfigFile(configfile) # Init LTCModuleParser self.moduleparser = LTCModuleParser() # Start HTTP server self.httpserver = ThreadedServer(self.configparser, http_port) self.httpserver.start() # Init FileChecker instance and timer self.checkFile = FileChecker(self.configparser, self.moduleparser) self.checkFileTimer = QTimer(self) self.checkFileTimer.timeout.connect(self.checkFile.start) # Init UserChecker instance and timer self.checkUsers = UserChecker(self.configparser, self.moduleparser) self.checkUsersTimer = QTimer(self) self.checkUsersTimer.timeout.connect(self.checkUsers.start) # PID file checker self.checkPIDfileTimer = QTimer(self) self.checkPIDfileTimer.timeout.connect(self.checkPIDfile) self.checkFile.reload.connect(self.checkUsers.clearUser) # Start timers self.checkFileTimer.start(1000) self.checkUsersTimer.start(1000) self.checkPIDfileTimer.start(1000)
def __init__(self): QCoreApplication.__init__(self, []) self.timer = QTimer() self.timer.timeout.connect(self.test) self.timer.start(0)
def __init__( self ): QCoreApplication.__init__( self, sys.argv ) sys.excepthook = self.excepthook
def __init__(self): QCoreApplication.__init__(self, sys.argv) sys.excepthook = self.excepthook
def __init__(self, argv): QCoreApplication.__init__(self, argv) # parse commandline arguments parser = argparse.ArgumentParser( description= 'General Data Acquisition and Instrument control System (GDAIS)') parser.add_argument('equipment', help='Equipment file (.json) to work with') parser.add_argument('-d', action='store_true', default=False, dest='background', help='Run in background') parser.add_argument('--no-http-logging', action='store_false', default=True, dest='http_logging', help='Log messages to GDAIS-control HTTP server') args = parser.parse_args() self.equipment_file = os.path.abspath(args.equipment) self.in_background = args.background self.http_logging = args.http_logging # output logging logging.basicConfig( level=logging.DEBUG, format="%(asctime)s [%(name)s] %(levelname)s: %(message)s", filename=os.path.join(self.BASE_PATH, 'debug.log'), filemode='w') self.log = logging.getLogger("GDAIS") if not self.in_background: # send log output to console if not running in background consoleHandler = logging.StreamHandler() consoleHandler.setLevel(logging.DEBUG) self.log.addHandler(consoleHandler) self.log.info("Welcome to GDAIS!") # HTTP handler for remote logging self.httpHandler = None # control server for GDAIS remote control self.control_server = ControlServer() # notifier of GDAIS events to an external server self.notifier = Notifier() # lists to store instrument controller and initialization threads self.instrument_init_controllers = [] self.instrument_controllers = [] # create data recorder thread self.recorder = Recorder() # whether exit sequence has started self.exiting = False # schedule start event to be run when the execution loop starts QTimer.singleShot(0, self.start)