kaxil commented on code in PR #69243:
URL: https://github.com/apache/airflow/pull/69243#discussion_r3518340745
##########
airflow-core/tests/unit/serialization/test_serialized_objects.py:
##########
@@ -1309,6 +1309,109 @@ def
test_has_retry_policy_flag_false_when_no_policy(self):
task = deserialized.task_dict["op_no_policy"]
assert task.has_retry_policy is False
+ def test_mapped_task_retry_policy_serializes_as_flag(self):
+ """A mapped task's retry_policy must serialize as has_retry_policy,
not the object."""
+ from airflow.sdk import DAG # module-level DAG is
airflow.models.dag.DAG
+ from airflow.sdk.definitions.retry_policy import ExceptionRetryPolicy,
RetryAction, RetryRule
Review Comment:
Move at the top please
##########
airflow-core/src/airflow/serialization/serialized_objects.py:
##########
@@ -974,6 +974,15 @@ def serialize_mapped_operator(cls, op: MappedOperator) ->
dict[str, Any]:
if cls._is_excluded(v, k, op):
continue
+ if k == "retry_policy":
Review Comment:
Thanks, the shared set closes both paths nicely. One small nit while you're
in there: the comment on the `if k in _HAS_FLAG_FIELDS:` branch now restates
the constant's comment almost verbatim. It could shrink to a one-liner pointing
at `_HAS_FLAG_FIELDS`, since the comment on the constant already covers the why
(including the default_args scope); the default_args loop already relies on
that and carries no comment of its own.
--
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]