From b218a772145d121745401ff2985b9a4b9d75b7e9 Mon Sep 17 00:00:00 2001 From: Jeff Kaufman Date: Sun, 7 Feb 2021 14:21:40 +0000 Subject: [PATCH] remove print_status --- server.py | 22 ---------------------- server_wrapper.py | 12 +++++------- unit-stress.py | 6 ++---- 3 files changed, 7 insertions(+), 33 deletions(-) diff --git a/server.py b/server.py index 7db46f1..319b8a6 100755 --- a/server.py +++ b/server.py @@ -108,8 +108,6 @@ def reset(self): self.max_position = DELAY_INTERVAL*LAYERING_DEPTH - self.last_status_ts = 0.0 - self.disable_auto_gain = False self.disable_song_video = False @@ -1214,30 +1212,10 @@ def handle_post(in_json, in_data) -> Tuple[Any, str]: x_audio_metadata.update(user.to_send) user.mark_sent() - if in_json.get("print_status", False): - maybe_print_status() - bin_summary = binary_user_summary(user_summary(requested_user_summary)) if len(bin_summary) > 0: data = np.append(bin_summary, data.view(dtype=np.uint8)) return data, json.dumps(x_audio_metadata) -def maybe_print_status() -> None: - now = time.time() - if now - state.last_status_ts < STATUS_PRINT_INTERVAL_S: - return - - print("-"*70) - - for delay, name, mic_volume, userid, \ - rms_volume, muted in user_summary(requested_user_summary=True): - print ("%s %s vol=%.2f rms=%.5f" % ( - str(delay).rjust(3), - name.rjust(30), - mic_volume, - rms_volume)) - - state.last_status_ts = now - if __name__ == "__main__": print("Run server_wrapper.py or shm.py instead") diff --git a/server_wrapper.py b/server_wrapper.py index 8c4adf1..c0fbf3e 100755 --- a/server_wrapper.py +++ b/server_wrapper.py @@ -88,12 +88,12 @@ def unpack_multi(data) -> List[Any]: def calculate_volume(in_data): return np.sqrt(np.mean(in_data**2)) -def handle_post_special(query_string, print_status=True): - data, x_audio_metadata = handle_json_post(np.zeros(0), query_string, {}, print_status) +def handle_post_special(query_string): + data, x_audio_metadata = handle_json_post(np.zeros(0), query_string, {}) return data.tobytes(), x_audio_metadata def handle_post(userid, n_samples, in_data_raw, - query_string, print_status=True, client_address=None) -> Tuple[Any, str]: + query_string, client_address=None) -> Tuple[Any, str]: if not userid.isdigit(): raise ValueError("UserID must be numeric; got: %r"%userid) try: @@ -141,7 +141,7 @@ def handle_post(userid, n_samples, in_data_raw, query_string += '&rms_volume=%s'%rms_volume data, x_audio_metadata = handle_json_post( - in_data, query_string, json_kvs, print_status, + in_data, query_string, json_kvs, client_address=client_address) # Divide data into user_summary and raw audio data @@ -169,11 +169,9 @@ def handle_post(userid, n_samples, in_data_raw, return data.tobytes(), x_audio_metadata -def handle_json_post(in_data, query_string, json_kvs, print_status, - client_address=None): +def handle_json_post(in_data, query_string, json_kvs, client_address=None): json_kvs.update({ "query_string": query_string, - "print_status": print_status, "client_address": client_address, }) out_json_raw, out_data = backend.handle_post(json.dumps(json_kvs), in_data) diff --git a/unit-stress.py b/unit-stress.py index a162b1b..07c1190 100644 --- a/unit-stress.py +++ b/unit-stress.py @@ -35,15 +35,13 @@ def fake_outer_request(): PACKET_SAMPLES, data, [], - query_string(), - print_status=False) + query_string()) def fake_inner_request(): server.handle_post( data, [], - query_string(), - print_status=False) + query_string()) def stress(): for i in range(3):