@@ -352,8 +352,10 @@ async def list_artifact_tags(
352352 ) -> list [ArtifactTag ]:
353353 """List tags for a repository."""
354354
355- arf = artifact .Artifact (team_id = team_id , insecure = True )
356- return [ArtifactTag (name = tag ) for tag in arf .list_versions (repo_name )]
355+ arf = runtime .storage_runtime ().artifact
356+ return [
357+ ArtifactTag (name = tag ) for tag in arf .list_versions (f"{ team_id } /{ repo_name } " )
358+ ]
357359
358360 @staticmethod
359361 async def list_artifact_files (
@@ -362,8 +364,8 @@ async def list_artifact_files(
362364 """List files in an artifact without loading content."""
363365
364366 try :
365- arf = artifact . Artifact ( team_id = team_id , insecure = True )
366- file_paths = arf .pull (repo_name = repo_name , version = tag )
367+ arf = runtime . storage_runtime (). artifact
368+ file_paths = arf .pull (repo_name = f" { team_id } / { repo_name } " , version = tag )
367369
368370 if not file_paths :
369371 return []
@@ -405,11 +407,11 @@ async def get_artifact_content(
405407 """Get artifact content from registry."""
406408 try :
407409 # Initialize artifact client
408- arf = artifact . Artifact ( team_id = team_id , insecure = True )
410+ arf = runtime . storage_runtime (). artifact
409411
410412 # Pull the artifact - ORAS will manage temp directory
411413 # Returns absolute paths to files in ORAS temp directory
412- file_paths = arf .pull (repo_name = repo_name , version = tag )
414+ file_paths = arf .pull (repo_name = f" { team_id } / { repo_name } " , version = tag )
413415
414416 if not file_paths :
415417 raise RuntimeError ("No files found in artifact" )
@@ -875,4 +877,21 @@ def delete_experiments(experiment_ids: list[strawberry.ID]) -> int:
875877 @staticmethod
876878 def delete_dataset (dataset_id : strawberry .ID ) -> bool :
877879 metadb = runtime .storage_runtime ().metadb
880+ artifact = runtime .storage_runtime ().artifact
881+ dataset = metadb .get_dataset (dataset_id = dataset_id )
882+
883+ # delete the artifact file as well
884+ if dataset :
885+ try :
886+ repo_name , version = dataset .path .split (":" , 1 )
887+ artifact .delete (repo_name = repo_name , versions = version )
888+ except Exception as e :
889+ print (f"Failed to delete artifact for dataset { dataset_id } : { e } " )
890+
878891 return metadb .delete_dataset (dataset_id = dataset_id )
892+
893+ @staticmethod
894+ def delete_datasets (dataset_ids : list [strawberry .ID ]) -> bool :
895+ for id in dataset_ids :
896+ GraphQLMutations .delete_dataset (dataset_id = id )
897+ return True
0 commit comments