Repository navigation
Conversation
…gress
is_container fell through to True when the execution state or its mode
was None, which is the state during the module import performed by
pyflyte register and pyflyte run --remote. Module-level code gated on
is_container, such as
if image_spec.is_container():
import pandas
therefore ran at registration time on the registration machine instead
of in the built image.
Return False when no execution is in progress, keep True for local
workflow execution, and keep the env comparison for the rest.
Fixes flyteorg/flyte#6518
mitsa-ng
requested review from
cosmicbboy,
davidmirror-ops,
kumare3,
machichima,
pingsutw,
samhita-alla and
wild-endeavor
as code owners
November 23, 2026 12:04
|
Thank you for opening this pull request! 🙌 These tips will help get your PR across the finish line:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracking issue
Fixes flyteorg/flyte#6518
Why are the changes needed?
ImageSpec.is_container()fell through toTruewhen the execution state or its mode wasNone. That is exactly the state during the module import performed bypyflyte registerandpyflyte run --remote, so module-level code gated onis_containerran on the registration machine instead of in the built image:What changes were proposed in this pull request?
execution_stateisNoneorexecution_state.modeisNone),is_containernow returnsFalse.LOCAL_WORKFLOW_EXECUTION) still returnsTrue, and every other mode still compares the_F_IMG_IDenvironment variable against the spec id, so behavior inside a container built from the spec is unchanged.How was this patch tested?
test_image_specthat covered the no-execution case (it asserted the old fall-throughTrue).test_is_container_without_execution_in_progress,test_is_container_in_local_workflow_execution, andtest_is_container_in_task_execution_compares_image_idcovering all three states. The new no-execution test fails onmasterand passes with this change.pytest tests/flytekit/unit/core/image_spec: 60 passed, 2 skipped.tests/flytekit/unit/corerun with and without this change produces an identical pre-existing failure set in the local environment (33 environment-related failures onmasteras well), i.e. no new failures.Setup process