hundreds-father-404
09/06/2022, 8:47 PMGet(GeneratedTargets, GenerateTargetsRequest)
inside resolve_target_parametrizations
. Even that code path isn't triggered in bootstrapping for discovering env targets, the rule graph doesn't know thathundreds-father-404
09/06/2022, 8:47 PMWrappedTargetRequest -> WrappedTarget
that doesn't allow for target gen. Any suggestions? Lmk if you want to pairhundreds-father-404
09/06/2022, 8:48 PMparametrize
with env target definitions, right?witty-crayon-22786
09/06/2022, 8:48 PMparametrize
with env targets.witty-crayon-22786
09/06/2022, 8:49 PMhey @witty-crayon-22786 we get a graph cycle when consuming your PR becausein which context? what edit(s) have you made?insideGet(GeneratedTargets, GenerateTargetsRequest)
.resolve_target_parametrizations
hundreds-father-404
09/06/2022, 8:51 PMEnvironmentName
you added is the same from my old ResolvedEnvironmentAlias
2. For now, I inject EnvironmentName(None)
whereas you did EnvironmentName()
3. python_bootstrap.py
needs to request EnvironmentTarget
as a rule param, whereas before it was doing Get(EnvironmentTarget, EnvironmentRequest(LOCAL_MATCHER)
. *Otherwise a really bad rule graph error. I suspect this is because it's used in bootstrapping?
That causes a rule graph issue. I can fix it by commenting out Get(GeneratedTargets, GenerateTargetsRequest)
inside resolve_target_parametrizations
witty-crayon-22786
09/06/2022, 8:53 PMhundreds-father-404
09/06/2022, 8:53 PMwitty-crayon-22786
09/06/2022, 8:55 PMwitty-crayon-22786
09/06/2022, 8:56 PMhundreds-father-404
09/06/2022, 8:56 PMwitty-crayon-22786
09/06/2022, 8:56 PMhundreds-father-404
09/06/2022, 8:57 PMwitty-crayon-22786
09/06/2022, 8:58 PMTargetAdaptor
…?hundreds-father-404
09/06/2022, 9:00 PMTarget
so we get Target API benefits like field validation. Otherwise consuming sites will be totally untyped
I'm thinking WrappedTargetRequest -> WrappedTargetForBootstrappingOnly
or somethingwitty-crayon-22786
09/06/2022, 9:02 PMhundreds-father-404
09/06/2022, 9:03 PMhundreds-father-404
09/06/2022, 9:49 PMEnvironmentName(None)
everywhere 🚀 https://github.com/pantsbuild/pants/compare/main...Eric-Arellano:merge-env-name?expand=1
the next step is to update those sites to instead do session.product_request(ChosenLocalEnvironmentName, [Params()])
.
Do you know offhand where I define that QueryRule
? engine_initializer.py
?witty-crayon-22786
09/06/2022, 9:50 PMwitty-crayon-22786
09/06/2022, 9:50 PMhundreds-father-404
09/06/2022, 10:00 PMQueryRule(ChosenLocalEnvironment, [Platform])
so we can inject Platform.create_for_localhost()
. Mind blownwitty-crayon-22786
09/06/2022, 10:01 PMwitty-crayon-22786
09/06/2022, 10:01 PMPlatform
is computed from the environmentwitty-crayon-22786
09/06/2022, 10:02 PMhundreds-father-404
09/06/2022, 10:02 PMplugin_resolver.py
-- we know it must be the local platform and __local__
envwitty-crayon-22786
09/06/2022, 10:02 PMPlatform.create_for_localhost()
directly, when it determines that it should based on… settings?hundreds-father-404
09/06/2022, 10:03 PMwitty-crayon-22786
09/06/2022, 10:03 PMThis is to figure out the environment insideseems like it should be something like:-- we know it must be the local platform andplugin_resolver.py
env__local__
QueryRule(EnvironmentName, [EnvironmentMatcher])
…?witty-crayon-22786
09/06/2022, 10:03 PMhundreds-father-404
09/06/2022, 10:08 PM❯ ./pants --no-pantsd
ChosenLocalEnvironmentName(val='default_env')
hundreds-father-404
09/06/2022, 11:05 PMGet(TestResult, {field_set: TestFieldSet, EnvironmentName("docker"): EnvironmentName})
inside test.py
results in
❯ ./pants test src/python/pants/util/strutil_test.py
18:05:55.36 [INFO] //:default_env
18:05:56.50 [INFO] Initializing scheduler...
18:05:57.04 [INFO] Scheduler initialized.
18:05:57.37 [INFO] //:docker_env
Super cool. Now just to figure out how to extract the env from each FieldSet 🙂hundreds-father-404
09/07/2022, 4:41 PMtest_unrecognized_build_file_symbols_during_bootstrap
now fails because the StreamingWorkunitHandler
gets created in local_pants_runner.py
by calling determine_bootstrap_environment(self.graph_session.scheduler_session)
, and that fails on the unrecognized symbol. Whereas we wanted ./pants --version
to succeed to show we can safely handle unrecognized target types
I believe this failure is legit -- we want StreamingWorkunitHandler to fail because we are past the bootstrap stage (plugin resolver)
We no matter what create StreamingWorkunitHandler
, so I don't think there's any way around it. It fails regardless of the goal like help
or --version
I had the idea of parsing the stacktrace to make sure the failrue doesn't come from plugin_resolver.py
, but that doesn't work becuase it's a generic select
in the rule graph tracewitty-crayon-22786
09/07/2022, 4:44 PMwitty-crayon-22786
09/07/2022, 4:44 PMwitty-crayon-22786
09/07/2022, 4:44 PMhundreds-father-404
09/07/2022, 4:45 PMhundreds-father-404
09/07/2022, 4:45 PMwitty-crayon-22786
09/07/2022, 4:45 PMthe symbol in this case is actually bada realistic example would be that the symbol exists in a backend which isn’t loaded initially
hundreds-father-404
09/07/2022, 4:45 PMwitty-crayon-22786
09/07/2022, 4:46 PMhundreds-father-404
09/07/2022, 4:46 PMwitty-crayon-22786
09/07/2022, 4:46 PMpython_sources
target or something, and then actually include that backend