Improve exception handling in Engine tracking logic#33
Conversation
- Use `exc_info=True` in `logger.error` to log full tracebacks for exceptions during tracking info save. - Remove `df_tracking.select(...).show()` to eliminate unnecessary debug output in production. - Add unit test `test_tracking_exception_logging` in `tests/test_engine.py` to verify proper exception logging. Co-authored-by: mysticBliss <11345806+mysticBliss@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This PR addresses a code health issue in
datamov/core/engine/Engine.pywhere exceptions during the saving of tracking information were logged without a traceback, making debugging difficult.Changes:
Modified
datamov/core/engine/Engine.py:logger.error("Failed to save tracking info: {}".format(e))tologger.error("Failed to save tracking info", exc_info=True). This ensures the full stack trace is logged.df_tracking.select('dm_etl_uuid', 'load_status').show()to clean up stdout from debug prints.ein theexceptblock.Updated
tests/test_engine.py:test_tracking_exception_loggingto verify thatlogger.erroris called withexc_info=Truewhen an exception occurs during tracking dataframe creation.Verification:
PYTHONPATH=. pytest tests/test_engine.py- Passed.tests/test_integration.pyfailures are unrelated to these changes.PR created automatically by Jules for task 5194203951055708408 started by @mysticBliss