So, being told better error messages are coming, I...
# general
a
So, being told better error messages are coming, I updated to 2.13:
Copy code
00:06:19.65 [ERROR] Encountered 2 rule graph errors:
  No installed rules return the type BuildFileAddressRequest, and it was not provided by potential callers of @rule(pants.engine.internals.build_files:150:find_build_file(BuildFileAddressRequest) -> BuildFileAddress, gets=[Get(AddressFamily, AddressFamilyDir)]).
    If that type should be computed by a rule, ensure that that rule is installed.
    If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
  No source of dependency Get(AddressFamily, AddressFamilyDir) for @rule(pants.engine.internals.build_files:150:find_build_file(BuildFileAddressRequest) -> BuildFileAddress, gets=[Get(AddressFamily, AddressFamilyDir)]). All potential sources were eliminated: []
Traceback (most recent call last):
  File "/Users/user/.cache/pants/setup/bootstrap-Darwin-x86_64/2.13.0rc1_py37/lib/python3.7/site-packages/pants/bin/daemon_pants_runner.py", line 130, in single_daemonized_run
    scheduler, options_initializer = self._core.prepare(options_bootstrapper, complete_env)
  File "/Users/user/.cache/pants/setup/bootstrap-Darwin-x86_64/2.13.0rc1_py37/lib/python3.7/site-packages/pants/pantsd/pants_daemon_core.py", line 175, in prepare
    scheduler_restart_explanation,
  File "/Users/user/.cache/pants/setup/bootstrap-Darwin-x86_64/2.13.0rc1_py37/lib/python3.7/site-packages/pants/pantsd/pants_daemon_core.py", line 118, in _initialize
    raise e
  File "/Users/user/.cache/pants/setup/bootstrap-Darwin-x86_64/2.13.0rc1_py37/lib/python3.7/site-packages/pants/pantsd/pants_daemon_core.py", line 109, in _initialize
    bootstrap_options, build_config, dynamic_remote_options, self._executor
  File "/Users/user/.cache/pants/setup/bootstrap-Darwin-x86_64/2.13.0rc1_py37/lib/python3.7/site-packages/pants/init/engine_initializer.py", line 199, in setup_graph
    watch_filesystem=bootstrap_options.watch_filesystem,
  File "/Users/user/.cache/pants/setup/bootstrap-Darwin-x86_64/2.13.0rc1_py37/lib/python3.7/site-packages/pants/init/engine_initializer.py", line 323, in setup_graph_extended
    watch_filesystem=watch_filesystem,
  File "/Users/user/.cache/pants/setup/bootstrap-Darwin-x86_64/2.13.0rc1_py37/lib/python3.7/site-packages/pants/engine/internals/scheduler.py", line 228, in __init__
    exec_stategy_opts,
ValueError: Encountered 2 rule graph errors:
  No installed rules return the type BuildFileAddressRequest, and it was not provided by potential callers of @rule(pants.engine.internals.build_files:150:find_build_file(BuildFileAddressRequest) -> BuildFileAddress, gets=[Get(AddressFamily, AddressFamilyDir)]).
    If that type should be computed by a rule, ensure that that rule is installed.
    If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
  No source of dependency Get(AddressFamily, AddressFamilyDir) for @rule(pants.engine.internals.build_files:150:find_build_file(BuildFileAddressRequest) -> BuildFileAddress, gets=[Get(AddressFamily, AddressFamilyDir)]). All potential sources were eliminated: []
h
Hi there, thanks for the report! Are you using any custom Pants plugins?
a
Yes, but they’re not mentioned anywhere in that output, unless I’m missing something obviou
h
Okay. Yeah, rule graph error messages are one of the biggest sore spots of Pants and something we want to improve. This is the relevant change you need to make to your plugin: https://www.pantsbuild.org/v2.13/docs/plugin-upgrade-guide#addressinput-and-unparsedaddressinputs-require-description_of_origin (It's what was necessary for the better error messages)
a
That’s quite ironic 🙂
👆 1
💯 1
Okay, so we do have one plugin, which is causing this (or at least, I get another error without it), but we’re not using any of those 3 things. This brings me to another point, what’s the ‘recommended’ way to debug pants?
h
a
I meant more like being to run the code in an IDE and put a breakpoint. I’ll do the commenting stuff out tomorrow
h
ah cc @bitter-ability-32190, I don't recall where debugger support is for Pants plugins?
b
If it's an in-repo plugin, it's not readily supported
It's possible to fix that, but just takes thought and a PR 🙂
w
this particular case is a failure well before the Python
@rule
code is actually invoked, so a debugger would probably not help: the “rule graph” is built statically by some hairy Rust code for which i am to blame.
that’s one of the primary reasons why the plugin API is not yet marked stable: sorry for the trouble.
a
Why wouldn’t a debugger help?
And, that’s not a reason to purposefully make pants hard to debug.
w
think of the rule graph as a (fairly badly implemented) compiler. that compiler is giving you a bad error message… but debugging that compiler amounts to reverse engineering it
a
Yeah, except with a debugger I can inspect the state.
The alternative seems to be “just comment crap out until it works”.
Speaking of debugging, I tried to write a macro earlier today. I gave up, because it’s impossible to debug.
pants ACTIVELY stops you from doing anything useful there
oh, you want to print something? no way. no import either, because you might use builtins to print
w
@ancient-france-42909: if you are interested in debugging the rust code, you can always attach
lldb
or
gdb
to do so. i was just saying that using the python debug support was unlikely to help in this particular case. if you had a “runtime” issue with the python code, on the other hand, it would.
And, that’s not a reason to purposefully make pants hard to debug.
that is of course not what i was suggesting 😃 … Josh has done a bunch of work on being able to attach a Python debugger.
oh, you want to print something? no way. no import either, because you might use builtins to print
yea, good point. it would probably be worthwhile to expose
print
or some other explicit debug statement
a
my main problem is that everything is so opaque. I want to see why something is slow, for example,
generate-lockfiles
takes 10 minutes. why? well, because it’s resolving transitive targets!
and there’s on way to know whether it’s in the python or rust (or whatever) code
w
and there’s on way to know whether it’s in the python or rust (or whatever) code
there are a few ways: but that would probably be a good topic for a new thread.
a
source ~/.cache/pants/pants_dev_deps/<your platform dir>/bin/activate
I don’t have that directory 🙂
w
mm, yea. those instructions are for profiling in
pantsbuild/pants
. this thread is more relevant outside of it: https://pantsbuild.slack.com/archives/C0D7TNJHL/p1657730280463309
to be clear though: if
generate-lockfiles
is taking 10 minutes, it’s almost certainly in a PEX subprocess… so you probably want to be looking at the subprocess instead. and note that the latest Pants
2.13.x
release candidate (
2.13.0rc1
) uses more modern PEX
a
yeah, except I haven’t gotten around to fixing the million things that break when I updated to 2.13, even if I do remove our custom plugin 🙂
w
@ancient-france-42909: mm. we suggest bumping one release at a time to reduce the trouble there: https://www.pantsbuild.org/docs/upgrade-tips
a
ah, and while I’m whining, who thought it’s a good idea to put JSON as an example for the config file?
Yeah, I did go one release at a time. 🙂
Okay, cannot do it without the plugin, because it’s what we use to deploy, and it’s in half our
BUILD
files
Okay, made a macro for that.
h
and while I’m whining
Hey @ancient-france-42909, friendly reminder of our code of conduct: https://www.pantsbuild.org/v2.13/docs/code-of-conduct. I can certainly imagine how frustrating this experience is upgrading, and that you keep hitting several different barriers while trying to fix the earlier issues. You're not alone with finding that frustrating, and we want to help you figure this out. We also appreciate your feedback. At the same time, our community prioritizes expressing that frustration and feedback "in a friendly", "patient", and "respectful" way.
w
mm: thanks @hundreds-father-404
oh, you want to print something? no way. no import either, because you might use builtins to print
@ancient-france-42909: filed https://github.com/pantsbuild/pants/issues/16581 for this.
a
First of all, that was an offhand joke about the fact that I’ve been bringing up many issues in one thread, rather than properly reporting them. Secondly, I’ve been nothing but patient.
I’m the person that spends an hour to get
./pants test ::
to start building virtualenvs.
b
@ancient-france-42909 et al, due to this threads history, let's leave it to the historians and start a new fresh one with good Friday vibes all around 🕺 I'll be on the road for a while, but when my and others' time permits, happy to assist. (Just remember we're all volunteers doing our best to support) ✌️
a
Enjoy!
1
🙌 1