tannnmayy opened a new pull request, #40855:
URL: https://github.com/apache/beam/pull/40855

   Fixes #40854
   
   `import resource` and the `ModelManager` import shared one try block in
   `apache_beam/ml/inference/base.py`. When ModelManager's dependencies (torch)
   are missing, the except branch also set `resource = None`, so on Linux/macOS
   RunInference reported 0 for model memory (`model_byte_size`) and logged
   "Resource module is not available..." twice per model load.
   
   This splits the block so each import falls back independently, and adds a
   regression test that blocks the model_manager import in a fresh interpreter
   and checks that `resource` is still available.
   
   Testing:
   - The new test fails without the fix and passes with it (Linux, Python 3.14).
   - base_test.py passes on Linux and Windows (the new test is skipped on
     Windows, where `resource` doesn't exist).
   - ruff, yapf and pyrefly report no issues on the changed files.
   
   The fix and the regression test were written by me and I independently 
reviewed everything and ran the checks multiple times, 
   I did use my ai to help me navigate beam and to learn more about it, since 
this is my first time contributing to beam. 


-- 
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]

Reply via email to