aglinxinyuan opened a new pull request, #6880:
URL: https://github.com/apache/texera/pull/6880

   ### What changes were proposed in this PR?
   
   Every spawned Python UDF worker prints this on stderr at import time, dozens 
of times per amber-integration CI run:
   
   ```
   site-packages/fs/__init__.py:4: UserWarning: pkg_resources is deprecated as 
an API. ...
   ```
   
   Root cause: the worker entry point imports `core.python_worker`, which 
transitively imports `fs` (PyFilesystem2, used by `ExecutorManager` for the tmp 
filesystem that holds UDF source code); `fs/__init__.py` imports 
`pkg_resources`, which emits a `UserWarning`. It is a Python `warnings` 
warning, not a loguru log, so the existing log-level knobs (#6797) cannot 
suppress it. `fs` still needs `pkg_resources` — that is why setuptools is 
range-pinned (#6412) — so the warning is expected and not actionable on our 
side.
   
   ```
   Before: worker spawn -> import core -> import fs -> UserWarning on stderr  
(every worker)
   After:  worker spawn -> install message-scoped filter -> import fs -> silent
   ```
   
   | File | Change |
   | --- | --- |
   | `amber/src/main/python/texera_run_python_worker.py` | 
`warnings.filterwarnings` scoped to this one message + `category=UserWarning`, 
installed above the core import chain |
   | `amber/pyproject.toml` | same filter mirrored via pytest `filterwarnings` 
so the suite's warnings summary is quiet too |
   
   Only this exact message is filtered — unrelated warnings still print 
(verified with an injected control warning). The companion `declare_namespace` 
DeprecationWarnings from `fs` remain, but they only surface in pytest 
summaries; Python's default filters already hide them in spawned worker 
processes.
   
   ### Any related issues, documentation, discussions?
   
   Listed as a follow-up item in #6796 (the log-verbosity reduction itself 
landed via #6797).
   
   ### How was this PR tested?
   
   - Reproduced with the exact pinned deps (setuptools 80.10.2, fs 2.4.16): 
importing `texera_run_python_worker` printed the `UserWarning` before the 
change and is silent after; an injected unrelated `UserWarning` still prints, 
confirming the filter is not a blanket ignore.
   - `pytest src/test/python -m "not integration"` from `amber/`: 749 passed 
and the `pkg_resources` `UserWarning` is gone from the warnings summary (the 
handful of Iceberg-catalog failures on this Windows machine are identical on a 
clean tree).
   - `ruff check` and `ruff format --check` pass on the edited file.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Fable 5)
   


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