Skip to content
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

Asset event is not created for asset decorator Dag #46958

Open
1 of 2 tasks
atul-astronomer opened this issue Feb 21, 2025 · 12 comments · May be fixed by #47677
Open
1 of 2 tasks

Asset event is not created for asset decorator Dag #46958

atul-astronomer opened this issue Feb 21, 2025 · 12 comments · May be fixed by #47677
Assignees
Labels
affected_version:3.0.0beta For all 3.0.0 beta releases area:core area:datasets Issues related to the datasets feature kind:bug This is a clearly a bug priority:critical Showstopper bug that should be patched immediately
Milestone

Comments

@atul-astronomer
Copy link

Apache Airflow version

main (development)

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

No response

What happened?

Asset event should be created when user triggers a Dag which is defined using asset decorator.

Image Image Image

What you think should happen instead?

An asset event should be created since asset defined using asset decorator is outlet asset by default.

How to reproduce

Trigger the below Dag and check for asset events.

@asset(schedule=None)
def asset_decorator():
    pass

Operating System

Linux

Versions of Apache Airflow Providers

No response

Deployment

Other

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

@atul-astronomer atul-astronomer added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels Feb 21, 2025
@atul-astronomer
Copy link
Author

@vatsrahul1001

@dosubot dosubot bot added the area:datasets Issues related to the datasets feature label Feb 21, 2025
@vatsrahul1001 vatsrahul1001 added the affected_version:3.0.0alpha For all 3.0.0 alpha releases label Feb 21, 2025
@vikramkoka vikramkoka removed the needs-triage label for new issues that we didn't triage yet label Feb 21, 2025
@Lee-W
Copy link
Member

Lee-W commented Feb 24, 2025

just verified it and it does not relates to the inlet event PR

@vatsrahul1001 vatsrahul1001 added the priority:medium Bug that should be fixed before next release but would not block a release label Feb 25, 2025
@vatsrahul1001 vatsrahul1001 added affected_version:3.0.0beta For all 3.0.0 beta releases and removed affected_version:3.0.0alpha For all 3.0.0 alpha releases labels Mar 4, 2025
@uranusjr
Copy link
Member

This is caused by an AssetRef is not currently handled correctly in the execution model, but the asset decorator uses AssetRef to define asset relationships between dags. So… many layers to fix—collecting events after execution, sending events with ref (not full assets) to the execution API, and resolving them in the scheduler. Going to take a while…

@Lee-W
Copy link
Member

Lee-W commented Mar 11, 2025

This is caused by an AssetRef is not currently handled correctly in the execution model, but the asset decorator uses AssetRef to define asset relationships between dags. So… many layers to fix—collecting events after execution, sending events with ref (not full assets) to the execution API, and resolving them in the scheduler. Going to take a while…

The last time I tried, it worked fine with #47292. but yep, we still have many issue on the execution end

@uranusjr
Copy link
Member

I think #47292 is not enough if we go through the task sdk; it’d still fail since the execution api can’t serialise things correctly.

@Lee-W
Copy link
Member

Lee-W commented Mar 11, 2025

just take a deeper look. The logic looks very wrong... asset_type handling is also incorrect

@vatsrahul1001 vatsrahul1001 added priority:high High priority bug that should be patched quickly but does not require immediate new release priority:critical Showstopper bug that should be patched immediately and removed priority:medium Bug that should be fixed before next release but would not block a release priority:high High priority bug that should be patched quickly but does not require immediate new release labels Mar 11, 2025
@Lee-W
Copy link
Member

Lee-W commented Mar 11, 2025

I added yet another draft PR as a tmp workaround to make asset subclasses (including @ asset) works ok. #47598

@uranusjr
Copy link
Member

Yeah I noticed that too. The way I changed it is to always just use Asset.__name__ AssetNameRef.__name__ etc. like when those values are handled in register_asset_changes_in_db. I think that’s probably cleaner.

@Lee-W
Copy link
Member

Lee-W commented Mar 11, 2025

Yeah I noticed that too. The way I changed it is to always just use Asset.__name__ AssetNameRef.__name__ etc. like when those values are handled in register_asset_changes_in_db. I think that’s probably cleaner.

If handle it that way, we still need to check whether subclasses like Dataset and Model are Asset?

@uranusjr
Copy link
Member

User-defined asset subclasses is only useful at execution time (if the user wants to introspect), and the UI (where we show asset_type as a string). But in register_asset_changes_in_db we don’t actually care about those subclasses, they are all assets and go through the exact same code path without any distinction. So these two probably should be two separate fields (and the one used in register_asset_changes_in_db should not be named asset_type).

@phanikumv
Copy link
Contributor

Targeting to complete this by EOD today, so that we can get this included in tomorrow's beta release

@kaxil kaxil added this to the Airflow 3.0.0 milestone Mar 12, 2025
@uranusjr
Copy link
Member

This will be fixed by the combination of #47659 and #47677.

@uranusjr uranusjr linked a pull request Mar 13, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected_version:3.0.0beta For all 3.0.0 beta releases area:core area:datasets Issues related to the datasets feature kind:bug This is a clearly a bug priority:critical Showstopper bug that should be patched immediately
Projects
None yet
7 participants