witty-crayon-22786
09/15/2022, 9:38 PMhundreds-father-404
09/15/2022, 9:40 PMthat is also in the Appendix…Sort of -- targetless builds aren't mentioned, which is specifically why I think we need an option to disambiguate the RE environment when n > 1
witty-crayon-22786
09/15/2022, 9:40 PMwitty-crayon-22786
09/15/2022, 9:41 PMtarget
, just files”… sure.hundreds-father-404
09/15/2022, 9:41 PMcount-loc
, regex-lint
, Black when it's run on BUILD files, etcwitty-crayon-22786
09/15/2022, 9:41 PM__unconstrained__
though, i assume?hundreds-father-404
09/15/2022, 9:41 PM__unconstrainted__
and 2 RE environments, which do we use?witty-crayon-22786
09/15/2022, 9:42 PMwitty-crayon-22786
09/15/2022, 9:42 PMTo match theenvironment matcher, the engine would proceed in a well/user-defined order (although unfortunately TOML tables do not maintain ordering) through the defined environments, applying the matcher to each of them, while applying any other relevant constraints from each environment. For example: a__unconstrained__
would match its platform against the current platform, whereaslocal_environment
might simply match iff remote execution is actually enabled.remote_environment
witty-crayon-22786
09/15/2022, 9:42 PMhundreds-father-404
09/15/2022, 9:47 PMSee the last paragraph about swapping from a dict/TOML-table to a list. The order of environments in that list would be the user-defined/well-defined order.SG I think One challenge here is if we do want to keep it that RE can work when n=0 for RE targets. I think it's actually pretty nonsensical to have n=0 though -- it's almost certain that your localhost environment settings should be different than the RE settings. Thoughts?
witty-crayon-22786
09/15/2022, 9:48 PMOne challenge here is if we do want to keep it that RE can work when n=0 for RE targets.oh. hm… i think that it would be ok to just deprecate the global platform-properties
witty-crayon-22786
09/15/2022, 9:49 PMwitty-crayon-22786
09/15/2022, 9:49 PMremote_environment
seems fine.hundreds-father-404
09/15/2022, 9:51 PM__unconstrained__
and a list of what the priority should be could have big implications, particularly with target-less and Docker. I think it means we now have a way to specify target-less goals like count-loc
should run via Docker? Basically, it sets the global default. And that also impacts fmt
, lint
, etc.
Basically, it sets the global default.Then targets can get more granular to override the global default
witty-crayon-22786
09/15/2022, 9:52 PM__unconstrained__
hundreds-father-404
09/15/2022, 9:54 PMBasically, it sets the global default. And that also impacts fmt, lint, etc.Sg. So then does it make sense to add the
environment
field for those goals? I don't think it's any extra work to get Docker working with lint
etc
Only tricky part is this I think
Unlike the resolve field, we do not consider the environment of dependencies. We only base the environment on the "root" target. This dramatically simplifies the user experience because you don't need to make sure your transitive closure is compatible.
• One complication is batched runs, like fmt, lint, and check. A batch must happen in the same environment, by definition. So we will need to partition.So, we could start with you having to change the global default to get those goals using Docker or RE
ancient-vegetable-10556
09/15/2022, 9:57 PMEnvironmentName
is passed into _construct_subsystem
. Can you talk me through it?witty-crayon-22786
09/15/2022, 9:57 PMancient-vegetable-10556
09/15/2022, 9:58 PMwitty-crayon-22786
09/15/2022, 9:59 PMwitty-crayon-22786
09/15/2022, 9:59 PMEnvironmentTarget
, you’d adjust def construct_subsystem
(and fix its spelling, oy)witty-crayon-22786
09/15/2022, 10:00 PMTaskRule
to say that it takes a positional argument of the EnvironmentTargetancient-vegetable-10556
09/15/2022, 10:00 PMancient-vegetable-10556
09/15/2022, 10:00 PMEnvironmentTarget
or EnvironmentName
?witty-crayon-22786
09/15/2022, 10:01 PMwitty-crayon-22786
09/15/2022, 10:01 PMancient-vegetable-10556
09/15/2022, 10:01 PMEnvironmentTarget
to apply the optionswitty-crayon-22786
09/15/2022, 10:01 PMwitty-crayon-22786
09/15/2022, 10:02 PMdiff --git a/src/python/pants/option/subsystem.py b/src/python/pants/option/subsystem.py
index 9c3f6392da..c550a9e119 100644
--- a/src/python/pants/option/subsystem.py
+++ b/src/python/pants/option/subsystem.py
@@ -68,6 +68,7 @@ class Subsystem(metaclass=ABCMeta):
output_type=cls,
input_selectors=(),
func=partial_construct_subsystem,
+ input_selectors=(EnvironmentTarget,),
input_gets=(
AwaitableConstraints(
output_type=ScopedOptions, input_types=(Scope,), is_effect=False
@@ -130,6 +131,6 @@ class Subsystem(metaclass=ABCMeta):
_SubsystemT = TypeVar("_SubsystemT", bound=Subsystem)
-async def _construct_subsytem(subsystem_typ: type[_SubsystemT]) -> _SubsystemT:
+async def _construct_subsytem(subsystem_typ: type[_SubsystemT], environment_target: EnvironmentTarget) -> _SubsystemT:
scoped_options = await Get(ScopedOptions, Scope(str(subsystem_typ.options_scope)))
return subsystem_typ(scoped_options.options)