Skip to content

Commit

Permalink
Refactor metadata loading to better handle missing or misplaced metad…
Browse files Browse the repository at this point in the history
…ata (#439)

* Refactor metadata loading

* Only sort if any were loaded

* Support 3.9

* Guarding a few other situations

* Add two tests

* Move typevar and cleanup one try/except
  • Loading branch information
stephenpardy authored Jun 13, 2024
1 parent 0a28bc3 commit 92ee3ae
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 97 deletions.
2 changes: 1 addition & 1 deletion rubicon_ml/client/rubicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def get_project_as_df(self, name, df_type="pandas", group_by=None):
return project.to_df(df_type=df_type, group_by=None)

@failsafe
def get_or_create_project(self, name: str, **kwargs):
def get_or_create_project(self, name: str, **kwargs) -> Project:
"""Get or create a project.
Parameters
Expand Down
7 changes: 6 additions & 1 deletion rubicon_ml/domain/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Union
from typing import TypeVar, Union

from rubicon_ml.domain import utils
from rubicon_ml.domain.artifact import Artifact
Expand All @@ -13,6 +13,11 @@

DOMAIN_TYPES = Union[Artifact, Dataframe, Experiment, Feature, Metric, Parameter, Project]

DomainsVar = TypeVar(
"DomainsVar", Artifact, Dataframe, Experiment, Feature, Metric, Parameter, Project
)


__all__ = [
"Artifact",
"Dataframe",
Expand Down
Loading

0 comments on commit 92ee3ae

Please # to comment.