Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/scripts/parse_buildkit_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ def parse_sccache_json_from_log(
cleaned_json = "\n".join(cleaned_lines)

if debug:
print(f"DEBUG: Parsing JSON block {i+1}", file=sys.stderr)
print(f"DEBUG: Parsing JSON block {i + 1}", file=sys.stderr)

# Parse JSON
section_data = json.loads(cleaned_json)

# Extract key metrics into flat structure
section_name = section_data.get("section", f"section_{i+1}")
section_name = section_data.get("section", f"section_{i + 1}")
timestamp = section_data.get("timestamp", "")
native_stats = section_data.get("sccache_stats", {})

Expand Down Expand Up @@ -129,10 +129,10 @@ def parse_sccache_json_from_log(

except json.JSONDecodeError as e:
if debug:
print(f"DEBUG: JSON parse error in block {i+1}: {e}", file=sys.stderr)
print(f"DEBUG: JSON parse error in block {i + 1}: {e}", file=sys.stderr)
except Exception as e:
if debug:
print(f"DEBUG: Error parsing block {i+1}: {e}", file=sys.stderr)
print(f"DEBUG: Error parsing block {i + 1}: {e}", file=sys.stderr)

return sccache_sections

Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/detect_broken_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,9 @@ def detect_problematic_symlinks(

# Check if symlink is broken (target doesn't exist)
if not symlink_path.exists():
symlink_info[
"issue"
] = f"Broken symlink: target '{target_path}' does not exist"
symlink_info["issue"] = (
f"Broken symlink: target '{target_path}' does not exist"
)
problematic_symlinks["broken"].append(symlink_info)
logger.warning(f"Broken symlink found: {symlink} -> {target_path}")
continue
Expand All @@ -723,9 +723,9 @@ def detect_problematic_symlinks(
continue
except (OSError, RuntimeError) as e:
if "Too many levels of symbolic links" in str(e):
symlink_info[
"issue"
] = "Circular symlink: too many levels of symbolic links"
symlink_info["issue"] = (
"Circular symlink: too many levels of symbolic links"
)
problematic_symlinks["circular"].append(symlink_info)
logger.warning(f"Circular symlink found: {symlink}")
continue
Expand All @@ -735,9 +735,9 @@ def detect_problematic_symlinks(
try:
symlink_path.relative_to(git_root_path)
except ValueError:
symlink_info[
"issue"
] = f"External symlink: points outside repository to '{symlink_path}'"
symlink_info["issue"] = (
f"External symlink: points outside repository to '{symlink_path}'"
)
problematic_symlinks["external"].append(symlink_info)
logger.warning(
f"External symlink found: {symlink} -> {symlink_path}"
Expand All @@ -746,17 +746,17 @@ def detect_problematic_symlinks(

# Check for suspicious patterns (e.g., very long paths, unusual targets)
if len(str(target_path)) > 200:
symlink_info[
"issue"
] = f"Suspicious symlink: unusually long target path ({len(str(target_path))} characters)"
symlink_info["issue"] = (
f"Suspicious symlink: unusually long target path ({len(str(target_path))} characters)"
)
problematic_symlinks["suspicious"].append(symlink_info)
logger.info(f"Suspicious symlink found: {symlink} (long path)")

# Check if target is in a different directory tree (potential maintenance issue)
if "../" in str(target_path) and str(target_path).count("../") > 3:
symlink_info[
"issue"
] = f"Suspicious symlink: target requires many directory traversals ('{target_path}')"
symlink_info["issue"] = (
f"Suspicious symlink: target requires many directory traversals ('{target_path}')"
)
problematic_symlinks["suspicious"].append(symlink_info)
logger.info(f"Suspicious symlink found: {symlink} (many traversals)")

Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/upload_complete_workflow_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,9 +757,9 @@ def _upload_container_metrics(
# Identity & Context - container-specific fields only
job_id = str(job_data["id"])
job_name = job_data["name"]
container_data[
FIELD_ID
] = f"github-container-{job_id}-{build_metrics.get('framework', 'unknown')}"
container_data[FIELD_ID] = (
f"github-container-{job_id}-{build_metrics.get('framework', 'unknown')}"
)
container_data[FIELD_JOB_NAME] = str(job_name)
container_data[FIELD_JOB_ID] = job_id

Expand Down Expand Up @@ -937,9 +937,9 @@ def _upload_test_metrics(self, job_data: Dict[str, Any]) -> None:
if test_classname
else test_name
)
test_data[
FIELD_ID
] = f"github-test-{job_id}-{hash(test_full_name) & 0x7FFFFFFF}" # Use hash for unique ID
test_data[FIELD_ID] = (
f"github-test-{job_id}-{hash(test_full_name) & 0x7FFFFFFF}" # Use hash for unique ID
)
test_data[FIELD_STEP_ID] = test_step_id
test_data[FIELD_JOB_ID] = job_id

Expand Down Expand Up @@ -991,9 +991,9 @@ def _upload_test_metrics(self, job_data: Dict[str, Any]) -> None:
)

test_data[FIELD_TEST_STATUS] = test_status
test_data[
FIELD_STATUS
] = test_status # Also set general status field
test_data[FIELD_STATUS] = (
test_status # Also set general status field
)

if error_msg:
test_data[FIELD_ERROR_MESSAGE] = error_msg[
Expand Down
10 changes: 5 additions & 5 deletions benchmarks/frontend/scripts/analysis/create_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,13 @@ def section_transport_breakdown(prom: Optional[PrometheusSnapshot]) -> Optional[
if prom.work_handler_network_transit:
t = prom.work_handler_network_transit
parts_rows.append(
f"| Part 1 - Network transit (T2-T1) | {t['p50']*1000:.2f} | {t['p95']*1000:.2f} | {t['p99']*1000:.2f} |"
f"| Part 1 - Network transit (T2-T1) | {t['p50'] * 1000:.2f} | {t['p95'] * 1000:.2f} | {t['p99'] * 1000:.2f} |"
)

if prom.work_handler_time_to_first_response:
t = prom.work_handler_time_to_first_response
parts_rows.append(
f"| Part 2 - Processing (T3-T2) | {t['p50']*1000:.2f} | {t['p95']*1000:.2f} | {t['p99']*1000:.2f} |"
f"| Part 2 - Processing (T3-T2) | {t['p50'] * 1000:.2f} | {t['p95'] * 1000:.2f} | {t['p99'] * 1000:.2f} |"
)

if parts_rows:
Expand Down Expand Up @@ -581,15 +581,15 @@ def section_system_resources(obs_dir: Path) -> Optional[str]:
if thread_data:
values = [v for _, v in thread_data]
rows.append(
f"| Threads | {min(values):.0f} | {max(values):.0f} | {sum(values)/len(values):.0f} | {len(values)} |"
f"| Threads | {min(values):.0f} | {max(values):.0f} | {sum(values) / len(values):.0f} | {len(values)} |"
)

# FD count
fd_data = parse_timeseries(system_dir / "fd_count.txt", "fds")
if fd_data:
values = [v for _, v in fd_data]
rows.append(
f"| FDs | {min(values):.0f} | {max(values):.0f} | {sum(values)/len(values):.0f} | {len(values)} |"
f"| FDs | {min(values):.0f} | {max(values):.0f} | {sum(values) / len(values):.0f} | {len(values)} |"
)

if not rows:
Expand Down Expand Up @@ -639,7 +639,7 @@ def section_key_findings(
# Check transport breakdown
if prom.request_plane_roundtrip_ttft_p50 > 0.1:
findings.append(
f"High roundtrip TTFT p50: {prom.request_plane_roundtrip_ttft_p50*1000:.0f}ms (> 100ms)"
f"High roundtrip TTFT p50: {prom.request_plane_roundtrip_ttft_p50 * 1000:.0f}ms (> 100ms)"
)

# Tokio health
Expand Down
24 changes: 12 additions & 12 deletions benchmarks/frontend/scripts/analysis/frontend_perf_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ def print_scalability_table(points: list[TestPoint]) -> None:
concurrencies = sorted(set(p.concurrency for p in points))

for isl in isls:
print(f"\n{'='*80}")
print(f"\n{'=' * 80}")
print(f"ISL = {isl}")
print(f"{'='*80}")
print(f"{'=' * 80}")
print(
f"{'Conc':>6} {'TTFT p50':>10} {'TTFT p95':>10} {'ITL p50':>10} "
f"{'ITL p95':>10} {'Tput tok/s':>12} {'RPS':>8}"
Expand All @@ -225,9 +225,9 @@ def print_scalability_table(points: list[TestPoint]) -> None:

def print_stage_waterfall(points: list[TestPoint]) -> None:
"""Print stage breakdown at each load level."""
print(f"\n{'='*80}")
print(f"\n{'=' * 80}")
print("Pipeline Stage Breakdown (p50 seconds)")
print(f"{'='*80}")
print(f"{'=' * 80}")

stages = ["preprocess", "route", "transport_roundtrip", "postprocess"]
header = f"{'Key':>20}"
Expand All @@ -248,9 +248,9 @@ def print_stage_waterfall(points: list[TestPoint]) -> None:

def print_transport_breakdown(points: list[TestPoint]) -> None:
"""Print transport overhead: queue_seconds vs roundtrip_ttft_seconds."""
print(f"\n{'='*80}")
print(f"\n{'=' * 80}")
print("Transport Overhead (p50 seconds)")
print(f"{'='*80}")
print(f"{'=' * 80}")
print(f"{'Key':>20} {'Queue (encode)':>16} {'RT TTFT (net)':>16} {'Inflight':>10}")
print("-" * 70)

Expand All @@ -266,9 +266,9 @@ def print_transport_breakdown(points: list[TestPoint]) -> None:

def print_tokio_health(points: list[TestPoint]) -> None:
"""Print tokio health indicators."""
print(f"\n{'='*80}")
print(f"\n{'=' * 80}")
print("Tokio Health")
print(f"{'='*80}")
print(f"{'=' * 80}")
print(
f"{'Key':>20} {'Avg Poll ns':>12} {'Max Poll ns':>12} "
f"{'Stalls':>8} {'Queue':>8} {'Yields':>8} {'Busy Avg':>10}"
Expand Down Expand Up @@ -329,12 +329,12 @@ def compare_runs(
print("ERROR: No matching test points between baseline and candidate.")
return

print(f"\n{'='*100}")
print(f"\n{'=' * 100}")
print(
f"A/B Comparison: {baseline_dir.name} (baseline) vs {candidate_dir.name} (candidate)"
)
print(f"Regression threshold: {threshold_pct}%")
print(f"{'='*100}")
print(f"{'=' * 100}")
print(
f"{'Key':>20} {'TTFT p50 B':>12} {'TTFT p50 C':>12} {'Delta%':>8} "
f"{'ITL p50 B':>12} {'ITL p50 C':>12} {'Delta%':>8} {'Status':>12}"
Expand Down Expand Up @@ -400,9 +400,9 @@ def print_heatmap(points: list[TestPoint]) -> None:

point_map = {(p.concurrency, p.isl): p for p in points}

print(f"\n{'='*80}")
print(f"\n{'=' * 80}")
print("TTFT p95 Heatmap (ms) — Concurrency x ISL")
print(f"{'='*80}")
print(f"{'=' * 80}")

# Header
header = f"{'Conc':>8}"
Expand Down
4 changes: 1 addition & 3 deletions benchmarks/llm/plot_pareto.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ def parse_gpus(deployment_config_json_path):
"prefill_tensor_parallelism"
) * deployment_config.get("prefill_data_parallelism") + deployment_config.get(
"decode_tensor_parallelism"
) * deployment_config.get(
"decode_data_parallelism"
)
) * deployment_config.get("decode_data_parallelism")


def parse_kind_and_mode(deployment_config_json_path):
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/multimodal/jsonl/generate_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def sample_slots(
"""
pool_size = len(pool)
total_slots = num_requests * images_per_request
assert (
pool_size >= images_per_request
), f"images-pool ({pool_size}) must be >= images-per-request ({images_per_request})"
assert pool_size >= images_per_request, (
f"images-pool ({pool_size}) must be >= images-per-request ({images_per_request})"
)
assert total_slots >= pool_size, (
f"total slots ({num_requests}×{images_per_request}={total_slots}) < "
f"images-pool ({pool_size}). Increase --num-requests or --images-per-request, "
Expand Down
8 changes: 4 additions & 4 deletions benchmarks/nat_trace/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def print_statistics(mooncake_data: list):

turns_per_session = [len(turns) for turns in sessions.values()]
print(
f"Turns per session: min={min(turns_per_session)}, max={max(turns_per_session)}, avg={sum(turns_per_session)/len(turns_per_session):.1f}"
f"Turns per session: min={min(turns_per_session)}, max={max(turns_per_session)}, avg={sum(turns_per_session) / len(turns_per_session):.1f}"
)

print(f"Total LLM calls: {len(mooncake_data)}")
Expand All @@ -355,19 +355,19 @@ def print_statistics(mooncake_data: list):
print("\nInput Length (prompt_tokens):")
print(f" Min: {min(input_lengths)}")
print(f" Max: {max(input_lengths)}")
print(f" Avg: {sum(input_lengths)/len(input_lengths):.1f}")
print(f" Avg: {sum(input_lengths) / len(input_lengths):.1f}")

print("\nOutput Length (completion_tokens):")
print(f" Min: {min(output_lengths)}")
print(f" Max: {max(output_lengths)}")
print(f" Avg: {sum(output_lengths)/len(output_lengths):.1f}")
print(f" Avg: {sum(output_lengths) / len(output_lengths):.1f}")

# Hash statistics
hash_lengths = [len(e["hash_ids"]) for e in mooncake_data]
print("\nHash IDs per entry:")
print(f" Min: {min(hash_lengths)}")
print(f" Max: {max(hash_lengths)}")
print(f" Avg: {sum(hash_lengths)/len(hash_lengths):.1f}")
print(f" Avg: {sum(hash_lengths) / len(hash_lengths):.1f}")

print("=" * 60)

Expand Down
12 changes: 6 additions & 6 deletions benchmarks/prefix_data_generator/synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ def __init__(
self.osl_multiplier = float(osl_multiplier)

# assert correct arg bounds
assert (
isinstance(self.num_copies, int) and self.num_copies >= 1
), "num_copies must be an integer greater than or equal to 1"
assert (
isinstance(self.speedup_ratio, float) and self.speedup_ratio > 0
), "speedup_ratio must be a positive float"
assert isinstance(self.num_copies, int) and self.num_copies >= 1, (
"num_copies must be an integer greater than or equal to 1"
)
assert isinstance(self.speedup_ratio, float) and self.speedup_ratio > 0, (
"speedup_ratio must be a positive float"
)
assert (
isinstance(self.prefix_len_multiplier, float)
and self.prefix_len_multiplier > 0
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/prefix_data_generator/tests/test_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def test_empirical_sampler_distribution():

# Verify each number (1, 2, 3) appears between 300 and 400 times
for value in [1, 2, 3]:
assert (
300 <= counts[value] <= 400
), f"Value {value} appeared {counts[value]} times, expected 300-400 times"
assert 300 <= counts[value] <= 400, (
f"Value {value} appeared {counts[value]} times, expected 300-400 times"
)

# Verify no other values appear in the samples
assert set(counts.keys()) == {
Expand Down
24 changes: 12 additions & 12 deletions benchmarks/prefix_data_generator/tests/test_synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,27 @@ def check_attributes(
):
# Check children
actual_children = list(graph.successors(node))
assert sorted(actual_children) == sorted(
expected_children
), f"Node {node} has children {actual_children}, expected {expected_children}"
assert sorted(actual_children) == sorted(expected_children), (
f"Node {node} has children {actual_children}, expected {expected_children}"
)

# Check 'visited' attribute if expected
if expected_visited is not None:
assert (
graph.nodes[node].get("visited") == expected_visited
), f"Node {node} has 'visited' value {graph.nodes[node].get('visited')}, expected {expected_visited}"
assert graph.nodes[node].get("visited") == expected_visited, (
f"Node {node} has 'visited' value {graph.nodes[node].get('visited')}, expected {expected_visited}"
)

# Check 'length' attribute if expected
if expected_length is not None:
assert (
graph.nodes[node].get("length") == expected_length
), f"Node {node} has 'length' value {graph.nodes[node].get('length')}, expected {expected_length}"
assert graph.nodes[node].get("length") == expected_length, (
f"Node {node} has 'length' value {graph.nodes[node].get('length')}, expected {expected_length}"
)

# Check 'to_leaf' attribute if expected
if expected_to_leaf is not None:
assert (
graph.nodes[node].get("to_leaf") == expected_to_leaf
), f"Node {node} has 'to_leaf' value {graph.nodes[node].get('to_leaf')}, expected {expected_to_leaf}"
assert graph.nodes[node].get("to_leaf") == expected_to_leaf, (
f"Node {node} has 'to_leaf' value {graph.nodes[node].get('to_leaf')}, expected {expected_to_leaf}"
)

return True

Expand Down
1 change: 1 addition & 0 deletions components/src/dynamo/common/configuration/arg_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

"""Base ArgGroup interface."""

import argparse
from abc import ABC, abstractmethod

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ def _tensor_size(tensor: torch.Tensor) -> int:
Raises:
AssertionError: If tensor is not contiguous.
"""
assert (
tensor.is_contiguous()
), "Tensor must be contiguous for accurate size calculation"
assert tensor.is_contiguous(), (
"Tensor must be contiguous for accurate size calculation"
)
return tensor.element_size() * tensor.numel()

def get(self, key: str) -> Optional[CachedEmbedding]:
Expand Down
Loading
Loading