Skip to content

Commit dd42363

Browse files
committed
Revert "WIP: start repo-wide ruff cleanup"
This reverts commit dc0c35d.
1 parent dc0c35d commit dd42363

9 files changed

Lines changed: 335 additions & 362 deletions

analysis/dashboard/pareto_tab.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,11 @@ def _fmt_delta(pct):
122122
st.warning("Select exactly 2 points to compare. Clear selection and try again.")
123123

124124
# Clear selection button (visible when any points are selected)
125-
if len(points) >= 1 and st.button("Clear selection", key="clear_pareto_selection"):
126-
st.session_state.pareto_chart_gen += 1
127-
st.session_state.pareto_swapped = False
128-
st.rerun()
125+
if len(points) >= 1:
126+
if st.button("Clear selection", key="clear_pareto_selection"):
127+
st.session_state.pareto_chart_gen += 1
128+
st.session_state.pareto_swapped = False
129+
st.rerun()
129130

130131
# Debug info for frontier
131132
if pareto_options["show_frontier"]:

analysis/srtlog/cache_manager.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,14 @@ def save_to_cache(self, cache_name: str, data: pd.DataFrame | list[dict], source
126126
source_patterns: Glob patterns for source files
127127
"""
128128
# Convert to DataFrame if needed
129-
df = (pd.DataFrame() if not data else pd.DataFrame(data)) if isinstance(data, list) else data
129+
if isinstance(data, list):
130+
if not data:
131+
# Save empty DataFrame
132+
df = pd.DataFrame()
133+
else:
134+
df = pd.DataFrame(data)
135+
else:
136+
df = data
130137

131138
# Save to parquet
132139
cache_file = self.cache_dir / f"{cache_name}.parquet"

analysis/srtlog/config_reader.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,19 @@ def validate_config_structure(config: dict[str, Any], config_path: str) -> None:
3434
)
3535

3636
# Validate nested structure
37-
if "config" in config and "server_args" not in config["config"]:
38-
logger.warning(
39-
f"Config at {config_path} missing 'server_args' in 'config'. "
40-
f"Available keys in config: {list(config['config'].keys())}"
41-
)
37+
if "config" in config:
38+
if "server_args" not in config["config"]:
39+
logger.warning(
40+
f"Config at {config_path} missing 'server_args' in 'config'. "
41+
f"Available keys in config: {list(config['config'].keys())}"
42+
)
4243

43-
if "gpu_info" in config and "gpus" not in config["gpu_info"]:
44-
logger.warning(
45-
f"Config at {config_path} missing 'gpus' in 'gpu_info'. "
46-
f"Available keys: {list(config['gpu_info'].keys())}"
47-
)
44+
if "gpu_info" in config:
45+
if "gpus" not in config["gpu_info"]:
46+
logger.warning(
47+
f"Config at {config_path} missing 'gpus' in 'gpu_info'. "
48+
f"Available keys: {list(config['gpu_info'].keys())}"
49+
)
4850

4951

5052
def read_config_file(config_path: str) -> NodeConfig | None:

analysis/srtlog/visualizations.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,10 @@ def create_node_metric_graph(
291291
continue
292292

293293
# Extract value
294-
value = value_extractor(batch) if value_extractor else batch.get(metric_key)
294+
if value_extractor:
295+
value = value_extractor(batch)
296+
else:
297+
value = batch.get(metric_key)
295298

296299
if value is not None:
297300
timestamps.append(batch["timestamp"])
@@ -513,10 +516,11 @@ def calculate_pareto_frontier(df: pd.DataFrame, y_metric: str = "Output TPS/GPU"
513516

514517
# Check if this point is dominated by any other point
515518
for j, (x2, y2) in enumerate(points):
516-
if i != j and x2 >= x1 and y2 >= y1 and (x2 > x1 or y2 > y1):
519+
if i != j:
517520
# Point (x2, y2) dominates (x1, y1) if it's better in both dimensions
518-
is_dominated = True
519-
break
521+
if x2 >= x1 and y2 >= y1 and (x2 > x1 or y2 > y1):
522+
is_dominated = True
523+
break
520524

521525
if not is_dominated:
522526
frontier.append((x1, y1))

0 commit comments

Comments
 (0)