Repository navigation
Refresh asset context after unmapping a task - #75751
Merged
Merged
Conversation
1 task done
Member
Author
|
@hussein-awala Maybe you want to take a look. Long term solution to the workaround in #70225 |
hussein-awala
self-requested a review
November 8, 2026 22:06
uranusjr
force-pushed
the
fix-mapped-task-asset-context
branch
from
November 16, 2026 07:28
b8e7932 to
d9f8f62
Compare
uranusjr
force-pushed
the
fix-mapped-task-asset-context
branch
from
November 17, 2026 09:57
d9f8f62 to
f4f2f27
Compare
FrankYang0529
approved these changes
Nov 18, 2026
kaxil
reviewed
Nov 25, 2026
kaxil
approved these changes
Nov 25, 2026
A mapped task's template context is built from the MappedOperator, whose inlets and outlets only come from partial(). Anything the operator's __init__ added was missing from the asset entries of the context, so e.g. a mapped sensor adding its asset in __init__ got a KeyError from context["inlet_events"][asset]. context_update_for_unmapped now refreshes inlets, outlets, inlet_events and asset_state_store from the unmapped task. To avoid duplicate supervisor calls, the asset accessors no longer resolve refs and aliases on construction; the task runner builds their lookups in _prepare(), after unmapping and before task code runs, so the lookups are never built from async task code.
uranusjr
force-pushed
the
fix-mapped-task-asset-context
branch
from
November 26, 2026 05:50
f4f2f27 to
6219a84
Compare
uranusjr
enabled auto-merge (squash)
November 26, 2026 05:53
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.
A mapped task's template context is built from the
MappedOperator, whose inlets and outlets only come frompartial(). Anything the operator's__init__added was missing fromcontext["inlets"],["outlets"],["inlet_events"]and["asset_state_store"]. For example, a mapped sensor that adds its asset in__init__gets a KeyError fromcontext["inlet_events"][asset](#70225).context_update_for_unmappednow refreshes these entries from the unmapped task. To keep this free of extra supervisor calls,InletEventsAccessorsandAssetStateStoreAccessorsno longer resolve asset refs and aliases when constructed. The task runner builds their lookups in_prepare(), after unmapping and before task code runs. The accessors created before unmapping are never built, and task code (including async code) never triggers a lookup.Behavior changes:
context["inlets"]and["outlets"]are now the task's own lists, as for non-mapped tasks.__init__adds a second asset,context["asset_state_store"].get(...)without a subscript raises ValueError, as it does for non-mapped tasks._prepare()instead of at task startup. The task still fails beforeexecute().The asset state store accessor classes are also converted to attrs.