Skip to content

Fix three defects in tools/submission/log_parser.py - #2662

Open
David-Wu1119 wants to merge 1 commit into
mlcommons:masterfrom
David-Wu1119:fix/log-parser-undefined-names
Open

Fix three defects in tools/submission/log_parser.py#2662
David-Wu1119 wants to merge 1 commit into
mlcommons:masterfrom
David-Wu1119:fix/log-parser-undefined-names

Conversation

@David-Wu1119

Copy link
Copy Markdown

Summary

Three defects in tools/submission/log_parser.py, all in MLPerfLog:

1. get_dict() never returns. It builds result and falls off the end, so every caller gets None:

def get_dict(self):
    """Get a dict representing the log. If a key appears multiple times, the first one is used."""
    result = {}
    for message in self.messages:
        ...
    # no return

2. The duplicate-key warning references an undefined key. It formats key rather than message["key"], so the moment a log contains the same key twice, get_dict() raises:

NameError: name 'key' is not defined

3. dump() opens an undefined log_path. The parameter is called output_path, so dump() raises NameError on every call.

ruff --select F821 flags both undefined names.

Verification

Exercising all three paths on a small MLPerfLog with a deliberate duplicate key:

Before —

NameError: name 'key' is not defined

After —

[WARNING] There are multiple messages with key a in the log. Emprically choosing the first one.
get_dict -> {'a': 1, 'b': 3}
dump wrote 3 messages

So the first-one-wins behaviour the docstring promises now actually holds, the warning names the offending key, and dump() writes to the path it was given.

Notes

ruff --select F821 is clean on the file afterwards. I kept the existing wording of the warning, including the "Emprically" typo, so the diff stays limited to the defects — happy to fix the spelling too if you'd like it in the same PR.

get_dict built its result dict and never returned it, so every caller
received None. Its duplicate-key warning branch formatted an undefined
`key`, raising NameError as soon as a log contained the same key twice.
And dump opened an undefined `log_path` rather than its own output_path
parameter, so it raised NameError on every call.

Return the dict, format message["key"], and write to output_path.
Copilot AI lite review requested due to automatic review settings September 3, 2026 14:58
@David-Wu1119
David-Wu1119 requested review from a team as code owners September 3, 2026 14:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

MLCommons CLA bot:
Thank you very much for your submission; we really appreciate it. Before we can accept your contribution,
we ask that you sign the MLCommons CLA (Apache 2). Please submit your GitHub ID to our onboarding form to initiate
authorization. If you are from a MLCommons member organization, we will request that you be added to the CLA.
If you are not from a member organization, we will email you a CLA to sign. For any questions, please contact
support@mlcommons.org.
0 out of 1 committers have signed the MLCommons CLA.
@David-Wu1119
You can retrigger this bot by commenting recheck in this Pull Request

@David-Wu1119

Copy link
Copy Markdown
Author

Could a maintainer advise on the right way to sign the individual CLA? The documented path currently loops back on itself.

  • CONTRIBUTING.md links the CLA sign-up form at https://forms.gle/Ew1KkBVpyeJDuRw67. That form has been retired, and says: "Please visit https://mlcommons.org/community/subscribe/ and enter your email address and GitHub ID."
  • The bot comment above links to that same page. It has no GitHub ID field and makes no mention of a CLA — it says "Submit your organizational email address to access your profile settings."

So there is nowhere to actually submit a GitHub ID, and as an individual contributor rather than a member-organization employee I don't have an organizational address to enter.

I'm happy to sign — just need a working link or an address to send it to. GitHub ID is David-Wu1119.

Once it's sorted I'll comment recheck here and on #2663, #2664 and #2665, which are blocked on the same check. If it's useful I'm also glad to send a small PR updating the CONTRIBUTING.md link to whatever the current form is, so the next contributor doesn't hit this.

@arjunsuresh

Copy link
Copy Markdown
Contributor

@David-Wu1119 I'm not fully sure of the current process as they have been changed recently. But I expect that the bot comment is the most up to date one and in case of any issues, support email is the best place to go. As an individual contributor - once you sign up as a member you can provide the GitHub id. I'm not sure if currently the GitHub id is automatically taken from the member email in which case the signup email must be linked to the GitHub account.

Thank you very much for your submission; we really appreciate it. Before we can accept your contribution,
we ask that you sign the MLCommons CLA (Apache 2). Please submit your GitHub ID to our [onboarding form](https://mlcommons.org/community/subscribe/) to initiate
authorization. If you are from a MLCommons member organization, we will request that you be added to the CLA.
If you are not from a member organization, we will email you a CLA to sign. For any questions, please contact
[support@mlcommons.org](mailto:support@mlcommons.org).

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