-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Closed
Labels
area:providersgood first issuekind:bugThis is a clearly a bugThis is a clearly a bugprovider:standard
Description
Apache Airflow Provider(s)
standard
Versions of Apache Airflow Providers
1.3.0
Apache Airflow version
3.0.2
Operating System
Debian GNU/Linux 12 (bookworm)
Deployment
Official Apache Airflow Helm Chart
Deployment details
No response
What happened
There is a key error of logical_date when using execution_date_fn in ExternalTaskSensor
airflow/providers/standard/src/airflow/providers/standard/sensors/external_task.py
Lines 532 to 545 in 460b1c6
| def _handle_execution_date_fn(self, context) -> Any: | |
| """ | |
| Handle backward compatibility. | |
| This function is to handle backwards compatibility with how this operator was | |
| previously where it only passes the logical date, but also allow for the newer | |
| implementation to pass all context variables as keyword arguments, to allow | |
| for more sophisticated returns of dates to return. | |
| """ | |
| from airflow.utils.operator_helpers import make_kwargs_callable | |
| # Remove "logical_date" because it is already a mandatory positional argument | |
| logical_date = context["logical_date"] | |
| kwargs = {k: v for k, v in context.items() if k not in {"execution_date", "logical_date"}} |
What you think should happen instead
Should pass the logical_date args from caller
airflow/providers/standard/src/airflow/providers/standard/sensors/external_task.py
Lines 261 to 273 in 460b1c6
| def _get_dttm_filter(self, context): | |
| logical_date = context.get("logical_date") | |
| if AIRFLOW_V_3_0_PLUS: | |
| if logical_date is None: | |
| dag_run = context.get("dag_run") | |
| if TYPE_CHECKING: | |
| assert dag_run | |
| logical_date = dag_run.run_after | |
| if self.execution_delta: | |
| dttm = logical_date - self.execution_delta | |
| elif self.execution_date_fn: | |
| dttm = self._handle_execution_date_fn(context=context) |
How to reproduce
Use execution_date_fn in ExternalTaskSensor
Anything else
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
area:providersgood first issuekind:bugThis is a clearly a bugThis is a clearly a bugprovider:standard