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

[bugfix] asset owner copying #19880

Merged
merged 1 commit into from
Feb 20, 2024
Merged

[bugfix] asset owner copying #19880

merged 1 commit into from
Feb 20, 2024

Conversation

smackesey
Copy link
Collaborator

@smackesey smackesey commented Feb 17, 2024

Summary & Motivation

The recently added owners_by_key field on AssetsDefinition breaks when copying an AssetsDefinition. Calling with_attributes on an AssetDefinition that had defined assets owners would trigger a runtime error due to performance of string operations on {Team,User}AssetOwner objects. Also the type annotation was incorrect for owners_by_key. This fixes the bug.

How I Tested These Changes

Add test for copying owners.

Copy link
Contributor

@rexledesma rexledesma left a comment

Choose a reason for hiding this comment

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

Thanks! See one comment before merging.

@@ -2062,9 +2062,9 @@ def test_asset_owners():
def my_asset():
pass

assert my_asset.owners_by_key == {
Copy link
Contributor

Choose a reason for hiding this comment

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

In my_asset, can we also test passing in TeamAssetOwner and UserAssetOwner instantiated objects?

@smackesey smackesey force-pushed the sean/fix-asset-owner-copying branch from 671dd81 to af90902 Compare February 20, 2024 15:19
@smackesey smackesey merged commit 656c87f into master Feb 20, 2024
1 check was pending
@smackesey smackesey deleted the sean/fix-asset-owner-copying branch February 20, 2024 15:38
@clairelin135
Copy link
Contributor

@smackesey thanks for fixing this 🙌

PedramNavid pushed a commit that referenced this pull request Mar 28, 2024
## Summary & Motivation

The recently added `owners_by_key` field on `AssetsDefinition` breaks
when copying an `AssetsDefinition`. Calling `with_attributes` on an
`AssetDefinition` that had defined assets owners would trigger a runtime
error due to performance of string operations on `{Team,User}AssetOwner`
objects. Also the type annotation was incorrect for `owners_by_key`.
This fixes the bug.

## How I Tested These Changes

Add test for copying owners.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants