amoghrajesh commented on code in PR #59566:
URL: https://github.com/apache/airflow/pull/59566#discussion_r2634736413
##########
task-sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -784,17 +784,87 @@ def startup() -> tuple[RuntimeTaskInstance, Context,
Logger]:
return ti, ti.get_template_context(), log
+def _serialize_template_field(template_field: Any, name: str) -> str | dict |
list | int | float:
+ """
+ Return a serializable representation of the templated field.
+
+ If ``templated_field`` contains a class or instance that requires recursive
+ templating, store them as strings. Otherwise simply return the field as-is.
+
+ Used sdk secrets masker to redact secrets in the serialized output.
+ """
+ import json
+
+ from airflow.sdk._shared.secrets_masker import redact
+
+ def is_jsonable(x):
Review Comment:
I ported the function directly from:
https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/serialization/helpers.py#L32-L98,
and didn't change anything in it. I could take these changes up in a follow up
##########
task-sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -784,17 +784,87 @@ def startup() -> tuple[RuntimeTaskInstance, Context,
Logger]:
return ti, ti.get_template_context(), log
+def _serialize_template_field(template_field: Any, name: str) -> str | dict |
list | int | float:
+ """
+ Return a serializable representation of the templated field.
+
+ If ``templated_field`` contains a class or instance that requires recursive
+ templating, store them as strings. Otherwise simply return the field as-is.
+
+ Used sdk secrets masker to redact secrets in the serialized output.
+ """
+ import json
+
+ from airflow.sdk._shared.secrets_masker import redact
+
+ def is_jsonable(x):
Review Comment:
I ported the function directly from:
https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/serialization/helpers.py#L32-L98,
and didn't change anything in it. I could take these changes up in a follow up
where I modify both
--
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]