Copilot commented on code in PR #62259:
URL: https://github.com/apache/airflow/pull/62259#discussion_r3066493297
##########
providers/standard/src/airflow/providers/standard/operators/trigger_dagrun.py:
##########
@@ -162,6 +163,11 @@ class TriggerDagRunOperator(BaseOperator):
"wait_for_completion",
"skip_when_already_exists",
)
+
+ attributes_not_suppported_in_airflow_2: Sequence[str] = (
+ "run_after",
+ "note",
+ )
Review Comment:
Typo in the new attribute name: `attributes_not_suppported_in_airflow_2` has
an extra “p” (suppported). Renaming it to
`attributes_not_supported_in_airflow_2` would improve readability and avoid
propagating the typo to other references.
##########
airflow-core/src/airflow/api_fastapi/execution_api/versions/v2026_04_06.py:
##########
@@ -184,3 +187,13 @@ class AddDagEndpoint(VersionChange):
description = __doc__
instructions_to_migrate_to_previous_version = (endpoint("/dags/{dag_id}",
["GET"]).didnt_exist,)
+
+
+class AddRunAfterFiled(VersionChange):
+ """Add run_after parameter to TriggerDAGRunPayload Model."""
+
+ description = __doc__
+
+ instructions_to_migrate_to_previous_version = (
+ schema(TriggerDAGRunPayload).field("run_after").didnt_exist,
+ )
Review Comment:
The new version change class name has a typo: `AddRunAfterFiled` should
likely be `AddRunAfterField` (and the corresponding import/registration
updated). This will make the version history easier to read and search.
##########
task-sdk/src/airflow/sdk/api/client.py:
##########
@@ -711,12 +711,17 @@ def trigger(
run_id: str,
conf: dict | None = None,
logical_date: datetime | None = None,
+ run_after: datetime | None = None,
reset_dag_run: bool = False,
note: str | None = None,
) -> OKResponse | ErrorResponse:
"""Trigger a Dag run via the API server."""
body = TriggerDAGRunPayload(
- logical_date=logical_date, conf=conf or {},
reset_dag_run=reset_dag_run, note=note
+ logical_date=logical_date,
+ conf=conf or {},
+ reset_dag_run=reset_dag_run,
+ note=note,
+ run_after=run_after,
)
Review Comment:
`DagRunOperations.trigger()` now accepts `run_after` and includes it in
`TriggerDAGRunPayload`, but there is no corresponding request-serialization
test ensuring `run_after` is present in the POST body when provided (similar to
the existing `test_trigger` assertions for `logical_date`). Adding a test case
would prevent regressions in the client’s HTTP payload format.
##########
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:
In the Airflow 2.x path, the unsupported-parameter detection is incorrect:
`getattr(self, attr, NOTSET) is not NOTSET or None` will treat `None` as “set”,
so `note` (default None) will be reported as unsupported even when the user did
not pass it. Consider checking for “arg is set” explicitly (e.g., `val is not
NOTSET and val is not None`) so warnings only fire when the parameter is
actually provided.
--
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]