From 65c8c87dce941a0786ea07a1343af5e910ba2eb5 Mon Sep 17 00:00:00 2001 From: Thijs <snijder@astron.nl> Date: Wed, 9 Jun 2021 16:39:08 +0200 Subject: [PATCH] exposes buffersize and queuesize to the sst_client init function with default parameters --- devices/clients/sst_client.py | 7 ++++--- jupyter-notebooks/test_device.ipynb | 18 +++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/devices/clients/sst_client.py b/devices/clients/sst_client.py index 407dabde3..ab79fe125 100644 --- a/devices/clients/sst_client.py +++ b/devices/clients/sst_client.py @@ -24,14 +24,15 @@ class sst_client(CommClient): def start(self): super().start() - def __init__(self, host, port, fault_func, streams, try_interval=2): + def __init__(self, host, port, fault_func, streams, try_interval=2, queuesize=1024, buffersize=9000): """ Create the sst client and connect() to it and get the object node """ self.host = host self.port = port self.timeout = 0.1 - self.buffersize = 9000 + self.buffersize = buffersize + self.queuesize = queuesize super().__init__(fault_func, streams, try_interval) @@ -46,7 +47,7 @@ class sst_client(CommClient): Function used to connect to the client. """ if not self.connected: - self.queue = Queue(maxsize=1024) + self.queue = Queue(maxsize=self.queuesize) self.udp = UDP_Receiver(self.host, self.port, self.queue, self.streams, self.buffersize, self.timeout) self.sst = SST(self.queue, self.streams) return super().connect() diff --git a/jupyter-notebooks/test_device.ipynb b/jupyter-notebooks/test_device.ipynb index 69a441862..7701f5209 100644 --- a/jupyter-notebooks/test_device.ipynb +++ b/jupyter-notebooks/test_device.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 30, + "execution_count": 61, "id": "waiting-chance", "metadata": {}, "outputs": [], @@ -13,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 62, "id": "moving-alexandria", "metadata": {}, "outputs": [], @@ -23,7 +23,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 63, "id": "ranking-aluminum", "metadata": {}, "outputs": [ @@ -51,7 +51,7 @@ }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 68, "id": "beneficial-evidence", "metadata": {}, "outputs": [ @@ -59,11 +59,11 @@ "name": "stdout", "output_type": "stream", "text": [ - "packet_count_R [139917203]\n", - "last_packet_timestamp_R [1623248251]\n", - "queue_percentage_used_R [100.]\n", - "State <function __get_command_func.<locals>.f at 0x7fcb20e68bf8>\n", - "Status <function __get_command_func.<locals>.f at 0x7fcb20e68bf8>\n" + "packet_count_R [55]\n", + "last_packet_timestamp_R [1623249385]\n", + "queue_percentage_used_R [0.]\n", + "State <function __get_command_func.<locals>.f at 0x7fcb205fd0d0>\n", + "Status <function __get_command_func.<locals>.f at 0x7fcb205fd0d0>\n" ] } ], -- GitLab