Skip to content

Conversation

@gopidesupavan
Copy link
Member

related: #56954

TriggerDagRunOperator failing when the operator args sets fail_when_dag_is_paused in AF3 we are blocking the db access, but in the current TriggerDagRunOperator it still trying to use the DagModel, causing the db error. see the issue above where user explained.

here its accessing DagModel.
https://github.com/apache/airflow/blob/main/providers/standard/src/airflow/providers/standard/operators/trigger_dagrun.py#L219

Adding the GetDagState endpoint to get whether dag is paused or in active.

Fix is required for the TriggerDagRunOperator in standard provider, after this merge will add a fix.


^ Add meaningful description above
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 airflow-core/newsfragments.

@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:task-sdk labels Oct 21, 2025
@gopidesupavan
Copy link
Member Author

Not sure we can treat this as bugfix and backport to v3-1.

Comment on lines +555 to +634
@staticmethod
def get_dag_state(dag_id: str) -> DagStateResult:
"""Return the state of the Dag run with the given Run ID."""
response = SUPERVISOR_COMMS.send(msg=GetDagState(dag_id=dag_id))

if TYPE_CHECKING:
assert isinstance(response, DagStateResult)

return response

Copy link
Member

Choose a reason for hiding this comment

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

What is going to call this?

Copy link
Member Author

Choose a reason for hiding this comment

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

@ashb
Copy link
Member

ashb commented Oct 24, 2025

@gopidesupavan @kaxil Rather than a seaprate check, how about adding this as a parameter to the existing TriggerRun message and API endpoint -- and then if the dag is paused the API could return an error (412 Precondition Failed for giggles?) which could then be returned to the task code

@gopidesupavan
Copy link
Member Author

@gopidesupavan @kaxil Rather than a seaprate check, how about adding this as a parameter to the existing TriggerRun message and API endpoint -- and then if the dag is paused the API could return an error (412 Precondition Failed for giggles?) which could then be returned to the task code

Yeah thats also an option good thought, but for now there is no-way if anyone wants to see dag status. not sure is it worth adding this endpoint or not. am happy to make a change if this is not required.

@github-actions
Copy link

github-actions bot commented Dec 9, 2025

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 Dec 9, 2025
@github-actions github-actions bot closed this Dec 14, 2025
@gopidesupavan gopidesupavan reopened this Dec 26, 2025
@gopidesupavan gopidesupavan force-pushed the dag-state-api-for-task-sdk branch from 360e013 to 5581f56 Compare December 26, 2025 21:28
@github-actions github-actions bot removed the stale Stale PRs per the .github/workflows/stale.yml policy file label Dec 27, 2025
@gopidesupavan gopidesupavan force-pushed the dag-state-api-for-task-sdk branch from 5581f56 to d44eb85 Compare December 29, 2025 13:09
@gopidesupavan gopidesupavan force-pushed the dag-state-api-for-task-sdk branch from 84ca7ee to 4791527 Compare January 8, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:task-sdk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants