Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add category filter to list artifacts (#462)
- Loading branch information
Showing
7 changed files
with
148 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import enum | ||
import typing | ||
|
||
|
||
class ArtifactCategories(str, enum.Enum): | ||
model = "model" | ||
dataset = "dataset" | ||
other = "other" | ||
|
||
def to_kinds_filter(self) -> typing.Tuple[typing.List[str], bool]: | ||
# FIXME: these artifact definitions (or at least the kinds enum) should sit in a dedicated module | ||
# import here to prevent import cycle | ||
import mlrun.artifacts.dataset | ||
import mlrun.artifacts.model | ||
|
||
if self.value == ArtifactCategories.model.value: | ||
return [mlrun.artifacts.model.ModelArtifact.kind], False | ||
if self.value == ArtifactCategories.dataset.value: | ||
return [mlrun.artifacts.dataset.DatasetArtifact.kind], False | ||
if self.value == ArtifactCategories.other.value: | ||
return ( | ||
[ | ||
mlrun.artifacts.model.ModelArtifact.kind, | ||
mlrun.artifacts.dataset.DatasetArtifact.kind, | ||
], | ||
True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters