amoghrajesh commented on code in PR #54774:
URL: https://github.com/apache/airflow/pull/54774#discussion_r2290947334
##########
airflow-core/src/airflow/ti_deps/deps/trigger_rule_dep.py:
##########
@@ -617,14 +617,17 @@ def _evaluate_direct_relatives() -> Iterator[TIDepStatus]:
elif success == 0:
yield self._failing_status(
reason=(
- f"Task's trigger rule '{trigger_rule}' requires
all non-skipped upstream tasks to have "
+ f"Task's trigger rule '{trigger_rule.value}'
requires all non-skipped upstream tasks to have "
f"completed and at least one upstream task has
succeeded, but found "
f"{success} successful task(s).
upstream_states={upstream_states}, "
f"upstream_task_ids={task.upstream_task_ids}"
)
)
else:
- yield self._failing_status(reason=f"No strategy to evaluate
trigger rule '{trigger_rule}'.")
+ print("true rule not implemented:", trigger_rule)
+ yield self._failing_status(
+ reason=f"No strategy to evaluate trigger rule
'{getattr(trigger_rule, 'value', trigger_rule)}'."
Review Comment:
Just replaced all the occurecnes with `getattr`, reason being:
* task-sdk TriggerRule has no `__str__`, therefore, f"{trigger_rule}" →
"TriggerRule.ALL_SUCCESS"
* airflow-core TriggerRule has `__str__` and it behaves like
f"{trigger_rule}" → "all_success"
That's why getattr(trigger_rule, 'value', trigger_rule) works for all cases:
Enum objects: Uses .value => "all_success"
String objects: Falls back to string => "unknown_status"
--
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]