curved-television-6568
07/08/2021, 2:08 PMException: Could not find a rule to satisfy Get(Targets, UnparsedAddressInputs, UnparsedAddressInputs(values=('//src/python/foo/qux:bin',), relative_to='src/python/foo')).
What could I be missing?curved-television-6568
07/08/2021, 2:12 PMcurved-television-6568
07/08/2021, 2:52 PMres = chroot_rule_runner.request(Targets, [UnparsedAddressInputs(["//src/python/foo:foo-dist"], owning_address=None)])
and gives me:
----------------------------- Captured stdout call -----------------------------
Targets([<class 'pants.backend.python.target_types.PythonDistribution'>(address=src/python/foo:foo-dist, alias='python_distribution', dependencies=None, description=None, entry_points=FrozenDict({'console_scripts': FrozenDict({'foo_tool': 'foo.bar.baz:Tool.main', 'bin_tool': '//src/python/foo/qux:bin', 'hello': ':foo-bin'}), 'foo_plugins': FrozenDict({'qux': 'foo.qux'})}), provides=foo, setup_py_commands=None, tags=None)])
However, the error is still there…
E Engine traceback:
E in select
E in pants.backend.python.goals.setup_py.generate_chroot
E in pants.engine.internals.graph.transitive_targets
E in pants.engine.internals.graph.resolve_targets (src/python/foo:foo-dist)
E in pants.engine.internals.graph.resolve_unexpanded_targets (src/python/foo:foo-dist)
E in pants.engine.internals.graph.resolve_dependencies (src/python/foo:foo-dist)
E in pants.backend.python.target_types_rules.inject_python_distribution_dependencies (src/python/foo:foo-dist)
E in pants.backend.python.target_types_rules.resolve_python_distribution_entry_points
E Traceback (no traceback):
E <pants native internals>
E Exception: Could not find a rule to satisfy Get(Targets, UnparsedAddressInputs, UnparsedAddressInputs(values=('//src/python/foo/qux:bin',), relative_to='src/python/foo')).
From the code under test:
targets = await Get(Targets, UnparsedAddressInputs([ref], owning_address=address))
Do I simply just miss some required QueryRule()`s for the rule runner?curved-television-6568
07/08/2021, 2:59 PMcurved-television-6568
07/08/2021, 3:00 PMcurved-television-6568
07/08/2021, 3:05 PME Exception: No installed QueryRules can compute Targets given input Params(UnparsedAddressInputs), but it can be produced using:
E Params(Addresses)
E Params(UnexpandedTargets)
when I have these QueryRule()s
QueryRule(Addresses, (UnparsedAddressInputs,)),
QueryRule(UnexpandedTargets, (Addresses,)),
QueryRule(Targets, (UnexpandedTargets,)),
So, if I add a QueryRule() going from UnparsedAddressInputs to Targets, it works when I use the rule runner request, but I can’t get any QueryRule to work when I try to use await Get()…curved-television-6568
07/08/2021, 3:06 PMwitty-crayon-22786
07/08/2021, 3:33 PMCould not find a rule to satisfy Get(..)
is a runtime error, which is very unexpected. the rule graph is supposed to be compiled such that that cannot happen.curved-television-6568
07/08/2021, 3:33 PMaddrs = chroot_rule_runner.request(Addresses, [UnparsedAddressInputs(["//src/python/foo:foo-dist"], owning_address=None)])
print(addrs)
> unexpanded = chroot_rule_runner.request(UnexpandedTargets, Addresses(addrs))
> native_engine.execution_add_root_select(
self.py_scheduler, execution_request, params, product
)
E Exception: No installed QueryRules can compute UnexpandedTargets given input Params(Address), but it can be produced using:
E Params(Addresses)
src/python/pants/engine/internals/scheduler.py:291: Exception
----------------------------- Captured stdout call -----------------------------
Addresses([Address(src/python/foo:foo-dist)])
So, it seems there’s something weird going on here..witty-crayon-22786
07/08/2021, 3:33 PM@rule
decorator detect usages of Get
in your rule bodywitty-crayon-22786
07/08/2021, 3:34 PMGet
might not have been detected in your @rule
body? had it been extracted into a separate function perhaps?curved-television-6568
07/08/2021, 3:34 PMcurved-television-6568
07/08/2021, 3:34 PMcurved-television-6568
07/08/2021, 3:35 PMwitty-crayon-22786
07/08/2021, 3:35 PM@rule
analysis is static, but very basic. it cannot walk into other functions to detect usages like that.witty-crayon-22786
07/08/2021, 3:36 PMcurved-television-6568
07/08/2021, 3:36 PMwitty-crayon-22786
07/08/2021, 3:59 PMcurved-television-6568
07/09/2021, 8:36 AMcurved-television-6568
07/09/2021, 8:41 AMask for help in the #engine channel …https://www.pantsbuild.org/docs/rules-api-concepts
curved-television-6568
07/09/2021, 8:44 AMawait Get
..
In addition to requesting types in your rule’s parameters, you can request types in the body of your rule.This could be highlighted for additional emphasis, though (although the new improved error message makes this less important) 🙂
curved-television-6568
07/09/2021, 8:46 AM