Skip to content

Fix NameError on every async query in the llama2-70b API SUT - #2663

Open
David-Wu1119 wants to merge 1 commit into
mlcommons:masterfrom
David-Wu1119:fix/sut-api-missing-import-sys
Open

Fix NameError on every async query in the llama2-70b API SUT#2663
David-Wu1119 wants to merge 1 commit into
mlcommons:masterfrom
David-Wu1119:fix/sut-api-missing-import-sys

Conversation

@David-Wu1119

Copy link
Copy Markdown

Summary

language/llama2-70b/SUT_API.py calls sys.exit() but never imports sys:

def async_process_query(self, input_ids_tensor, qitem_id, idx):
    ...
    lg.QuerySamplesComplete(response)
    sys.exit()          # sys is never imported in this file

async_process_query is used as a thread target:

worker = threading.Thread(
    target=self.async_process_query,
    ...
)

so instead of the intended SystemExit, each worker dies with

NameError: name 'sys' is not defined

and Python's threading.excepthook prints a traceback for every query. lg.QuerySamplesComplete(response) has already run by then, so a run still completes and the numbers are unaffected — but the exit never happens as written and the log fills with tracebacks.

ruff --select F821 flags it, and the file has no import sys anywhere (grep -c "import sys" -> 0).

Fix

Add import sys to the import block, so the call does what it says.

Notes

I kept this to the import rather than touching the sys.exit() itself: I can't tell from the code whether exiting the worker there is deliberate or a leftover, and adding the import makes the file behave as written without guessing. If it is a leftover, removing the line would be the better change and I'm happy to do that instead — a maintainer who knows the intent should make that call.

Heads up on overlap: #2391 also touches SUT_API.py (adding multinode support). I checked and it does not add import sys, so the two are complementary, but they will want rebasing around each other.

async_process_query ends with sys.exit() to finish the worker thread,
but SUT_API.py never imports sys. The thread therefore dies with

    NameError: name 'sys' is not defined

and, since the function is a thread target, Python's threading
excepthook prints a traceback for every query. The LoadGen response is
already submitted at that point, so the run still completes, but the
intended exit never happens and the log fills with tracebacks.
Copilot AI lite review requested due to automatic review settings September 3, 2026 14:59
@David-Wu1119
David-Wu1119 requested review from a team as code owners September 3, 2026 14:59

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

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.

2 participants