From 88642564b7638592eb00fab6d2ac38e6d43e9541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Ho=CC=88nicke?= Date: Tue, 18 Apr 2023 10:06:17 +0200 Subject: [PATCH] fix: out of tokens because of version logs --- src/apis/jina_cloud.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/apis/jina_cloud.py b/src/apis/jina_cloud.py index c1fe685..2e77f46 100644 --- a/src/apis/jina_cloud.py +++ b/src/apis/jina_cloud.py @@ -249,10 +249,17 @@ def update_client_line_in_file(file_path, host): def shorten_logs(relevant_lines): + # handle duplicate error messages for index, line in enumerate(relevant_lines): if '--- Captured stderr call ----' in line: relevant_lines = relevant_lines[:index] + # filter pip install logs relevant_lines = [line for line in relevant_lines if ' Requirement already satisfied: ' not in line] + # filter version not found logs + for index, line in enumerate(relevant_lines): + if 'ERROR: Could not find a version that satisfies the requirement ' in line: + start_and_end = line[:150] + '...' + line[-150:] + relevant_lines[index] = start_and_end return relevant_lines