arnoldmr01 commented on code in PR #62259:
URL: https://github.com/apache/airflow/pull/62259#discussion_r3080683165
##########
providers/standard/src/airflow/providers/standard/operators/trigger_dagrun.py:
##########
@@ -291,16 +303,27 @@ def _trigger_dag_af_3(self, context, run_id,
parsed_logical_date):
deferrable=self.deferrable,
)
- if self.note and "note" in
inspect.signature(DagRunTriggerException.__init__).parameters:
+ parameters =
inspect.signature(DagRunTriggerException.__init__).parameters
+ if self.note and "note" in parameters:
kwargs_accepted["note"] = self.note
+ if parsed_run_after and "run_after" in parameters:
+ kwargs_accepted["run_after"] = parsed_run_after
+
raise DagRunTriggerException(**kwargs_accepted)
def _trigger_dag_af_2(self, context, run_id, parsed_logical_date):
try:
- if self.note:
- self.log.warning("Parameter 'note' is not supported in Airflow
2.x and will be ignored.")
-
+ unsupported_parameters = [
+ attr
+ for attr in self.attributes_not_suppported_in_airflow_2
+ if getattr(self, attr, NOTSET) is not NOTSET or None
Review Comment:
Modified attributes_not_supported_in_airflow_2 as a set. e.g.
`attributes_not_supported_in_airflow_2 = {
"run_after": NOTSET,
"note": None,
}
`
The keys the not supported attributes and the values are the default values.
The logic to check if those not supported attributes are set by the user is
```
unsupported_parameters = []
for attr, default_value in
self.attributes_not_suppported_in_airflow_2.items():
value = getattr(self, attr, default_value)
if value is not default_value:
unsupported_parameters.append(attr)
```
--
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]