Skip to content

Commit

Permalink
[SDK] Fix list_artifact_tags function (#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hedingber committed Dec 30, 2020
1 parent eb60ecf commit bebfe4d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
5 changes: 3 additions & 2 deletions mlrun/db/base.py
Expand Up @@ -156,8 +156,9 @@ def list_projects(
def get_project(self, name: str) -> schemas.Project:
pass

def list_artifact_tags(self, project):
return []
@abstractmethod
def list_artifact_tags(self, project=None):
pass

@abstractmethod
def create_feature_set(
Expand Down
3 changes: 3 additions & 0 deletions mlrun/db/filedb.py
Expand Up @@ -611,6 +611,9 @@ def list_pipelines(
) -> mlrun.api.schemas.PipelinesOutput:
raise NotImplementedError()

def list_artifact_tags(self, project=None):
raise NotImplementedError()


def make_time_pred(since, until):
if not (since or until):
Expand Down
8 changes: 8 additions & 0 deletions mlrun/db/httpdb.py
Expand Up @@ -346,6 +346,14 @@ def del_artifacts(self, name=None, project=None, tag=None, labels=None, days_ago
error = "del artifacts"
self.api_call("DELETE", "artifacts", error, params=params)

def list_artifact_tags(self, project=None):
project = project or default_project
error_message = f"Failed listing artifact tags. project={project}"
response = self.api_call(
"GET", f"/projects/{project}/artifact-tags", error_message
)
return response.json()

def store_function(self, function, name, project="", tag=None, versioned=False):
params = {"tag": tag, "versioned": versioned}
project = project or default_project
Expand Down
2 changes: 1 addition & 1 deletion mlrun/db/sqldb.py
Expand Up @@ -160,7 +160,7 @@ def list_functions(self, name=None, project=None, tag=None, labels=None):
self.db.list_functions, self.session, name, project, tag, labels
)

def list_artifact_tags(self, project):
def list_artifact_tags(self, project=None):
return self._transform_db_error(
self.db.list_artifact_tags, self.session, project
)
Expand Down

0 comments on commit bebfe4d

Please sign in to comment.