Skip to content

Commit

Permalink
[Exchange Oracle] Delete cloud storages after projects have been deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobronium committed Sep 2, 2024
1 parent 9233a90 commit 8b93823
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,17 @@


def _cleanup_cvat(projects: list[Project]) -> None:
deleted_cloud_storage_ids = set()
cloud_storage_ids_to_delete = set() # probably will allways have one element
for project in projects:
if (
project.cvat_cloudstorage_id is not None
and project.cvat_cloudstorage_id not in deleted_cloud_storage_ids
):
with contextlib.suppress(NotFoundException):
# probably will allways call this just once
cvat_api.delete_cloudstorage(project.cvat_cloudstorage_id)
deleted_cloud_storage_ids.add(project.cvat_cloudstorage_id)
cloud_storage_ids_to_delete.add(project.cvat_cloudstorage_id)
if project.cvat_id is not None:
with contextlib.suppress(NotFoundException):
cvat_api.delete_project(project.cvat_id)

for cloud_storage_id in cloud_storage_ids_to_delete:
with contextlib.suppress(NotFoundException):
cvat_api.delete_cloudstorage(cloud_storage_id)


def _cleanup_storage(escrow_address: str, chain_id: int) -> None:
storage_client = cloud_service.make_client(BucketAccessInfo.parse_obj(Config.storage_config))
Expand Down

0 comments on commit 8b93823

Please sign in to comment.