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

Correctly assign asset type in AssetProfile #47659

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

uranusjr
Copy link
Member

The asset_type field in AssetProfile is for distinguishing between different asset-related types (Asset, ref, or alias). However, it used type(obj).name, which does not account for subclasses correctly. Since we don't really care about asset subclasses in the scheduler (they are only meaningful to the user, either in UI and at runtime in the task runner), we can simply coerce them into the base class we care about. This means ditching the type() call altogether to just use the base class directly.

The field is also renamed to 'type' to avoid confusion since 'asset_type' has another meaning in the Asset class.

Two tests on asset ref around this has been marked as xfail since the task runner does not currently handle them correctly. They will be fixed in an upcoming PR.

Close #47598.

@uranusjr uranusjr force-pushed the asset-type-refactor branch from 818b350 to 5f249e0 Compare March 12, 2025 08:22
The asset_type field in AssetProfile is for distinguishing between
different asset-related types (Asset, ref, or alias). However, it used
type(obj).__name__, which does not account for subclasses correctly.
Since we don't really care about asset subclasses in the scheduler (they
are only meaningful to the user, either in UI and at runtime in the task
runner), we can simply coerce them into the base class we care about.
This means ditching the type() call altogether to just use the base
class directly.

The field is also renamed to 'type' to avoid confusion since 'asset_type'
has another meaning in the Asset class.

Two tests on asset ref around this has been marked as xfail since the
task runner does not currently handle them correctly. They will be fixed
in an upcoming PR.
@uranusjr uranusjr force-pushed the asset-type-refactor branch from 5f249e0 to 00c6372 Compare March 12, 2025 09:03
@uranusjr
Copy link
Member Author

One provider test failing, but I’m seeing the same in other PRs too. Merging this since it seems entirely unrelated.

@uranusjr uranusjr merged commit 64f8bd7 into apache:main Mar 12, 2025
87 of 89 checks passed
@uranusjr uranusjr deleted the asset-type-refactor branch March 12, 2025 10:17
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.

2 participants