You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "dotbg (via GitHub)" <gi...@apache.org> on 2026/05/18 21:39:45 UTC

[PR] ExternalTaskSensor. execution-date pattern. [airflow]

dotbg opened a new pull request, #67138:
URL: https://github.com/apache/airflow/pull/67138

   Fixes #10883. 
   
   Implemented execution_date pattern. 
   
   allows for the following:
   ```
   {{ logical_date - macros.timedelta(hours=1) }}
   ```


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ExternalTaskSensor. execution-date pattern. [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #67138:
URL: https://github.com/apache/airflow/pull/67138#issuecomment-6457261516

   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ExternalTaskSensor. execution-date pattern. [airflow]

Posted by "Pedrinhonitz (via GitHub)" <gi...@apache.org>.
Pedrinhonitz commented on code in PR #67138:
URL: https://github.com/apache/airflow/pull/67138#discussion_r3262783964


##########
providers/standard/src/airflow/providers/standard/sensors/external_task.py:
##########
@@ -267,13 +287,25 @@ def __init__(
         self.external_dates_filter: str | None = None
 
     def _get_dttm_filter(self, context: Context) -> Sequence[datetime.datetime]:
+        execution_date_value = self.execution_date
+
+        if execution_date_value is not None:
+            if isinstance(execution_date_value, datetime.datetime):
+                return [execution_date_value]
+
+            import pendulum

Review Comment:
   Thank you for your contribution.
   
   I observed the following points:
   
   I believe that lazy importing in this context doesn't make much sense; the gain is low and it deviates from the file's standard. After all, `_get_dttm_filter` runs on every `poke`/`defer`.
   
   Another problem related to the `pendulum`: I noticed that we can `import timezone` through the SDK, and we even have classes imported from it in this file. It's worth evaluating if this makes sense; it would be one less library in the file.
   
   Here's a possible suggestion regarding parsing using `airflow.providers.common.compat.sdk`. Some operators already use this pattern.
   
   Therefore, we could replace:
   ```python
   import pendulum
   
   ...
   
   return [pendulum.parse(execution_date_value)]
   ```
   
   Put:
   
   ```python
   from airflow.providers.common.compat.sdk import (
       AirflowSkipException,
       BaseOperatorLink,
       BaseSensorOperator,
       conf,
       timezone,
   )
   
   ...
   
   return [timezone.parse(execution_date_value)]
   ```



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ExternalTaskSensor. execution-date pattern. [airflow]

Posted by "dotbg (via GitHub)" <gi...@apache.org>.
dotbg commented on code in PR #67138:
URL: https://github.com/apache/airflow/pull/67138#discussion_r3264876916


##########
providers/standard/src/airflow/providers/standard/sensors/external_task.py:
##########
@@ -267,13 +287,25 @@ def __init__(
         self.external_dates_filter: str | None = None
 
     def _get_dttm_filter(self, context: Context) -> Sequence[datetime.datetime]:
+        execution_date_value = self.execution_date
+
+        if execution_date_value is not None:
+            if isinstance(execution_date_value, datetime.datetime):
+                return [execution_date_value]
+
+            import pendulum

Review Comment:
   Thanks a lot.  I will change the code soon. Have one test to fix 😓 
   



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ExternalTaskSensor. execution-date pattern. [airflow]

Posted by "dotbg (via GitHub)" <gi...@apache.org>.
dotbg commented on PR #67138:
URL: https://github.com/apache/airflow/pull/67138#issuecomment-5360522800

   Thanks @omkar-foss . This PR supports both `execution_date` and `logical_date` though the former might be redundant already. I have kept both as I wanted to be as backwards compatible as possible.  I will drop a comment clarifying this to the ticket


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ExternalTaskSensor. execution-date pattern. [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #67138:
URL: https://github.com/apache/airflow/pull/67138#issuecomment-5021135322

   @dotbg This PR has been converted to **draft** because it does not yet meet our [Pull Request quality criteria](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-quality-criteria).
   
   **Issues found:**
   - :x: **Pre-commit / static checks**: Failing: `CI image checks / Static checks`. Run `prek run --from-ref main --stage pre-commit` locally to reproduce and fix.
   - :x: **mypy (type checking)**: Failing: `MyPy providers checks`. Run the relevant mypy hook locally, e.g. `prek run mypy-airflow-core --all-files` (providers: `breeze run mypy path/to/code`).
   - :x: **Provider tests**: Failing: `provider distributions tests / Compat 2.11.1:P3.10:`, `provider distributions tests / Compat 3.0.6:P3.10:`, `provider distributions tests / Compat 3.1.8:P3.10:`, `provider distributions tests / Compat 3.2.1:P3.10:`. Run `breeze testing providers-tests --test-type "Providers[<provider>]"` locally.
   
   > **Note:** Your branch is **1426 commits behind `main`**. Some check failures may be caused by changes in the base branch rather than by your PR. Please rebase your branch and push again to get up-to-date CI results.
   
   **What to do next:**
   - Fix each issue listed above.
   - Make sure static checks pass locally (`prek run --from-ref main --stage pre-commit`).
   - Mark the PR as "Ready for review" when you're done.
   
   Converting a PR to draft is **not** a rejection — it is an invitation to bring the PR up to the project's standards so that maintainer review time is spent productively. There is no rush — take your time and work at your own pace. We appreciate your contribution and are happy to wait for updates. If you have questions, feel free to ask on the [Airflow Slack](https://s.apache.org/airflow-slack).
   
   ---
   
   _Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this [two-stage triage process](https://github.com/apache/airflow/blob/main/contributing-docs/25_maintainer_pr_triage.md#why-the-first-pass-is-automated) so that our maintainers' limited time is spent where it matters most: the conversation with you._


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ExternalTaskSensor. execution-date pattern. [airflow]

Posted by "dotbg (via GitHub)" <gi...@apache.org>.
dotbg commented on code in PR #67138:
URL: https://github.com/apache/airflow/pull/67138#discussion_r3267485742


##########
providers/standard/src/airflow/providers/standard/sensors/external_task.py:
##########
@@ -267,13 +287,25 @@ def __init__(
         self.external_dates_filter: str | None = None
 
     def _get_dttm_filter(self, context: Context) -> Sequence[datetime.datetime]:
+        execution_date_value = self.execution_date
+
+        if execution_date_value is not None:
+            if isinstance(execution_date_value, datetime.datetime):
+                return [execution_date_value]
+
+            import pendulum

Review Comment:
   done. The tests should be green as well 



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ExternalTaskSensor. execution-date pattern. [airflow]

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #67138:
URL: https://github.com/apache/airflow/pull/67138#issuecomment-4482491542

   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 [prek-hooks]( https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst#prerequisites-for-prek-hooks) 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](https://github.com/apache/airflow/blob/main/airflow-core/docs/howto/custom-operator.rst) Consider adding an example Dag that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/dev/breeze/doc/README.rst) 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](https://www.apache.org/foundation/policies/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]( https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#coding-style-and-best-practices).
   - 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
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ExternalTaskSensor. execution-date pattern. [airflow]

Posted by "dotbg (via GitHub)" <gi...@apache.org>.
dotbg commented on PR #67138:
URL: https://github.com/apache/airflow/pull/67138#issuecomment-5038635188

   @potiuk thanks for heads up. Just rebased


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ExternalTaskSensor. execution-date pattern. [airflow]

Posted by "github-actions[bot] (via GitHub) via commits" <co...@airflow.apache.org>.
github-actions[bot] closed pull request #67138:  ExternalTaskSensor. execution-date pattern.
URL: https://github.com/apache/airflow/pull/67138


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ExternalTaskSensor. execution-date pattern. [airflow]

Posted by "Pedrinhonitz (via GitHub)" <gi...@apache.org>.
Pedrinhonitz commented on code in PR #67138:
URL: https://github.com/apache/airflow/pull/67138#discussion_r3268120726


##########
providers/standard/src/airflow/providers/standard/sensors/external_task.py:
##########
@@ -267,13 +287,25 @@ def __init__(
         self.external_dates_filter: str | None = None
 
     def _get_dttm_filter(self, context: Context) -> Sequence[datetime.datetime]:
+        execution_date_value = self.execution_date
+
+        if execution_date_value is not None:
+            if isinstance(execution_date_value, datetime.datetime):
+                return [execution_date_value]
+
+            import pendulum

Review Comment:
   The pendulum removal is perfect, thank you.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ExternalTaskSensor. execution-date pattern. [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on PR #67138:
URL: https://github.com/apache/airflow/pull/67138#issuecomment-5204457691

   Hi Boris, your PR code looks great overall. But the issue it resolves (i.e. #10883) looks to be stale as execution_date was removed in favour of logical date in AIP-83 (see issues in [this board](https://github.com/orgs/apache/projects/410/views/1)). Having said that, I suppose you could still confirm if this change is needed by asking/dropping a comment on #10883.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ExternalTaskSensor. execution-date pattern. [airflow]

Posted by "dotbg (via GitHub)" <gi...@apache.org>.
dotbg commented on PR #67138:
URL: https://github.com/apache/airflow/pull/67138#issuecomment-5050689299

   Fixed:
   ✅ Pre-commit / static checks: Failing: CI image checks / Static checks. Run prek run --from-ref main --stage pre-commit locally to reproduce and fix.
   ✅ mypy (type checking): Failing: MyPy providers checks. Run the relevant mypy hook locally, e.g. prek run mypy-airflow-core --all-files (providers: breeze run mypy path/to/code).
   
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org