-
Notifications
You must be signed in to change notification settings - Fork 368
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
Enables setting the google-project that will be charged for requests … #1825
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -24,7 +24,6 @@ | |
|
||
package picard.nio; | ||
|
||
|
||
import com.google.cloud.storage.StorageOptions; | ||
import com.google.cloud.storage.contrib.nio.CloudStorageConfiguration; | ||
import com.google.cloud.storage.contrib.nio.CloudStorageFileSystemProvider; | ||
|
@@ -50,19 +49,20 @@ | |
class GoogleStorageUtils { | ||
|
||
public static void initialize() { | ||
// requester pays support is currently not configured | ||
CloudStorageFileSystemProvider.setDefaultCloudStorageConfiguration(GoogleStorageUtils.getCloudStorageConfiguration(20, null)); | ||
final String google_project = System.getProperty("google_project_requester_pays"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like this is a bit load-order dependent. Have you checked that the commandline argument overrides the setting in the way you want? I think it's also possible to get the default google project so it's not necessary to specify at all. In gatk we instantiate a preferences object and check if it has a value for the project I think, but I'm not sure if it works or has any weirdness. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about we get this simple version to work and if people need something else, it can be added later? |
||
|
||
CloudStorageFileSystemProvider.setDefaultCloudStorageConfiguration(GoogleStorageUtils.getCloudStorageConfiguration(20, google_project)); | ||
CloudStorageFileSystemProvider.setStorageOptions(GoogleStorageUtils.setGenerousTimeouts(StorageOptions.newBuilder()).build()); | ||
} | ||
|
||
/** The config we want to use. **/ | ||
private static CloudStorageConfiguration getCloudStorageConfiguration(int maxReopens, String requesterProject) { | ||
CloudStorageConfiguration.Builder builder = CloudStorageConfiguration.builder() | ||
private static CloudStorageConfiguration getCloudStorageConfiguration(final int maxReopens, final String requesterProject) { | ||
final CloudStorageConfiguration.Builder builder = CloudStorageConfiguration.builder() | ||
// if the channel errors out, re-open up to this many times | ||
.maxChannelReopens(maxReopens); | ||
if (!Strings.isNullOrEmpty(requesterProject)) { | ||
// enable requester pays and indicate who pays | ||
builder = builder.autoDetectRequesterPays(true).userProject(requesterProject); | ||
builder.autoDetectRequesterPays(true).userProject(requesterProject); | ||
} | ||
|
||
// this causes the gcs filesystem to treat files that end in a / as a directory | ||
|
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.
Should this only be output if the google libraries are loaded?
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.
if the libraries are not loaded, what's the meaning of having "requestor pays"? is there something you'd like it to output in that case?