Skip to content

Commit

Permalink
Fix build metrics report format with long placehold filenames (#17679)
Browse files Browse the repository at this point in the history
Truncates filenames that appear as multiple `placehold_placedhold_...` in the Build Metrics Report.
Example show here: https://downloads.rapids.ai/ci/cudf/pull-request/17669/0710ad6/cuda12_x86_64.ninja_log.html (requires VPN).

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Muhammad Haseeb (https://github.com/mhaseeb123)

URL: #17679
  • Loading branch information
davidwendt authored Jan 8, 2025
1 parent dc99d2f commit d05b78b
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions cpp/scripts/sort_ninja_log.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#
# Copyright (c) 2021-2024, NVIDIA CORPORATION.
# Copyright (c) 2021-2025, NVIDIA CORPORATION.
#
import argparse
import os
import re
import sys
import xml.etree.ElementTree as ET
from pathlib import Path
Expand Down Expand Up @@ -144,6 +145,16 @@ def format_file_size(input_size):
return file_size_str


def replace_placeholder_patterns(input_string: str) -> str:
pattern = r'(_h_env_placehold)[_placehold]+'
return re.sub(pattern, r'\1...', input_string)


# adjust name for display
def format_file_name(name: str) -> str:
return replace_placeholder_patterns(name)


# Output chart results in HTML format
# Builds a standalone html file with no javascript or styles
def output_html(entries, sorted_list, cmp_entries, args):
Expand Down Expand Up @@ -223,7 +234,8 @@ def output_html(entries, sorted_list, cmp_entries, args):
print("<td height='20px' width='", size, "px' ", sep="", end="")
# title text is shown as hover-text by most browsers
print(color, "title='", end="")
print(name, "\n", build_time_str, "' ", sep="", end="")
display_name = format_file_name(name)
print(display_name, "\n", build_time_str, "' ", sep="", end="")
# centers the name if it fits in the box
print("align='center' nowrap>", end="")
# use a slightly smaller, fixed-width font
Expand Down Expand Up @@ -265,7 +277,8 @@ def output_html(entries, sorted_list, cmp_entries, args):
file_size_str = format_file_size(file_size)

# output entry row
print("<tr ", color, "><td>", name, "</td>", sep="", end="")
display_name = format_file_name(name)
print("<tr ", color, "><td>", display_name, "</td>", sep="", end="")
print("<td align='right'>", build_time_str, "</td>", sep="", end="")
print("<td align='right'>", file_size_str, "</td>", sep="", end="")
# output diff column
Expand Down

0 comments on commit d05b78b

Please sign in to comment.