Fix submission_checker import: robust fallback with importlib and sys.path priority#941
Merged
arjunsuresh merged 7 commits intodevfrom May 6, 2026
Merged
Conversation
Agent-Logs-Url: https://github.com/mlcommons/mlperf-automations/sessions/dc0adcaa-6a6b-4456-bf0c-08eb3460ac62 Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix import error for submission_checker module
Fix unhandled ImportError in submission_checker import fallback
May 5, 2026
Contributor
|
MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅ |
arjunsuresh
requested changes
May 6, 2026
Agent-Logs-Url: https://github.com/mlcommons/mlperf-automations/sessions/7164d849-b10f-4744-aaf2-32de7697ed7d Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com>
…th empty fallback Agent-Logs-Url: https://github.com/mlcommons/mlperf-automations/sessions/7164d849-b10f-4744-aaf2-32de7697ed7d Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com>
…cker dir Agent-Logs-Url: https://github.com/mlcommons/mlperf-automations/sessions/7164d849-b10f-4744-aaf2-32de7697ed7d Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com>
Contributor
Author
Fixed in commit
The fix:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
Fix unhandled ImportError in submission_checker import fallback
Fix submission_checker import: robust fallback with importlib and sys.path priority
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
import submission_checker as checkerfallback path ingenerate-mlperf-inference-user-conf/customize.pywas not wrapped in a try/except block, and thesys.path.appendcall placed the automotivetools/submissiondirectory at the end of sys.path — causing the wrong (or no) module to be found, andlog_parser(an internal dependency ofsubmission_checker.py) to be unfindable, resulting in a silently-caughtModuleNotFoundErrorand ultimately theAttributeError: submission_checker module is missing required constants for file checksCI failure on all non-Docker jobs.Changes
Both imports wrapped in try/except —
import submission_checker.constants as constantsandimport submission_checker as checkerare both wrapped intry/except (ImportError, ModuleNotFoundError, AttributeError).sys.path.insert(0, ...)instead ofsys.path.append— the automotive/inferencetools/submissiondirectory is inserted at the front of sys.path so it takes precedence over any other copy of the module on sys.path, andlog_parser.py(a dependency ofsubmission_checker.py) is reliably found.importlib.util.spec_from_file_locationfallback — when both standard imports fail (e.g., due to sys.modules caching or sys.path ordering), the module is loaded directly from the file, bypassing the Python import cache entirely. The directory is inserted at the front of sys.path beforeexec_modulesolog_parseris found._get_submission_checker_dir(env)helper — eliminates duplicatedos.path.join(env['MLC_MLPERF_INFERENCE_SOURCE'], "tools", "submission")path construction acrossget_checker_files()andget_required_min_queries_offline().import importlib.utilmoved to top-level imports and the importlib fallback'sexceptclause narrowed to specific types(ImportError, ModuleNotFoundError, AttributeError, OSError).🧾 PR Checklist
dev📌 Note: PRs must be raised against
dev. Do not commit directly tomain.📁 File Hygiene & Output Handling
📝 Comments & Communication
🛡️ Safety & Security
Original prompt
The CI build for PR #940 is failing with:
The root cause is in
script/generate-mlperf-inference-user-conf/customize.pyin the_get_submission_checker_constants_module()function (around line 584-607).The first import (
import submission_checker.constants as constants) is correctly wrapped in a try/except block, but the second import (import submission_checker as checkeron line 601) is NOT wrapped in a try/except block. If that import fails or the module doesn't have the required attributes, it either raises an unhandled ImportError or falls through to raise the AttributeError without a proper fallback.Fix needed: Wrap the second
import submission_checker as checkerblock (lines 601-603) in its owntry/except (ImportError, ModuleNotFoundError, AttributeError)block, consistent with the pattern used for the first import above it.The fixed code should look like:
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: How can I fix this build?
Assistant: The build is failing with this error:
This occurs at
script/run-mlperf-automotive-app/customize.py:265in thepreprocessfunction.Let me look at that file for more context:
Assistant: ## Build Failure Analysis
The job is failing with this error:
This occurs at
script/run-mlperf-automotive-app/customize.py:265during thepreprocessphase, when theapp,abtf-inferencescript is invoked.Root Cause
The script depends on the
submission_checkermodule from the MLPerf automotive benchmark source (cloned intoget-git-repo_automotive-src). That module is expected to expose certain constants for file checks, but the version being pulled no longer has them (or they've been renamed/restructured).How to Fix
You have a few options:
Pin the automotive source to a compatible commit — If the
get,src,source,automotivedependency pulls the latestmainbranch, the upstream repo may have changed. Add a specific commit or tag to the dependency to ensure compatibility.Update the code to match the new submission_checker API — Check what constants the automotive source's
submission_checker.pynow exports and update the consuming code accordingly. The error likely originates in a script called bymlc.access(ii)(theapp,abtf-inferenceimplementation script) that importssubmission_checkerand references constants that no longer exist.Check PR Support bert and resnet run using Nvidia6.0 code #940 changes — If this PR modified dependencies or version references for the automotive source, verify that the referenced version of the automotive repo is compatible with the checker logic used in the automation scripts.
Would you like me to look at any specific file (e.g., the script that actually imports and validates against
submission_checker) for more detail?User: The PR is having changes to script/generate-mlperf-inference-user-conf/customize.py and i see the try and catch block being handled wrongly. Can you fix it?
Assistant: Now I can see the issue. Let me look at the current state of the file on the PR branch:
Assistant: Now I can see the issue. Let me look at the current file on the PR branch to get the exact content:
Assistant: Now I can see the issue. In
_get_submission_checker_constants_module()(lines 584-607), the secondimport submission_checker as checkeron line 601 is not wrapped in a try/except block. ...This pull request was created from Copilot chat.