Exemple #1
0
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()

        visibility_endpoint = messager.get_endpoint(messaging_system, "visibility", VisibilityDatagram)
        visibility_control_endpoint = messager.get_endpoint(messaging_system, "visibilitycontrol", StringMessage)

        visibility_string_endpoint = messager.get_endpoint(messaging_system, "visibilitystring", StringMessage)
        tostring_control_endpoint = messager.get_endpoint(messaging_system, "tostringcontrol", StringMessage)
        string_writer_control_endpoint = messager.get_endpoint(messaging_system, "stringwritercontrol", StringMessage)

        # set up the visibility datagram source service
        visibility_datagram_source_service = VisibilityDatagramSourceService("localhost", 3000, visibility_endpoint, visibility_control_endpoint)
        visibility_datagram_source_service_container = ServiceContainer(visibility_datagram_source_service, messager)

        tostring_service = ToStringService(visibility_endpoint, visibility_string_endpoint, tostring_control_endpoint)
        tostring_service_container = ServiceContainer(tostring_service, messager)

        string_writer_service = StringWriterService(visibility_string_endpoint, string_writer_control_endpoint, "output.txt")
        string_writer_service_container = ServiceContainer(string_writer_service, messager)

        # start Ice
        logging.info("Starting Ice")
        ice_runner = IceRunner("testbed_data")
        ice_runner.start()

        logging.info("Starting services")
        string_writer_service_container.start()
        tostring_service_container.start()
        visibility_datagram_source_service_container.start()
    
        logging.info("Starting processing")
        messager.publish(string_writer_control_endpoint, StringMessage("Start"))
        messager.publish(tostring_control_endpoint, StringMessage("Start"))
        messager.publish(visibility_control_endpoint, StringMessage("Start"))

        # start playback
        logging.info("Starting playback")
        playback = Playback("testbed_data")
        playback.playback("data/ade1card.ms")
        playback.wait()

        time.sleep(10)
        messager.publish(visibility_control_endpoint, StringMessage("Stop"))

        time.sleep(10)
        messager.publish(tostring_control_endpoint, StringMessage("Stop"))

        time.sleep(10)
        messager.publish(string_writer_control_endpoint, StringMessage("Stop"))

        time.sleep(10)

        visibility_datagram_source_service_container.terminate()
        tostring_service_container.terminate()
        string_writer_service_container.terminate()

        # stop Ice
        logging.info("stopping Ice")
        ice_runner.stop()
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()

        metadata_endpoint = messager.get_endpoint(messaging_system, "metadata", TOSMetadata)
        metadata_control_endpoint = messager.get_endpoint(messaging_system, " metadatacontrol", StringMessage)

        metadata_string_endpoint = messager.get_endpoint(messaging_system, "metadatastring", StringMessage)
        tostring_control_endpoint = messager.get_endpoint(messaging_system, "tostringcontrol", StringMessage)
        string_writer_control_endpoint = messager.get_endpoint(messaging_system, "stringwritercontrol", StringMessage)
        
        # start Ice
        logging.info("Starting Ice")
        ice_runner = IceRunner("testbed_data")
        ice_runner.start()

        # set up the ice metadata source service
        ice_metadata_source_service = IceMetadataSourceService("localhost", 4061, "IceStorm/[email protected]", "metadata", "IngestPipeline", metadata_endpoint, metadata_control_endpoint)
        ice_metadata_source_service_container = ServiceContainer(ice_metadata_source_service, messager)

        tostring_service = ToStringService(metadata_endpoint, metadata_string_endpoint, tostring_control_endpoint)
        tostring_service_container = ServiceContainer(tostring_service, messager)

        string_writer_service = StringWriterService(metadata_string_endpoint, string_writer_control_endpoint, "output.txt")
        string_writer_service_container = ServiceContainer(string_writer_service, messager)


        logging.info("Starting services")
        string_writer_service_container.start()
        tostring_service_container.start()
        ice_metadata_source_service_container.start()
    
        logging.info("Starting processing")
        messager.publish(string_writer_control_endpoint, StringMessage("Start"))
        messager.publish(tostring_control_endpoint, StringMessage("Start"))
        messager.publish(metadata_control_endpoint, StringMessage("Start"))
    
        # start playback
        logging.info("Starting playback")
        playback = Playback("testbed_data")
        playback.playback("data/ade1card.ms")
        playback.wait()

        time.sleep(10)
        messager.publish(metadata_control_endpoint, StringMessage("Stop"))

        time.sleep(10)
        messager.publish(tostring_control_endpoint, StringMessage("Stop"))

        time.sleep(10)
        messager.publish(string_writer_control_endpoint, StringMessage("Stop"))

        time.sleep(10)
        ice_metadata_source_service_container.terminate()
        tostring_service_container.terminate()
        string_writer_service_container.terminate()

        # stop Ice
        logging.info("stopping Ice")
        ice_runner.stop()
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()

        metadata_endpoint = messager.get_endpoint(messaging_system, "metadata",
                                                  TOSMetadata)
        metadata_control_endpoint = messager.get_endpoint(
            messaging_system, "metadatacontrol", StringMessage)
        metadata_metrics_endpoint = messager.get_endpoint(
            messaging_system, "metadatametrics", Metrics)

        datagram_endpoint = messager.get_endpoint(messaging_system, "datagram",
                                                  VisibilityDatagram)
        datagram_control_endpoint = messager.get_endpoint(
            messaging_system, "datagramcontrol", StringMessage)
        datagram_metrics_endpoint = messager.get_endpoint(
            messaging_system, "datagrammetrics", Metrics)

        chunk_endpoint = messager.get_endpoint(messaging_system, "chunk",
                                               VisibilityChunk)
        align_control_endpoint = messager.get_endpoint(messaging_system,
                                                       "aligncontrol",
                                                       StringMessage)
        align_metrics_endpoint = messager.get_endpoint(messaging_system,
                                                       "alignmetrics", Metrics)

        chunk_string_endpoint = messager.get_endpoint(messaging_system,
                                                      "chunkstring",
                                                      StringMessage)
        to_string_control_endpoint = messager.get_endpoint(
            messaging_system, "to_stringcontrol", StringMessage)
        to_string_metrics_endpoint = messager.get_endpoint(
            messaging_system, "to_stringmetrics", Metrics)
        string_writer_control_endpoint = messager.get_endpoint(
            messaging_system, "stringwritercontrol", StringMessage)
        string_writer_metrics_endpoint = messager.get_endpoint(
            messaging_system, "stringwritermetrics", Metrics)

        # start Ice
        logging.info("Starting Ice")
        ice_runner = IceRunner("testbed_data")
        ice_runner.start()

        # set up the ice metadata source service
        ice_metadata_source_service = IceMetadataSourceService(
            "localhost", 4061, "IceStorm/[email protected]",
            "metadata", "IngestPipeline", metadata_endpoint,
            metadata_control_endpoint)
        ice_metadata_source_monitor_adapter = MonitorAdapter(
            ice_metadata_source_service, "ice_metadata_source_service",
            metadata_metrics_endpoint)
        ice_metadata_source_service_container = ServiceContainer(
            ice_metadata_source_monitor_adapter, messager)

        # set up the visibility datagram source service
        visibility_datagram_source_service = VisibilityDatagramSourceService(
            "localhost", 3000, datagram_endpoint, datagram_control_endpoint)
        visibility_datagram_source_monitor_adapter = MonitorAdapter(
            visibility_datagram_source_service,
            "visibility_datagram_source_service", datagram_metrics_endpoint)
        visibility_datagram_source_service_container = ServiceContainer(
            visibility_datagram_source_monitor_adapter, messager)

        # set up the align service
        align_service = AlignService(metadata_endpoint, datagram_endpoint,
                                     chunk_endpoint, align_control_endpoint)
        align_monitor_adapter = MonitorAdapter(align_service, "align_service",
                                               align_metrics_endpoint)
        align_service_container = ServiceContainer(align_monitor_adapter,
                                                   messager)

        to_string_service = ToStringService(chunk_endpoint,
                                            chunk_string_endpoint,
                                            to_string_control_endpoint)
        to_string_monitor_adapter = MonitorAdapter(to_string_service,
                                                   "to_string_service",
                                                   to_string_metrics_endpoint)
        to_string_service_container = ServiceContainer(
            to_string_monitor_adapter, messager)

        string_writer_service = StringWriterService(
            chunk_string_endpoint, string_writer_control_endpoint,
            "output.txt")
        string_writer_monitor_adapter = MonitorAdapter(
            string_writer_service, "string_writer_service",
            string_writer_metrics_endpoint)
        string_writer_service_container = ServiceContainer(
            string_writer_monitor_adapter, messager)

        monitor_service = GenericMonitorService([
            datagram_metrics_endpoint, metadata_metrics_endpoint,
            align_metrics_endpoint, to_string_metrics_endpoint,
            string_writer_metrics_endpoint
        ])
        monitor_service_container = ServiceContainer(monitor_service, messager)

        logging.info("Starting services")
        monitor_service_container.start()
        visibility_datagram_source_service_container.start()
        ice_metadata_source_service_container.start()
        align_service_container.start()
        to_string_service_container.start()
        string_writer_service_container.start()

        logging.info("Starting processing")
        messager.publish(datagram_control_endpoint, StringMessage("Start"))
        messager.publish(metadata_control_endpoint, StringMessage("Start"))
        messager.publish(align_control_endpoint, StringMessage("Start"))
        messager.publish(to_string_control_endpoint, StringMessage("Start"))
        messager.publish(string_writer_control_endpoint,
                         StringMessage("Start"))

        # start playback
        logging.info("Starting playback")
        playback = Playback("testbed_data")
        playback.playback("data/ade1card.ms")
        playback.wait()

        time.sleep(10)
        messager.publish(datagram_control_endpoint, StringMessage("Stop"))

        time.sleep(5)
        messager.publish(metadata_control_endpoint, StringMessage("Stop"))

        time.sleep(5)
        messager.publish(align_control_endpoint, StringMessage("Stop"))

        time.sleep(5)
        messager.publish(to_string_control_endpoint, StringMessage("Stop"))

        time.sleep(5)
        messager.publish(string_writer_control_endpoint, StringMessage("Stop"))

        ice_metadata_source_service_container.terminate()
        visibility_datagram_source_service_container.terminate()
        align_service_container.terminate()
        to_string_service_container.terminate()
        string_writer_service_container.terminate()
        monitor_service_container.terminate()

        # stop Ice
        logging.info("stopping Ice")
        ice_runner.stop()
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()

        service_runner_factory = ServiceRunnerFactory(messager)

        configuration_stream = messager.get_stream(messaging_system,
                                                   "configuration",
                                                   ConfigurationMessage)
        control_stream = messager.get_stream(messaging_system, "control",
                                             StringMessage)

        metadata_stream = messager.get_stream(messaging_system, "metadata",
                                              TOSMetadata)
        metadata_metrics_stream = messager.get_stream(messaging_system,
                                                      "metadatametrics",
                                                      Metrics)

        ice_metadata_source_service_runner = service_runner_factory.get_service_runner(
            IceMetadataSourceService, {
                "name": "ice_metadata_source_service",
                "metadata_endpoint": metadata_stream.get_write_endpoint(),
                "control_endpoint": control_stream.get_read_endpoint()
            },
            metrics_stream=metadata_metrics_stream,
            configuration_stream=configuration_stream)

        datagram_stream = messager.get_stream(messaging_system, "datagram",
                                              VisibilityDatagram)
        datagram_metrics_stream = messager.get_stream(messaging_system,
                                                      "datagrammetrics",
                                                      Metrics)
        visibility_datagram_source_service_runner = service_runner_factory.get_service_runner(
            VisibilityDatagramSourceService, {
                "name":
                "visibility_datagram_source_service",
                "visibility_datagram_endpoint":
                datagram_stream.get_write_endpoint(),
                "control_endpoint":
                control_stream.get_read_endpoint()
            },
            metrics_stream=datagram_metrics_stream,
            configuration_stream=configuration_stream)

        # set up the align service
        chunk_stream = messager.get_stream(messaging_system, "chunk",
                                           VisibilityChunk)
        align_metrics_stream = messager.get_stream(messaging_system,
                                                   "alignmetrics", Metrics)
        align_service_runner = service_runner_factory.get_service_runner(
            AlignService, {
                "name": "align_service",
                "datagram_endpoint": datagram_stream.get_read_endpoint(),
                "metadata_endpoint": metadata_stream.get_read_endpoint(),
                "chunk_endpoint": chunk_stream.get_write_endpoint(),
                "control_endpoint": control_stream.get_read_endpoint()
            },
            metrics_stream=align_metrics_stream,
            configuration_stream=configuration_stream)

        # set up the uvwcalculation service
        uvw_chunk_stream = messager.get_stream(messaging_system, "uvwchunk",
                                               UVWChunk)
        uvw_calculation_metrics_stream = messager.get_stream(
            messaging_system, "uvwcalcmetrics", Metrics)
        uvw_calculation_service_runner = service_runner_factory.get_service_runner(
            UVWCalculationService, {
                "name": "uvw_calculation_service",
                "observatory_name": "ASKAP",
                "visibility_chunk_endpoint": chunk_stream.get_read_endpoint(),
                "metadata_endpoint": metadata_stream.get_read_endpoint(),
                "uvw_chunk_endpoint": uvw_chunk_stream.get_write_endpoint(),
                "control_endpoint": control_stream.get_read_endpoint()
            },
            metrics_stream=uvw_calculation_metrics_stream,
            configuration_stream=configuration_stream)

        uvw_chunk_string_stream = messager.get_stream(messaging_system,
                                                      "chunkstring",
                                                      StringMessage)
        to_string_metrics_stream = messager.get_stream(messaging_system,
                                                       "to_stringmetrics",
                                                       Metrics)
        to_string_service_runner = service_runner_factory.get_service_runner(
            ToStringService, {
                "name": "to_string_service",
                "input_endpoint": uvw_chunk_stream.get_read_endpoint(),
                "output_endpoint":
                uvw_chunk_string_stream.get_write_endpoint(),
                "control_endpoint": control_stream.get_read_endpoint()
            },
            metrics_stream=to_string_metrics_stream,
            configuration_stream=configuration_stream)

        string_writer_metrics_stream = messager.get_stream(
            messaging_system, "stringwritermetrics", Metrics)
        string_writer_service_runner = service_runner_factory.get_service_runner(
            StringWriterService, {
                "name": "string_writer_service",
                "string_endpoint": uvw_chunk_string_stream.get_read_endpoint(),
                "control_endpoint": control_stream.get_read_endpoint()
            },
            metrics_stream=string_writer_metrics_stream,
            configuration_stream=configuration_stream)

        monitor_service = GenericMonitorService("generic_monitor_service", [
            datagram_metrics_stream.get_read_endpoint(),
            metadata_metrics_stream.get_read_endpoint(),
            align_metrics_stream.get_read_endpoint(),
            uvw_calculation_metrics_stream.get_read_endpoint(),
            to_string_metrics_stream.get_read_endpoint(),
            string_writer_metrics_stream.get_read_endpoint()
        ])
        monitor_service_runner = ServiceRunner(monitor_service, messager)

        configuration_control_stream = messager.get_stream(
            messaging_system, "configurationcontrol", StringMessage)
        configuration_service = HardConfigurationService(
            "configuration_service",
            configuration_control_stream.get_read_endpoint(),
            configuration_stream.get_write_endpoint())
        configuration_service_runner = ServiceRunner(configuration_service,
                                                     messager)

        # start Ice
        logging.info("Starting Ice")
        ice_runner = IceRunner("testbed_data")
        ice_runner.start()

        logging.info("Starting services")
        configuration_service_runner.start()
        monitor_service_runner.start()
        visibility_datagram_source_service_runner.start()
        ice_metadata_source_service_runner.start()
        align_service_runner.start()
        uvw_calculation_service_runner.start()
        to_string_service_runner.start()
        string_writer_service_runner.start()

        logging.info("Publishing configuration")
        mainline_configuration_control_endpoint = configuration_control_stream.get_write_endpoint(
        )

        logging.info("Issuing configuration")
        messager.publish(mainline_configuration_control_endpoint,
                         StringMessage("Start"))

        time.sleep(10)

        logging.info("Starting processing")
        mainline_control_endpoint = control_stream.get_write_endpoint()
        messager.publish(mainline_control_endpoint, StringMessage("Start"))

        # start playback
        logging.info("Starting playback")
        playback = Playback("testbed_data")
        playback.playback("data/ade1card.ms")
        playback.wait()

        time.sleep(10)

        messager.publish(mainline_control_endpoint, StringMessage("Stop"))

        time.sleep(10)

        ice_metadata_source_service_runner.terminate()
        visibility_datagram_source_service_runner.terminate()
        align_service_runner.terminate()
        uvw_calculation_service_runner.terminate()
        to_string_service_runner.terminate()
        string_writer_service_runner.terminate()
        monitor_service_runner.terminate()
        configuration_service_runner.terminate()

        # stop Ice
        logging.info("stopping Ice")
        ice_runner.stop()
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()

        configuration_stream = messager.get_stream(messaging_system,
                                                   "configuration",
                                                   ConfigurationMessage)
        control_stream = messager.get_stream(messaging_system, "control",
                                             StringMessage)

        service_runner_factory = ServiceRunnerFactory(messager)

        visibility_stream = messager.get_stream(messaging_system, "visibility",
                                                VisibilityDatagram)
        visibility_datagram_source_service_runner = service_runner_factory.get_service_runner(
            VisibilityDatagramSourceService, {
                "name": "visibility_datagram_source_service",
                "visibility_datagram_endpoint":
                visibility_stream.get_endpoint(),
                "control_endpoint": control_stream.get_endpoint()
            },
            configuration_stream=configuration_stream)

        visibility_string_stream = messager.get_stream(messaging_system,
                                                       "visibilitystring",
                                                       StringMessage)
        tostring_service_runner = service_runner_factory.get_service_runner(
            ToStringService, {
                "name": "tostring_service",
                "input_endpoint": visibility_stream.get_endpoint(),
                "output_endpoint": visibility_string_stream.get_endpoint(),
                "control_endpoint": control_stream.get_endpoint()
            },
            configuration_stream=configuration_stream)

        string_writer_service_runner = service_runner_factory.get_service_runner(
            StringWriterService, {
                "name": "string_writer_service",
                "string_endpoint": visibility_string_stream.get_endpoint(),
                "control_endpoint": control_stream.get_endpoint()
            },
            configuration_stream=configuration_stream)

        # start Ice
        logging.info("Starting Ice")
        ice_runner = IceRunner("testbed_data")
        ice_runner.start()

        time.sleep(5)

        logging.info("Starting services")
        string_writer_service_runner.start()
        tostring_service_runner.start()
        visibility_datagram_source_service_runner.start()

        time.sleep(5)

        logging.info("Publishing configuration")
        mainline_configuration_endpoint = configuration_stream.get_endpoint()

        configuration_message = ConfigurationMessage({
            "antennas": {
                "ant2": {
                    "name": "ak02",
                    "itrf":
                    (-2556109.976515, 5097388.699862, -2848440.12097248)
                },
                "ant4": {
                    "name": "ak04",
                    "itrf": (-2556087.396082, 5097423.589662, -2848396.867933)
                },
                "ant5": {
                    "name": "ak05",
                    "itrf":
                    (-2556028.607336, 5097451.468188, -2848399.83113161)
                },
                "ant10": {
                    "name": "ak10",
                    "itrf": (-2556059.228687, 5097560.766055, -2848178.119367)
                },
                "ant12": {
                    "name": "ak12",
                    "itrf":
                    (-2556496.237175, 5097333.724901, -2848187.33832738)
                },
                # other to get 12-antennas
                "ant7": {
                    "name": "ak07",
                    "itrf": (-2556282.880670, 5097252.290820, -2848527.104272)
                },
                "ant11": {
                    "name": "ak11",
                    "itrf": (-2556397.233607, 5097421.429903, -2848124.497319)
                },
                # old BETA antennas
                "ant1": {
                    "name": "ak01",
                    "itrf": (-2556084.669, 5097398.337, -2848424.133)
                },
                "ant15": {
                    "name": "ak15",
                    "itrf":
                    (-2555389.850372, 5097664.627578, -2848561.95991566)
                },
                "ant3": {
                    "name": "ak03",
                    "itrf":
                    (-2556118.109261, 5097384.719695, -2848417.19642608)
                },
                "ant6": {
                    "name": "ak06",
                    "itrf":
                    (-2556227.878593, 5097380.442223, -2848323.44598377)
                },
                "ant8": {
                    "name": "ak08",
                    "itrf": (-2556002.509816, 5097320.293832, -2848637.482106)
                },
                "ant9": {
                    "name": "ak09",
                    "itrf": (-2555888.891875, 5097552.280516, -2848324.679547)
                }
            },
            "metadata_source": {
                "host": "localhost",
                "port": "4061",
                "topicmanager": "IceStorm/[email protected]",
                "topic": "metadata",
                "adapter": "IngestPipeline"
            },
            "datagram_source": {
                "host": "localhost",
                "port": "3000"
            },
            "correlation_modes": {
                "standard": {
                    "channel_width": "18.518518",
                    "interval": "5000000",
                    "number_of_channels": "216",
                    "stokes": ["XX", "XY", "YX", "YY"]
                }
            },
            "maximum_number_of_beams":
            "36",
            "string_writer_service.output_path":
            "output.txt"
        })
        messager.publish(mainline_configuration_endpoint,
                         configuration_message)

        logging.info("Starting processing")
        mainline_control_endpoint = control_stream.get_endpoint()

        messager.publish(mainline_control_endpoint, StringMessage("Start"))

        # start playback
        logging.info("Starting playback")
        playback = Playback("testbed_data")
        playback.playback("data/ade1card.ms")
        playback.wait()

        time.sleep(10)
        messager.publish(mainline_control_endpoint, StringMessage("Stop"))

        time.sleep(10)

        visibility_datagram_source_service_runner.terminate()
        tostring_service_runner.terminate()
        string_writer_service_runner.terminate()

        # stop Ice
        logging.info("stopping Ice")
        ice_runner.stop()