amoghrajesh commented on code in PR #59566:
URL: https://github.com/apache/airflow/pull/59566#discussion_r2634737227
##########
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):
+ try:
+ json.dumps(x)
+ except (TypeError, OverflowError):
+ return False
+ else:
+ return True
Review Comment:
Same here
##########
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):
+ try:
+ json.dumps(x)
+ except (TypeError, OverflowError):
+ return False
+ else:
+ return True
+
+ def translate_tuples_to_lists(obj: Any):
Review Comment:
Same here
--
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]