Hello. Can someone help me sort out why I am getti...
# general
w
Hello. Can someone help me sort out why I am getting "unmatched glob" warnings when I definitely have files matching at least one of the globs listed (Relates to python_tests in pants 2.18)
c
we need more details in order to help you. What does the target look like in your BUILD file, for instance?
w
Absolutely!
Here you go: python_sources( ) python_tests( name="tests", )
File in same folder as that build file is named: test_log_handler.py
[WARN] Unmatched globs from myproject/python/myproject/server/modules_tests:modules_tests's
sources
field: ["myproject/python/myproject/server/modules_tests/*.py", "myproject/python/myproject/server/modules_tests/*.pyi"], excludes: ["myproject/python/myproject/server/modules_tests/*_test.py", "myproject/python/myproject/server/modules_tests/*_test.pyi", "myproject/python/myproject/server/modules_tests/conftest.py", "myproject/python/myproject/server/modules_tests/test_*.py", "myproject/python/myproject/server/modules_tests/test_*.pyi", "myproject/python/myproject/server/modules_tests/tests.py", "myproject/python/myproject/server/modules_tests/tests.pyi"]
Hmm. just noticing that "excludes" part of the message. May need your help to understand that one, Andreas
c
so it seems you don’t have any sources for your
python_sources
target there..
w
Thanks, Andreas - I was wondering if python_sources and python_tests depended on each other or conflicted with each other.
c
no conflict, they’re similar but includes different sources (test sources vs your application code sources). There’s a third category, primarily for any
conftest.py
files and the like with the
python_testutils
target.
from your error message
myproject/python/myproject/server/modules_tests:modules_tests
is the
python_sources
target, and as you can see, it excludes all test and test util sources..
it may be helpful to look at what
pants peek myproject/python/myproject/server/modules_tests::
shows.
w
Peek for the win!
👍 1
Another question - I'm working through the warnings because a recent code merge broke our lockfile generation. Unfortunately, I'm not getting much useful info from the error messages apart from this: pants.engine.process.ProcessExecutionFailure: Process 'Generate lockfile for python-default' failed with exit code 1. stdout: stderr: pid 187669 -> /home/ttr/.cache/pants/named_caches/pex_root/venvs/6f38c47a38cfe391ded8cd321a621a7af03495ae/73c7d7c618f ac01449fa6e57a21210c0eb8a8f21/bin/python -sE /home/ttr/.cache/pants/named_caches/pex_root/venvs/6f38c47a38cfe391ded8c d321a621a7af03495ae/73c7d7c618fac01449fa6e57a21210c0eb8a8f21/pex --disable-pip-version-check --no-python-version-warn ing --exists-action a --no-input --isolated -q --cache-dir /home/ttr/.cache/pants/named_caches/pex_root/pip_cache --l og /tmp/pants-sandbox-HQ2Pqq/.tmp/pex-pip-log.bnxwshol/pip.log download --dest /tmp/pants-sandbox-HQ2Pqq/.tmp/tmpxguo 5o_4/usr.bin.python3.11 GitPython amazon-textract-response-parser aws-cdk-lib<3.0.0,>=2.99.1 boto3 constructs<11.0.0,
=10.0.0 cython elasticsearch genmsg@ git+https://github.com/ros/genmsg.git@noetic-devel genpy@ git+https://github.co
m/ros/genpy.git@main marshmallow odfpy opendis@ git+https://github.com/open-dis/open-dis-python@master openpyxl panda s protobuf pycryptodome python-dateutil pyyaml pyzmq redis requests rospy setuptools untangle xlsxwriter xmlschema -- index-url https://pypi.org/simple/ --retries 5 --timeout 15 exited with 1 and STDERR: error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> See above for output.
Are there any flags I can use to get more details?
c
there are some tricks. I don’t recall all details/variants but you could run with
--keep-sandboxes=on_failure
go into the sandbox for the generate lockfiles one, and run from there:
PEX_VERBOSE=9 ./__run.sh
will give you more details.. also tailing the pip log file that you can find the path to using
ps
while it’s running can be helpful.
w
Thanks. I tried keep-sandboxes but there were mostly empty.
where is the log files stored?
c
I think they’re in temp file locations wiped once done… so if it fails quickly they’re gone, but you should be able to tweak args etc from the sandbox to have them in a more permanent location if you wish..
that is, the sandbox is a good troubleshooting place…
w
Thanks for your help. I'll try to make some headway and report back if I remain stuck.
👍 1