kaxil commented on code in PR #44899:
URL: https://github.com/apache/airflow/pull/44899#discussion_r1886655397
##########
task_sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -77,15 +75,36 @@ def get_template_context(self):
# "task_instance_key_str":
f"{task.dag_id}__{task.task_id}__{ds_nodash}",
# "test_mode": task_instance.test_mode,
# "triggering_asset_events":
lazy_object_proxy.Proxy(get_triggering_events),
- # "ts": ts,
- # "ts_nodash": ts_nodash,
- # "ts_nodash_with_tz": ts_nodash_with_tz,
# "var": {
# "json": VariableAccessor(deserialize_json=True),
# "value": VariableAccessor(deserialize_json=False),
# },
# "conn": ConnectionAccessor(),
}
+ if self._ti_context_from_server:
+ dag_run = self._ti_context_from_server.dag_run
+
+ logical_date = dag_run.logical_date
+ ds = logical_date.strftime("%Y-%m-%d")
+ ds_nodash = ds.replace("-", "")
+ ts = logical_date.isoformat()
+ ts_nodash = logical_date.strftime("%Y%m%dT%H%M%S")
+ ts_nodash_with_tz = ts.replace("-", "").replace(":", "")
Review Comment:
I was hoping to get variables, connection, xcom_pull etc lazy loaded.
`ts_nodash_with_tz` is static. Or do you mean only get from server if one of
these is needed?
--
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]