Skip to content

Fix: manually triggered DAGs with future start_date not running tasks - #40711

Closed
artilexx wants to merge 15 commits into
apache:mainfrom
artilexx:main
Closed

artilexx wants to merge 15 commits into
apache:mainfrom
artilexx:main

Conversation

@artilexx

@artilexx artilexx commented Jul 11, 2024 •

Copy link
Copy Markdown
Contributor

Issue reference: #38513

task_filter() would filter out tasks when manually triggering tasks with a future start_date, causing them to not run while the dag would be marked as a success. Created a condition to bypass the filter if run_type is MANUAL

Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@artilexx
artilexx requested review from XD-DENG, ashb and kaxil as code owners July 11, 2024 02:29
Comment thread airflow/models/dag.py Outdated
# create the associated task instances
# state is None at the moment of creation
run.verify_integrity(session=session)
run.verify_integrity(session=session, run_type=run_type)

@uranusjr uranusjr Jul 12, 2024 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of passing in run_type and do a check inside the function, this should just be a flag to skip task_filter.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changed, can't completely skip task_filter otherwise it doesn't remove tasks properly but even with my current solution it still fails one test case

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it looks like the test depends on task.start_date <= self.execution_date, which gets overridden

@artilexx
artilexx marked this pull request as draft July 18, 2024 01:57
Comment thread airflow/models/dag.py
Comment on lines +342 to +345
if run_type == DagRunType.MANUAL:
run.verify_integrity(session=session, skip_task_filter=True)
else:
run.verify_integrity(session=session, skip_task_filter=False)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

less code?

Suggested change
if run_type == DagRunType.MANUAL:
run.verify_integrity(session=session, skip_task_filter=True)
else:
run.verify_integrity(session=session, skip_task_filter=False)
run.verify_integrity(session=session, run_type == DagRunType.MANUAL)

@github-actions

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Sep 24, 2024
@github-actions github-actions Bot closed this Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Stale PRs per the .github/workflows/stale.yml policy file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants