Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yfarjoun
Copy link
Contributor

…that have a "requester pays" component.


if (System.getProperty("google_project_requester_pays") == null && REQUESTER_PAYS_PROJECT != null) {
System.setProperty("google_project_requester_pays", REQUESTER_PAYS_PROJECT);
Log.getInstance(this.getClass()).info(
Copy link
Member

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?

Copy link
Contributor Author

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?

@@ -237,6 +240,13 @@ public int instanceMain(final String[] argv) {
if (System.getProperty("ga4gh.client_secrets") == null) {
System.setProperty("ga4gh.client_secrets", GA4GH_CLIENT_SECRETS);
}

if (System.getProperty("google_project_requester_pays") == null && REQUESTER_PAYS_PROJECT != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a way to get the default project from the environment I think. I don't know if you want to get that by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does GATK do that?

@@ -51,18 +50,20 @@ class GoogleStorageUtils {

public static void initialize() {
// requester pays support is currently not configured
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment is out of date now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -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");
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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?

Copy link
Member

@lbergelson lbergelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yfarjoun Looks good I think, although the value looks like it depends on the order things get loaded so I would check that it's working as intended when overriding a system property.

@yfarjoun
Copy link
Contributor Author

@kachulis what's the protocol now? who needs to give this a 👍 so that it can be merged?

@droazen
Copy link
Contributor

droazen commented Nov 14, 2023

@yfarjoun @lbergelson This PR can't be merged as-is because:

  • The new argument looks like it won't work reliably, since the PathProvider enum will get classloaded (triggering a call to GoogleStorageUtils.initialize()) before the argument value is propagated to the corresponding system property
  • This entire approach is obsolete anyway since there's no longer a separate Picard cloud jar, and we can just unconditionally set the requester pays project from instanceMain() instead of relying on classloading trickery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants