`.airflowignore`'d DAGs visible in UI via `Assets`/`AssetEvents`
Apache Airflow version
main (development)
If "Other Airflow 2/3 version" selected, which one?
No response
What happened?
When DAGs that previously outlet/scheduled by Assets are added to .airflowignore, these DAGs can still be navigated to (via a DAG run).
Further Explanation
dag_aoutlets toasset_1dag_bhasschedule=[Asset("asset_1")]dag_ais executed which triggersdag_bviaasset_1- Then, both of these DAGs are added to the
.airflowignorefile
However, going back into the Airflow UI to .../assets allows for navigation to a DAG run for both of the ignored DAGs.
What you think should happen instead?
If a DAG is included in the .gitignore file and is NOT visible in the UI, it should also remaining NOT visible (for any DAG runs) when going to triggering/scheduled DAG events.
How to reproduce
- Author a
dag_aanddag_bas shown below. - Leave
.airflowignoreempty. - Turn on
dag_b. - Turn on
dag_a. - Validate that an
AssetEventforasset_1is generated. - Update
.airflowignoreto includedag_aanddag_b. - Restart local instance of Airflow.
- Validate that no DAGs are present in
localhost:28080/dags. - Navigate to the "Assets" view.
- Click on
asset_1. You should then see a singleAssetEventwith "Source"" =dag_aand "Triggered Dag Run" =dag_b. - Click on the "Source" (
dag_a). You should see a DAG run for the ignoreddag_a. - Go back, and click on the "Triggered DAG Run" (
dag_b). You should see a DAG run for the ignored DAG.
dag_a
from airflow.sdk import Asset, DAG, task
with DAG(
dag_id="dag_a",
schedule="@once"
) as dag:
@task(outlets=[Asset("asset_1")])
def task_1():
print("Running dag_a::task_1")
task_1()
dag_b
from airflow.sdk import Asset, DAG, task
with DAG(
dag_id="dag_b",
schedule=[Asset("asset_1")]
) as dag:
def task_1():
print("Running dag_b::task_1")
task_1()
Operating System
MacOS
Versions of Apache Airflow Providers
NA
Deployment
Other
Deployment details
Running on the main branch, locally.
Anything else?
No response
Are you willing to submit PR?
- [x] Yes I am willing to submit a PR!
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
cc: @potiuk, @jscheffl
Likely wrong API queries @pierrejeambrun @ephraimbuddy @uranusjr
All related entities to a stale DAG should be removed from the UI?
Runs related to a Stale DAG shouldn't be ever displayed. Should we expand that to asset events etc and all other entities ?
Because that would be weird to block the redirect for 'runs' of staled DAG, but still show asset events produced by staled DAG. (same for xcoms and such).
All related entities to a stale DAG should be removed from the UI?
Runs related to a Stale DAG shouldn't be ever displayed. Should we expand that to asset events etc and all other entities ?
Because that would be weird to block the redirect for 'runs' of staled DAG, but still show asset events produced by staled DAG. (same for xcoms and such).
Yeah sounds reasonable. I definitely think it should be consistent, and hiding the stale dags and assets seems like best idea.