Skip to content

Conversation

@yeswanth-s1th
Copy link
Contributor

Closes #52236.

What this PR does:

  • In _handle_execution_date_fn, tries context['logical_date'], then the legacy context['execution_date'], then dag_run.run_after.
  • Adds a pytest to validate the fallback to execution_date.

This prevents a KeyError for users whose context lacks logical_date but still have execution_date.

…on_date_fn context - Try context['logical_date'], then context['execution_date'], then dag_run.run_after - Prevents KeyError when users run in environments without 'logical_date' Closes apache#52236

fix(external_task_sensor): fallback to execution_date key for execution_date_fn context
- Try context['logical_date'], then context['execution_date'], then dag_run.run_after
- Prevents KeyError when users run in environments without 'logical_date'
Closes apache#52236
@boring-cyborg
Copy link

boring-cyborg bot commented Jun 28, 2025

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@kaxil kaxil requested a review from gopidesupavan June 30, 2025 10:52
@gopidesupavan
Copy link
Member

@yeswanth-bf added comment in issue, to get the log

Signed-off-by: yeswanth-bf <117461015+yeswanth-bf@users.noreply.github.com>
@yeswanth-s1th yeswanth-s1th force-pushed the fix-52236-execution-date-fallback branch from 7de1a26 to 8d48c2c Compare July 2, 2025 04:01
@eladkal eladkal requested review from Lee-W and gopidesupavan July 2, 2025 06:24
Copy link
Member

@gopidesupavan gopidesupavan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gopidesupavan
Copy link
Member

@yeswanth-bf tests are failing ..

@gopidesupavan
Copy link
Member

compact tests failing, please take look at these test references: providers/standard/tests/unit/standard/operators/test_weekday.py

@gopidesupavan
Copy link
Member

@yeswanth-s1th do you need any help give me a shout.

@gopidesupavan
Copy link
Member

@yeswanth-s1th any update on the test fixes? happy to fork these changes and add you as co-author

@yeswanth-s1th
Copy link
Contributor Author

yeswanth-s1th commented Jul 23, 2025

@yeswanth-s1th any update on the test fixes? happy to fork these changes and add you as co-author

@gopidesupavan
To optimize attribution visibility, could we keep my original commits authored by me, and add you as Co-authored-by: on any new/amended ones? If you end up squashing, would you mind setting me as the commit Author and yourself as a co-author so the signal remains intact?

Co-authored-by: Yeswanth Surampudi  <yeswanth.sde@gmail.com>

Thanks again for unblocking this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Key Error in External Task Sensor when using execution_date_fn

4 participants