firasbouzazi opened a new pull request, #59384: URL: https://github.com/apache/spark/pull/59384
### What changes were proposed in this pull request? Backport of #59242 to branch-4.0. Fix the warning that `TorchDistributor._run_distributed_training` emits when the log streaming server fails to start. The message had a stray comma, so the error text was passed to `logger.warning` as an extra positional argument, and formatting the record raised `TypeError: not all arguments converted during string formatting`. The warning now uses a single format string with the exception as its argument. The cherry-pick conflicted only in the test file, where master has a neighbouring test that is not on this branch. Adaptations to the test: - The test does not assert `log_streaming_auth_secret`, which does not exist on this branch. - The test file now imports `MagicMock`, which it did not import on this branch. - The test uses nested `with` statements instead of a parenthesized context manager, since this branch supports Python versions older than 3.10. ### Why are the changes needed? Users see a `--- Logging error ---` traceback instead of the one-line warning explaining why worker logs are missing (or nothing, with `logging.raiseExceptions = False`). ### Does this PR introduce _any_ user-facing change? Yes. When the log streaming server fails to start, users get the intended warning instead of a logging error traceback. ### How was this patch tested? `test_log_streaming_server_start_failure_warns` (added in #59242) fails with the `TypeError` above without the fix and passes with it on this branch. `TorchDistributorBaselineUnitTests` passes. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
