-
Notifications
You must be signed in to change notification settings - Fork 7
add requester pay to s3 download and upload if in config settings #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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.config.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: | ||
|
|
@@ -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) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to parse the value as a boolean here?
or is the value in
self.configalready a boolean?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i just tested the value is already a boolean