Repository navigation
Closed as not planned
Labels
_eol_affected_version:2.8Issues Reported for 2.8area:providersgood first issuekind:bugThis is a clearly a bugpending-responseprovider:standardstaleStale PRs per the .github/workflows/stale.yml policy file
Description
Apache Airflow version
Other Airflow 2 version (please specify below)
If "Other Airflow 2 version" selected, which one?
2.8.1
What happened?
When executing a DAG in KST (a specific timezone, NOT UTC), lower and upper bounds do not function correctly when set as follows:
- Set
lowerto 07:00 andupperto 23:00, assuming the task finishes at 07:50 KST. - The task's finish time is set to 22:50 UTC of the previous day, and both
lowerandupperare set to the same day, which is in the DAG timezone of KST. - As a result,
follow_task_ids_if_trueis not followed, leading to unintended outcomes. - When printing each time, the output is as follows:
AS-IS
now: 2024-06-08 22:50:00+00:00, lower: 2024-06-08 07:00:00+09:00, upper: 2024-06-08 23:00:00+09:00
# result: follow_task_ids_if_false
TO-BE
now: 2024-06-09 07:50:00+00:00, lower: 2024-06-09 07:00:00+09:00, upper: 2024-06-09 23:00:00+09:00
# result: follow_task_ids_if_trueI believe that this issue can be resolved if the 'now' and 'logical_date' calculation follows the DAG's timezone.
Thank you for looking into this issue.
What you think should happen instead?
No response
How to reproduce
- Create a wrapper for
BranchDateTimeOperatorand import this function. - Create a DAG as suggested in the Airflow example and set the timezone of the DAG's start_date to Asia/Seoul.
- Set
lowerto 07:00 andupperto 23:00. - Modify the now value in
choose_branchmethod of the wrapper class as shown below:
airflow/airflow/operators/datetime.py
Line 85 in fc4fbb3
now = timezone.coerce_datetime(timezone.utcnow()) # KST 07:50, Set the date to the previous day based on the execution day in KST. timezone.coerce_datetime(datetime.datetime(2024, 6, 8, 22, 50, 00, tzinfo=pendulum.timezone("UTC")))
- Print
now,lower, andupperinside the wrapper for debugging. - Execute your DAG.
- The result will be
follow_task_ids_if_false, which is not as intended.
Operating System
MWAA on AWS
Versions of Apache Airflow Providers
No response
Deployment
Amazon (AWS) MWAA
Deployment details
No response
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
_eol_affected_version:2.8Issues Reported for 2.8area:providersgood first issuekind:bugThis is a clearly a bugpending-responseprovider:standardstaleStale PRs per the .github/workflows/stale.yml policy file
Activity
boring-cyborg commentedon Jun 9, 2024
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
idantepper commentedon Jun 9, 2024
Hi I would like to take this issue
SeunghoJung commentedon Jun 12, 2024
@idantepper How is going on this issue?
prasad-madine commentedon Feb 5, 2025
Hello @SeunghoJung , Is this issue still exists?
prasad-madine commentedon Feb 10, 2025
Hello @SeunghoJung ,
In the first image, I have modified the now(current) datetime as
2025, 2, 6, 22, 50, 00and given the lower and upper bounds as2025, 2, 7, 7, 0and2025, 2, 7, 23, 0and getting the output correctly which isdate_in_range(which is assigned tofollow_task_ids_if_true). You can see the output in third image and this issue doesn't lies in thisversion 3.0.0.Thankyou.
github-actions commentedon Mar 24, 2025
This issue has been automatically marked as stale because it has been open for 14 days with no response from the author. It will be closed in next 7 days if no further activity occurs from the issue author.
github-actions commentedon Apr 1, 2025
This issue has been closed because it has not received response from the issue author.