Skip to content

Event Driven Dags can miss/delay runs when paused #49857

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 2 tasks
darkag opened this issue Apr 27, 2025 · 7 comments
Closed
1 of 2 tasks

Event Driven Dags can miss/delay runs when paused #49857

darkag opened this issue Apr 27, 2025 · 7 comments
Labels
area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet pending-response stale Stale PRs per the .github/workflows/stale.yml policy file

Comments

@darkag
Copy link
Contributor

darkag commented Apr 27, 2025

Apache Airflow version

3.0.0

If "Other Airflow 2 version" selected, which one?

No response

What happened?

Hello,
I was playing with the "example_asset_with_watchers" sample dags in order to see how works the new event driven scheduling and I've seen that when you pause dag,there is a short period during which if a file is created, it will be processed by the FileDeleteTrigger, be added in the event list but since the dag is paused it will not plan an run (until now it's ok) but when dag is unpaused this event will not trigger a dag run until next time a file is created or you manually create a "fake" asset event.

What you think should happen instead?

Since I don't think it's possible to prevent the event creation, when unpaused a dag run should be launched to process not treated events

How to reproduce

use the example_asset_with_watchers sample dag, pause it and fastly create the /tmp/test file, a event should be created and then unpause dag. the event will remain "untreated" until a new one is triggered

Operating System

debian 12

Versions of Apache Airflow Providers

No response

Deployment

Official Apache Airflow Helm Chart

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

@darkag darkag added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels Apr 27, 2025
@gopidesupavan
Copy link
Member

gopidesupavan commented Apr 27, 2025

I believe this is the current behaviour, the dag must be active when you using event driven and thats what i see at-least event driven meaning. the request your referring is something like new functionality that is like, store the events and process. cc: @vincbeck please correct me. :)

@vatsrahul1001
Copy link
Contributor

Yeah DAG needs to be active.

@darkag
Copy link
Contributor Author

darkag commented Apr 28, 2025

thanks for your reponses, if I understand event driven dags should never be paused and if I need to prevent it to run (ex in case of maintenance of a database) I need to block what causes trigger to return event (in case of example_asset_with_watchers I need to stop what create /tmp/test file) ?

Other question, during my tests I guess that one time between the time that dags was paused and the trigger stop whatching for file, the /tmp/test was deleted but no asset event was generated, but since I was not able to find which part of code manage the return of trigger and create the asset event I was not able to push more investigation. Could you tell me where I can find these code ?

@vincbeck
Copy link
Contributor

I confirm everything that has been said here. example_asset_with_watchers might not be the best example and I might replace with a real world scenario. A paused DAG will never be executed if it receives an event (because it is paused). If you want to emit event -> store event -> process event then you might want to use a queue. It needs to be configured outside of Airflow. You configure you env to be send to a queue of choice and then you, in Airflow, your configure your DAG to be executed whenever a new message lands in the queue. Today only SQS is available (with SqsMessageQueueProvider) as queue provider to be compatible with event driven scheduling but other providers should be soon available.

Other question, during my tests I guess that one time between the time that dags was paused and the trigger stop whatching for file, the /tmp/test was deleted but no asset event was generated, but since I was not able to find which part of code manage the return of trigger and create the asset event I was not able to push more investigation. Could you tell me where I can find these code ?

https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/assets/manager.py#L109

@darkag
Copy link
Contributor Author

darkag commented Apr 28, 2025

thanks for your response, I've managed to understand what happens when file is delete but no asset_event is created when pausing the dag. In fact, it seems that the asset_trigger link is deleted between the moment trigger yield event and the moment register_asset_change is called due to dag paused.

It may not be considered as a bug since event driven dag should not be paused, but it's limit their usage to handle case when you have the possibility to pause the initial event source or if events doesn't have significant payload and you can wait for the next event/create a dummy event from UI after unpausing

Copy link

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 github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label May 13, 2025
Copy link

This issue has been closed because it has not received response from the issue author.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet pending-response stale Stale PRs per the .github/workflows/stale.yml policy file
Projects
None yet
Development

No branches or pull requests

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy