How to use the spead2.ThreadPool function in spead2

To help you get started, we’ve selected a few spead2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OxfordSKA / OSKAR / python / examples / spead / sender / spead_send.py View on Github external
def __init__(self, log, spead_config, precision=None, oskar_settings=None):
        oskar.Interferometer.__init__(self, precision, oskar_settings)
        self._log = log
        self._streams = []
        self._vis_pack = None

        # Construct UDP streams and associated item groups.
        stream_config = spead2.send.StreamConfig(
            spead_config['stream_config']['max_packet_size'],
            spead_config['stream_config']['rate'],
            spead_config['stream_config']['burst_size'],
            spead_config['stream_config']['max_heaps'])
        for stream in spead_config['streams']:
            threads = stream['threads'] if 'threads' in stream else 1
            thread_pool = spead2.ThreadPool(threads=threads)
            log.info("Creating SPEAD stream for host {} on port {} ..."
                     .format(stream['host'], stream['port']))
            udp_stream = spead2.send.UdpStream(thread_pool, stream['host'],
                                               stream['port'], stream_config)
            item_group = spead2.send.ItemGroup(
                flavour=spead2.Flavour(4, 64, 40, 0))

            # Append udp_stream and item_group to the stream list as a tuple.
            self._streams.append((udp_stream, item_group))

spead2

High-performance SPEAD implementation

LGPL-3.0
Latest version published 2 months ago

Package Health Score

72 / 100
Full package analysis

Similar packages