amoghrajesh commented on code in PR #66160:
URL: https://github.com/apache/airflow/pull/66160#discussion_r3186755598
##########
task-sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -249,7 +251,12 @@ def get_template_context(self) -> Context:
"value": VariableAccessor(deserialize_json=False),
},
"conn": ConnectionAccessor(),
+ "task_state": TaskStateAccessor(ti_id=self.id),
}
+ if any(isinstance(i, (Asset, AssetNameRef, AssetUriRef)) for i in
self.task.inlets):
+ self._cached_template_context["asset_state"] =
AssetStateAccessors(self.task.inlets)
+ # AssetAlias inlets are skipped inside AssetStateAccessors —
an alias maps to
Review Comment:
Silent skip is the right call imo, raising at context construction would
break tasks that do not use asset_state at all, and a warning on every run for
every alias inlet is too noisy. If someone tries `context["asset_state"]` with
an alias inlet they get a `KeyError`, which is a clear enough signal as I see it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]