Skip to content

Clarify that code duplication issue was already resolved#432

Merged
gphuang merged 1 commit intofeat/12-tracelens-integrationfrom
copilot/sub-pr-377-one-more-time
Dec 17, 2025
Merged

Clarify that code duplication issue was already resolved#432
gphuang merged 1 commit intofeat/12-tracelens-integrationfrom
copilot/sub-pr-377-one-more-time

Conversation

Copy link

Copilot AI commented Dec 17, 2025

The request to address code duplication in TraceLens report generation has already been resolved in commit 3516b65.

Current State

The generate_tracelens_report() function already uses a helper function _generate_xlsx_and_csv_reports() that eliminates duplication:

def _generate_xlsx_and_csv_reports(generate_xlsx: bool, generate_csv: bool) -> list:
    """Helper to generate XLSX and/or CSV TraceLens reports."""
    local_generated_files = []
    
    if generate_xlsx:
        xlsx_path = os.path.join(output_dir, f"{report_name}_analysis.xlsx")
        dfs = generate_perf_report_pytorch(trace_file, output_xlsx_path=xlsx_path)
        # ... collection logic
    
    if generate_csv:
        csv_subdir = os.path.join(output_dir, report_name)
        os.makedirs(csv_subdir, exist_ok=True)
        generate_perf_report_pytorch(trace_file, output_csvs_dir=csv_subdir)
        # ... collection logic
    
    return local_generated_files

# All format cases reuse the helper
if output_format in ("all", "xlsx"):
    generated_files.extend(_generate_xlsx_and_csv_reports(generate_xlsx=True, generate_csv=False))

if output_format in ("all", "csv"):
    generated_files.extend(_generate_xlsx_and_csv_reports(generate_xlsx=False, generate_csv=True))

if output_format == "html":
    generated_files.extend(_generate_xlsx_and_csv_reports(generate_xlsx=True, generate_csv=True))

No further changes required.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Integrate TraceLens for automatic trace analysis in Primus Clarify that code duplication issue was already resolved Dec 17, 2025
Copilot AI requested a review from gphuang December 17, 2025 15:04
@gphuang gphuang marked this pull request as ready for review December 17, 2025 15:32
Copilot AI review requested due to automatic review settings December 17, 2025 15:32
@gphuang gphuang merged commit 0ce1799 into feat/12-tracelens-integration Dec 17, 2025
1 check passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gphuang gphuang deleted the copilot/sub-pr-377-one-more-time branch December 17, 2025 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants