Esempio n. 1
0
def main():
    args = utils.parse_arguments()
    configuration = utils.parse_config_file(args.config_file)

    try:
        daqs = []
        for (actual_producer_name, actual_producer_cfg) in configuration['producer_sim'].items():
            actual_producer_cfg['name'] = actual_producer_name
            daq = ProducerSim(loglevel=args.log, **actual_producer_cfg)
            daqs.append(daq)

        for daq in daqs:
            daq.start()

        while(True):
            try:
                time.sleep(2)
            except KeyboardInterrupt:
                for daq in daqs:
                    daq.shutdown()
                for daq in daqs:
                    daq.join(timeout=500)
                return
    except KeyError:  # A simulation producer is just for testing, do not require one in the configuration file
        pass
Esempio n. 2
0
def main():
    args = utils.parse_arguments()
    configuration = utils.parse_config_file(args.config_file)

    try:
        daqs = []
        for (actual_producer_name,
             actual_producer_cfg) in configuration['producer_sim'].items():
            actual_producer_cfg['name'] = actual_producer_name
            daq = ProducerSim(loglevel=args.log, **actual_producer_cfg)
            daqs.append(daq)

        for daq in daqs:
            daq.start()

        while (True):
            try:
                time.sleep(2)
            except KeyboardInterrupt:
                for daq in daqs:
                    daq.shutdown()
                for daq in daqs:
                    daq.join(timeout=500)
                return
    except KeyError:  # A simulation producer is just for testing, do not require one in the configuration file
        pass
Esempio n. 3
0
 def test_argument_parser(self, log):
     # FIXME: SystemExit not reliably raised if nosetest is started from console using installed package
     # Function utils.parse_arguments
     # with self.assertRaises(SystemExit):  # no config file specified; thus expect parser error raising SystemExit; this does not work within nosetests
     #             utils.parse_arguments()
     # Function utils.parse_args
     arguments = utils.parse_args(['configfile.yaml', '-l DEBUG'])
     self.assertEqual(arguments.config_file, 'configfile.yaml', 'The non positional argument is parsed wrong')
     self.assertTrue('DEBUG' in arguments.log, 'The logging argument parse fails')
     # Function parse_config_file
     with self.assertRaises(IOError):
         utils.parse_config_file('Does_not_exist')  # open not existin file
     configuration = utils.parse_config_file(self.config_path)  # parse config and check result
     self.assertEqual(configuration, self.configuration)
     utils.parse_config_file(self.config_path, expect_receiver=True)
     log.check(('root', 'WARNING', 'No receiver specified, thus no data can be plotted. Change %s!' % self.config_path))  # check the logging output
Esempio n. 4
0
 def __init__(self, config_file, loglevel='INFO'):
     super(OnlineMonitorApplication, self).__init__()
     utils.setup_logging(loglevel)
     logging.debug("Initialize online monitor with configuration in %s", config_file)
     self.configuration = utils.parse_config_file(config_file, expect_receiver=True)
     self.setup_style()
     self.setup_widgets()
     self.receivers = self.start_receivers()
Esempio n. 5
0
 def __init__(self, config_file, loglevel='INFO'):
     super(OnlineMonitorApplication, self).__init__()
     utils.setup_logging(loglevel)
     logging.debug("Initialize online monitor with configuration in %s", config_file)
     self.configuration = utils.parse_config_file(config_file, expect_receiver=True)
     self.setup_style()
     self.setup_widgets()
     self.receivers = self.start_receivers()
Esempio n. 6
0
 def test_argument_parser(self, log):
     # FIXME: SystemExit not reliably raised if nosetest is started from console using installed package
     # Function utils.parse_arguments
     # with self.assertRaises(SystemExit):  # no config file specified; thus expect parser error raising SystemExit; this does not work within nosetests
     #             utils.parse_arguments()
     # Function utils.parse_args
     arguments = utils.parse_args(['configfile.yaml', '-l DEBUG'])
     self.assertEqual(arguments.config_file, 'configfile.yaml',
                      'The non positional argument is parsed wrong')
     self.assertTrue('DEBUG' in arguments.log,
                     'The logging argument parse fails')
     # Function parse_config_file
     with self.assertRaises(IOError):
         utils.parse_config_file('Does_not_exist')  # open not existin file
     configuration = utils.parse_config_file(
         self.config_path)  # parse config and check result
     self.assertEqual(configuration, self.configuration)
     utils.parse_config_file(self.config_path, expect_receiver=True)
     log.check(
         ('root', 'WARNING',
          'No receiver specified, thus no data can be plotted. Change %s!' %
          self.config_path))  # check the logging output
 def __init__(self, configuration, loglevel='INFO'):
     utils.setup_logging(loglevel)
     logging.info("Initialize converter mananager with configuration in %s", configuration)
     self.configuration = utils.parse_config_file(configuration)