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

add NamespacedTagSet api #22036

Merged
merged 6 commits into from
May 24, 2024
Merged

add NamespacedTagSet api #22036

merged 6 commits into from
May 24, 2024

Conversation

benpankow
Copy link
Member

Summary

Largely clones NamespacedMetadataSet into a new NamespacedTagSet ABC which can be used to define a set of tags which will be logically set together in code, and which have a namespace prefix.

A bit simpler, in that all values must be strings.

Test Plan

New little unit test suite.

@benpankow
Copy link
Member Author

benpankow commented May 22, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @benpankow and the rest of your teammates on Graphite Graphite

Copy link
Contributor

@sryza sryza left a comment

Choose a reason for hiding this comment

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

Nice.

There's a decent bit of duplication here with NamedspacedMetadataSet. We shouldn't force it, but have you thought about whether there's a way to cut that down? E.g. a common superclass?

@@ -107,6 +107,7 @@ Pipfile.lock
.mypy_cache/

tags
!python_modules/dagster/dagster/_core/definitions/tags
Copy link
Contributor

Choose a reason for hiding this comment

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

what's this?

Copy link
Member Author

Choose a reason for hiding this comment

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

We gitignore all folders named tags right now, I want to not gitignore this module

Args:
tags (Mapping[str, str]): A dictionary of tags.
"""
kwargs = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you thought about whether there are ways to avoid code duplication between this and the same method in NamespacedMetadataSet?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated to use NamespacedKVSet parent class

@benpankow
Copy link
Member Author

Ended up w/ a shared superclass, that cleans up both impls quite a bit I think

Copy link
Contributor

@sryza sryza left a comment

Choose a reason for hiding this comment

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

Nice. A couple small comments to look at before merging.

def extract(
cls: Type[T_NamespacedMetadataSet], metadata: Mapping[str, Any]
) -> T_NamespacedMetadataSet:
def extract(cls: Type[T_NamespacedKVSet], metadata: Mapping[str, Any]) -> T_NamespacedKVSet:
"""Extracts entries from the provided metadata dictionary into an instance of this class.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"""Extracts entries from the provided metadata dictionary into an instance of this class.
"""Extracts entries from the provided dictionary into an instance of this class.

Copy link
Contributor

Choose a reason for hiding this comment

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

Other sites in this docstring need to be updated.

@benpankow benpankow force-pushed the benpankow/tag-set branch 2 times, most recently from bbd9c55 to ff6489c Compare May 24, 2024 18:41
@benpankow
Copy link
Member Author

benpankow commented May 24, 2024

Merge activity

  • May 24, 1:07 PM PDT: @benpankow started a stack merge that includes this pull request via Graphite.
  • May 24, 1:08 PM PDT: Graphite rebased this pull request as part of a merge.
  • May 24, 1:09 PM PDT: @benpankow merged this pull request with Graphite.

@benpankow benpankow merged commit eebaa94 into master May 24, 2024
1 check was pending
@benpankow benpankow deleted the benpankow/tag-set branch May 24, 2024 20:09
danielgafni pushed a commit to danielgafni/dagster that referenced this pull request Jun 18, 2024
## Summary

Largely clones `NamespacedMetadataSet` into a new `NamespacedTagSet` ABC which can be used to define a set of tags which will be logically set together in code, and which have a namespace prefix.

A bit simpler, in that all values must be strings.

## Test Plan

New little unit test suite.
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.

None yet

2 participants