fix(waste_identification_ml): correct logger.exception calls in inference_pipeline#13635
Draft
Bojun-Vvibe wants to merge 1 commit intotensorflow:masterfrom
Draft
fix(waste_identification_ml): correct logger.exception calls in inference_pipeline#13635Bojun-Vvibe wants to merge 1 commit intotensorflow:masterfrom
Bojun-Vvibe wants to merge 1 commit intotensorflow:masterfrom
Conversation
…ence_pipeline logger.exception() already captures the current exception and does not accept extra positional args for the exception object. The prior calls passed an 'e' variable as an extra arg, which would be appended to the log record args rather than used for the traceback. Additionally, the cropping block's except clause bound no name but still referenced 'e', which would raise NameError if that path executed. Also fixes the spelling (occured -> occurred) in the log messages.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Repo: tensorflow/models (⭐ 77668)
Type: bugfix
Files changed: 1
Lines: +7/-7
What
Fixes four misuses of
logger.exception()inofficial/projects/waste_identification_ml/Triton_TF_Cloud_Deployment/client/inference_pipeline.py. Each call passed the bound exception variableeas an extra positional arg (logger.exception("Exception occured:", e)), which theloggingmodule treats as a format arg — not as traceback information — and which can raise a formatting error. The final call in the cropping block referencededespite itsexceptclause not binding a name, which would raiseNameErrorif that branch ever executed. All four sites are nowlogger.exception("Exception occurred."), and the unusedas ebindings are dropped. Also corrects the misspelling "occured" → "occurred".Why
logger.exceptionautomatically attaches the current exception's traceback (it's equivalent tologger.error(..., exc_info=True)). Passing the exception object as a second arg is both redundant and incorrect: the message contains no%s, sologgingtries to format with a stray arg. More seriously, the cropping block's handler (except (...) :with noas e) references an undefinede, so a genuine failure there turns into aNameErrorthat masks the original error.Testing
python3 -m py_compile/ast.parseon the modified file: passes.logger.exceptionwith a plain message; the bound name is removed where it is no longer needed.NameError/format mismatch.Risk
Low — change is confined to four
exceptblocks inside one file; purely corrects error-logging calls and a typo, no control-flow change.