File tree Expand file tree Collapse file tree 2 files changed +0
-39
lines changed
Expand file tree Collapse file tree 2 files changed +0
-39
lines changed Original file line number Diff line number Diff line change 1111 convert_boolean_value ,
1212 create_table ,
1313 get_base_url ,
14- get_latest_metric ,
1514 is_server_running ,
1615 load_config ,
1716 model_health_check ,
@@ -150,24 +149,6 @@ def test_create_table_without_header():
150149 assert table .show_header is False
151150
152151
153- @pytest .mark .parametrize (
154- "log_lines,expected" ,
155- [
156- (
157- ["2023-01-01 [INFO] Avg prompt throughput: 5.2, Avg token throughput: 3.1" ],
158- {"Avg prompt throughput" : "5.2" , "Avg token throughput" : "3.1" },
159- ),
160- (["No metrics here" ], {}),
161- ([], {}),
162- (["Invalid metric format" ], {}),
163- ],
164- )
165- def test_get_latest_metric (log_lines , expected ):
166- """Test that get_latest_metric returns the latest metric entry."""
167- result = get_latest_metric (log_lines )
168- assert result == expected
169-
170-
171152def test_load_config_default_only ():
172153 """Test loading the actual default configuration file from the filesystem."""
173154 configs = load_config ()
Original file line number Diff line number Diff line change @@ -160,26 +160,6 @@ def load_config() -> list[ModelConfig]:
160160 ]
161161
162162
163- def get_latest_metric (log_lines : list [str ]) -> Union [str , dict [str , str ]]:
164- """Read the latest metric entry from the log file."""
165- latest_metric = {}
166-
167- try :
168- for line in reversed (log_lines ):
169- if "Avg prompt throughput" in line :
170- # Parse the metric values from the line
171- metrics_str = line .split ("] " )[1 ].strip ().strip ("." )
172- metrics_list = metrics_str .split (", " )
173- for metric in metrics_list :
174- key , value = metric .split (": " )
175- latest_metric [key ] = value
176- break
177- except Exception as e :
178- return f"[red]Error reading log file: { e } [/red]"
179-
180- return latest_metric
181-
182-
183163def convert_boolean_value (value : Union [str , int , bool ]) -> bool :
184164 """Convert various input types to boolean strings."""
185165 if isinstance (value , str ):
You can’t perform that action at this time.
0 commit comments