Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions snakemake_storage_plugin_s3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import boto3
import botocore.credentials
import os

from snakemake_interface_common.exceptions import WorkflowError
from snakemake_interface_storage_plugins.settings import StorageProviderSettingsBase
Expand Down Expand Up @@ -232,12 +233,14 @@ async def inventory(self, cache: IOCacheStorageInterface):
# bucket has been inventorized before, stop here
return

# check if bucket exists
if not self.bucket_exists():
cache.exists_in_storage[self.cache_key()] = False
else:
cache.exists_in_storage[self.get_inventory_parent()] = True
for obj in self.s3bucket().objects.all():
return

cache.exists_in_storage[self.get_inventory_parent()] = True
prefix = os.path.dirname(self.key)
if prefix:
for obj in self.s3bucket().objects.filter(Prefix=prefix):
key = self.cache_key(self._local_suffix_from_key(obj.key))
cache.mtime[key] = Mtime(storage=obj.last_modified.timestamp())
cache.size[key] = obj.size
Expand Down