示例#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
示例#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
def main():  # pragma: no cover, cannot be tested in unittests due to qt event loop
    args = utils.parse_arguments()
    utils.setup_logging(args.log)

    app = Qt.QApplication(sys.argv)
    win = OnlineMonitorApplication(args.config_file)  # enter remote IP to connect to the other side listening
    win.show()
    sys.exit(app.exec_())
示例#4
0
def main():  # pragma: no cover, cannot be tested in unittests due to qt event loop
    args = utils.parse_arguments()
    utils.setup_logging(args.log)

    app = Qt.QApplication(sys.argv)
    win = OnlineMonitorApplication(args.config_file)  # enter remote IP to connect to the other side listening
    win.show()
    sys.exit(app.exec_())
示例#5
0
def main():
    if sys.argv[1:]:
        args = utils.parse_arguments()
    else:  # no config yaml provided -> start online monitor with std. settings

        class Dummy(object):
            def __init__(self):
                folder = os.path.dirname(os.path.realpath(__file__))
                self.config_file = os.path.join(folder, r'tpx3_monitor.yaml')
                self.log = 'INFO'

        args = Dummy()
        logging.info('No configuration file provided! Use std. settings!')

    utils.setup_logging(args.log)

    # Start the converter
    run_script_in_shell('', args.config_file, 'start_online_monitor')
def main():
    # If no configuration file is provided show a demo of the online monitor
    if sys.argv[1:]:
        args = utils.parse_arguments()
    else:
        # Add examples folder to entity search paths to be able to show DEMO using the examples
        package_path = os.path.dirname(online_monitor.__file__)  # Get the absoulte path of the online_monitor installation
        settings.add_producer_sim_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/producer_sim')))
        settings.add_converter_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/converter')))
        settings.add_receiver_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/receiver')))

        class Dummy(object):

            def __init__(self):
                self.config_file = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)) + r'/configuration.yaml'))
                self.log = 'INFO'
        args = Dummy()
        logging.warning('No configuration file provided! Show a demo of the online monitor!')

    utils.setup_logging(args.log)

    # Start the simulation producer to create some fake data
    producer_sim_process = run_script_in_shell('', args.config_file, 'start_producer_sim')

    # Start the converter
    converter_manager_process = run_script_in_shell('', args.config_file, 'start_converter')

# Helper function to run code after OnlineMonitor Application exit
    def appExec():
        app.exec_()
        # Stop other processes
        try:
            kill(producer_sim_process)
        except psutil.NoSuchProcess:  # If the process was never started it cannot be killed
            pass
        try:
            kill(converter_manager_process)
        except psutil.NoSuchProcess:  # If the process was never started it cannot be killed
            pass
    # Start the online monitor
    app = Qt.QApplication(sys.argv)
    win = OnlineMonitorApplication(args.config_file)
    win.show()
    sys.exit(appExec())
def main():
    if sys.argv[1:]:
        args = utils.parse_arguments()
    else:  # no config yaml provided -> start online monitor with std. settings

        class Dummy(object):
            def __init__(self):
                folder = os.path.dirname(os.path.realpath(__file__))
                self.config_file = os.path.join(folder, r'configuration.yaml')
                self.log = 'INFO'

        args = Dummy()
        logging.info('No configuration file provided! Use std. settings!')

    utils.setup_logging(args.log)

    # Start the producer
    producer_manager_process = run_script_in_shell('', args.config_file,
                                                   'start_producer_sim')
    # Start the converter
    converter_manager_process = run_script_in_shell('', args.config_file,
                                                    'start_converter')

    # Helper function to run code after OnlineMonitor Application exit
    def appExec():
        app.exec_()
        # Stop other processes
        try:
            kill(converter_manager_process)
            kill(producer_manager_process)
        # If the process was never started it cannot be killed
        except psutil.NoSuchProcess:
            pass

    # Start the online monitor
    app = Qt.QApplication(sys.argv)
    win = OnlineMonitorApplication(args.config_file)
    win.show()
    sys.exit(appExec())
示例#8
0
def main():
    # If no configuration file is provided show a demo of the online monitor
    if sys.argv[1:]:
        args = utils.parse_arguments()
    else:
        # Add examples folder to entity search paths to be able to show DEMO using the examples
        package_path = os.path.dirname(
            online_monitor.__file__
        )  # Get the absoulte path of the online_monitor installation
        settings.add_producer_sim_path(
            os.path.abspath(
                os.path.join(
                    os.path.dirname(os.path.realpath(package_path)) +
                    r'/examples/producer_sim')))
        settings.add_converter_path(
            os.path.abspath(
                os.path.join(
                    os.path.dirname(os.path.realpath(package_path)) +
                    r'/examples/converter')))
        settings.add_receiver_path(
            os.path.abspath(
                os.path.join(
                    os.path.dirname(os.path.realpath(package_path)) +
                    r'/examples/receiver')))

        class Dummy(object):
            def __init__(self):
                self.config_file = os.path.abspath(
                    os.path.join(
                        os.path.dirname(os.path.realpath(__file__)) +
                        r'/configuration.yaml'))
                self.log = 'INFO'

        args = Dummy()
        logging.warning(
            'No configuration file provided! Show a demo of the online monitor!'
        )

    utils.setup_logging(args.log)

    # Start the simulation producer to create some fake data
    producer_sim_process = run_script_in_shell('', args.config_file,
                                               'start_producer_sim')

    # Start the converter
    converter_manager_process = run_script_in_shell('', args.config_file,
                                                    'start_converter')

    # Helper function to run code after OnlineMonitor Application exit
    def appExec():
        app.exec_()
        # Stop other processes
        try:
            kill(producer_sim_process)
        except psutil.NoSuchProcess:  # If the process was never started it cannot be killed
            pass
        try:
            kill(converter_manager_process)
        except psutil.NoSuchProcess:  # If the process was never started it cannot be killed
            pass

    # Start the online monitor
    app = Qt.QApplication(sys.argv)
    win = OnlineMonitorApplication(args.config_file)
    win.show()
    sys.exit(appExec())
def main():
    args = utils.parse_arguments()
    utils.setup_logging(args.log)

    cm = ProducerSimManager(args.config_file)
    cm.start()  # blocking function, returns on SIGTERM signal
示例#10
0
def main():
    args = utils.parse_arguments()
    utils.setup_logging(args.log)

    cm = ConverterManager(args.config_file)
    cm.start()  # blocking function, returns on SIGTERM signal