EOX GitLab Instance

Commit bd462eaa authored by Nikola Jankovic's avatar Nikola Jankovic 💻
Browse files

updated product_exists to match new scheme

parent 3ae9a71f
Pipeline #20776 passed with stage
in 1 minute and 9 seconds
import os
from functools import cached_property
from typing import TYPE_CHECKING, Union, Dict, List
from typing import TYPE_CHECKING, Union, Dict, List, Tuple
import boto3
import botocore
......@@ -92,9 +92,11 @@ class S3Uploader(Base, Uploader):
return local_remote_mapping
def product_exists(self, remote_dir: str) -> bool:
def product_exists(
self, remote_dir: str, expected_files_count: int = 2
) -> Tuple[bool, List[str]]:
objects = self.client.list_objects_v2(Bucket=self.bucket, Prefix=remote_dir)
if len(objects["Contents"]) >= 2:
return True
if len(objects["Contents"]) >= expected_files_count:
return True, [obj["Key"] for obj in objects["Contents"]]
return False
return False, []
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment