hundreds-father-404
01/31/2020, 2:15 AMsubsystem_rule
? These both failed
changed_subsystem, = session.product_request(Changed, [Options, options]) # Options is not a RootRule
changed_subsystem, = session.product_request(Changed, []) # Must give a subject
aloof-angle-91616
01/31/2020, 2:16 AMaloof-angle-91616
01/31/2020, 2:17 AMhundreds-father-404
01/31/2020, 2:17 AMOptions
be a RootRule
only to support this edge case
I’m wondering how the async API ends up getting the Subsystem when it’s in a rule signature? I think that we convert the Subsystem into a TaskRule?aloof-angle-91616
01/31/2020, 2:18 AMawait Get[X](...)
? i suppose we still don’t support params in Get yethundreds-father-404
01/31/2020, 2:18 AMhundreds-father-404
01/31/2020, 2:18 AMaloof-angle-91616
01/31/2020, 2:19 AMAgreed, but I think we likely don’t want to makei think this might actually be ok if necessary!be aOptions
only to support this edge caseRootRule
I’m wondering how the async API ends up getting the Subsystem when it’s in a rule signature? I think that we convert the Subsystem into a TaskRule?what do you mean “in a rule signature”? do you mean “not a Get”?
hundreds-father-404
01/31/2020, 2:20 AM@rule
def my_rule(isort: Isort) -> LintResult
Rather than
@rule
def my_rule() -> LintResult:
isort = await Get[Isort](..)
aloof-angle-91616
01/31/2020, 2:20 AMaloof-angle-91616
01/31/2020, 2:21 AM_signature
hundreds-father-404
01/31/2020, 2:21 AM@classmethod
def signature(cls):
"""Returns kwargs to construct a `TaskRule` that will construct the target Optionable.
TODO: This indirection avoids a cycle between this module and the `rules` module.
"""
partial_construct_optionable = functools.partial(_construct_optionable, cls)
# NB: We must populate several dunder methods on the partial function because partial functions
# do not have these defined by default and the engine uses these values to visualize functions
# in error messages and the rule graph.
snake_scope = cls.options_scope.replace('-', '_')
partial_construct_optionable.__name__ = f'construct_scope_{snake_scope}'
partial_construct_optionable.__module__ = cls.__module__
_, class_definition_lineno = inspect.getsourcelines(cls)
partial_construct_optionable.__line_number__ = class_definition_lineno
return dict(
output_type=cls.optionable_cls,
input_selectors=tuple(),
func=partial_construct_optionable,
input_gets=(Get.create_statically_for_rule_graph(ScopedOptions, Scope),),
dependency_optionables=(cls.optionable_cls,),
)
aloof-angle-91616
01/31/2020, 2:21 AMhundreds-father-404
01/31/2020, 2:21 AMinput_gets=(Get.create_statically_for_rule_graph(ScopedOptions, Scope),)
is relevant? Does this suggest that you should pass ScopedOptions
?aloof-angle-91616
01/31/2020, 2:22 AMhundreds-father-404
01/31/2020, 2:23 AMchanged_subsystem, = session.product_request(Changed, [Scope(Changed.options_scope)])
leads to
Exception message: No installed @rules can compute Changed for input Params(Scope), but there were @rules that could compute it using:
Params(OptionsBootstrapper)
aloof-angle-91616
01/31/2020, 2:23 AMaloof-angle-91616
01/31/2020, 2:24 AMhundreds-father-404
01/31/2020, 2:24 AM./pants
aloof-angle-91616
01/31/2020, 2:24 AMaloof-angle-91616
01/31/2020, 2:24 AMhundreds-father-404
01/31/2020, 2:24 AMchanged_subsystem, = session.product_request(Changed, [Scope(Changed.options_scope)])
to specs_calculator.py
. It has access to Options
, but not OptionsBootstrapper
)aloof-angle-91616
01/31/2020, 2:25 AMaloof-angle-91616
01/31/2020, 2:25 AMaloof-angle-91616
01/31/2020, 2:25 AMhundreds-father-404
01/31/2020, 2:25 AM--owner-of
aloof-angle-91616
01/31/2020, 2:26 AMaloof-angle-91616
01/31/2020, 2:26 AMhundreds-father-404
01/31/2020, 2:26 AM--owned
and --changed-*
. This is an optimization to remove the ChangedRequest
dataclass - not critical, only would be neat to doaloof-angle-91616
01/31/2020, 2:26 AMhundreds-father-404
01/31/2020, 2:27 AMaloof-angle-91616
01/31/2020, 2:27 AMhundreds-father-404
01/31/2020, 2:28 AMChanged
subsystem that duplicates it’s functionality. Those methods should live in the subsystem, in a perfect world. We only have ChangedRequest
as a way to consume the subsystem outside of V2 rulesaloof-angle-91616
01/31/2020, 2:28 AMaloof-angle-91616
01/31/2020, 2:29 AMhundreds-father-404
01/31/2020, 2:29 AM--query
directly request the Changed
subsystem? That’s how all other rules work. This is the only instance where we wrap the options defined in a Subsystem
aloof-angle-91616
01/31/2020, 2:31 AMaloof-angle-91616
01/31/2020, 2:31 AMhundreds-father-404
01/31/2020, 2:32 AMaloof-angle-91616
01/31/2020, 2:32 AMaloof-angle-91616
01/31/2020, 2:32 AMhundreds-father-404
01/31/2020, 2:33 AMaloof-angle-91616
01/31/2020, 2:33 AMwitty-crayon-22786
01/31/2020, 5:01 PMwitty-crayon-22786
01/31/2020, 5:02 PMwitty-crayon-22786
01/31/2020, 5:02 PM