Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 11 additions & 2 deletions dmrpp_generator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,17 @@ def get_bucket(filename, files, buckets):
break
return buckets[bucket_type]

def _get_s3_extra(self):
"""Helper to build the extra dict for S3 operations."""
extra = {}
if self.dmrpp_meta.get("requester_pay", False):
extra["RequestPayer"] = "requester"
return extra

def upload_file_to_s3(self, filename, uri):
""" Upload a local file to s3 if collection payload provided """
return s3.upload(filename, uri, extra={})
extra = self._get_s3_extra()
return s3.upload(filename, uri, extra=extra)

def process(self):
if 'EBS_MNT' in os.environ:
Expand Down Expand Up @@ -267,7 +275,8 @@ def dmrpp_generate(self, input_file, local=False, dmrpp_meta=None, args=None):
"""
# Force dmrpp_meta to be an object
dmrpp_meta = dmrpp_meta if isinstance(dmrpp_meta, dict) else {}
file_full_path = input_file if local else s3.download(input_file, path=self.path)
extra = self._get_s3_extra()
file_full_path = input_file if local else s3.download(input_file, path=self.path, extra=extra)
cmd = self.get_dmrpp_command(dmrpp_meta, file_full_path)
if args:
cmd_split = cmd.split(' ', maxsplit=1)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ certifi==2024.7.4
charset-normalizer==3.3.2
cumulus-message-adapter==2.0.3
cumulus_message_adapter_python==2.2.0
cumulus_process==1.3.0
cumulus_process==1.5.0
decorator==5.1.1
dicttoxml==1.7.16
idna==3.7
Expand Down
Loading