amoghrajesh commented on code in PR #66160:
URL: https://github.com/apache/airflow/pull/66160#discussion_r3180559746


##########
task-sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -248,6 +250,14 @@ def get_template_context(self) -> Context:
                     "value": VariableAccessor(deserialize_json=False),
                 },
                 "conn": ConnectionAccessor(),
+                "task_state": TaskStateAccessor(ti_id=self.id),
+                # TODO: right now, asset_state is only provided for 
single-inlet tasks.
+                # Multi-inlet support is deferred — see AssetStateAccessor 
docstring.
+                **(
+                    {"asset_state": 
AssetStateAccessor(name=self.task.inlets[0].name)}

Review Comment:
   Good catch. Fixed it, now I am gating it on `isinstance(inlet, (Asset, 
AssetNameRef))` for name based access and `isinstance(inlet, AssetUriRef)` for 
URI based ones. `AssetAlias` falls through with a TODO comment since it maps to 
multiple concrete assets and there is no single state to bind. Added tests for 
both `AssetUriRef` inlet and `AssetAlias` inlet too



-- 
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]

Reply via email to