Example #1
0
def test_pickled_object_compression_publish(
    benchmark, fixture_file: str, algorithm: str
) -> None:
    with open(os.path.join(FIXTURES_DIR, fixture_file), "r") as fp:
        content = fp.read()

    data = json.loads(content)

    publisher = publishers.PoolPublisher()

    exchange = Exchange("st2.execution.test", type="topic")

    if algorithm == "zstandard":
        compression = "zstd"
    else:
        compression = None

    def run_benchmark():
        live_action_db = LiveActionDB()
        live_action_db.status = "succeeded"
        live_action_db.action = "core.local"
        live_action_db.result = data

        publisher.publish(
            payload=live_action_db, exchange=exchange, compression=compression
        )

    benchmark.pedantic(run_benchmark, iterations=5, rounds=5)
Example #2
0
 def __init__(self, urls):
     self._publisher = publishers.PoolPublisher(urls=urls)
Example #3
0
File: reactor.py Project: tzmvp/st2
 def __init__(self):
     self._publisher = publishers.PoolPublisher()