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

Add java_opts to cbioportalImporter.py #13

Merged
merged 3 commits into from
Apr 4, 2024
Merged

Add java_opts to cbioportalImporter.py #13

merged 3 commits into from
Apr 4, 2024

Conversation

oplantalech
Copy link
Contributor

@oplantalech oplantalech commented Feb 26, 2024

Currently we can only pass the jar_path to cbioportalImporter.py. This adds java_opts as a new option to cbioportalImporter.py to allow passing any JAVA_OPTS parameter. This allows us pass max memory usage etc. The jar_path option is retained in a backward-compatible manner

@oplantalech oplantalech added the enhancement New feature or request label Feb 26, 2024
Copy link
Contributor

@MatthijsPon MatthijsPon left a comment

Choose a reason for hiding this comment

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

Looks good, would be nice to be able to throttle memory for the loader, some questions:

if args.java_opts is None:
args.java_opts = f"-cp {jar_path}"
else:
args.java_opts = f"-cp {jar_path} {args.java_opts}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this not become -cp -cp JAR_PATH OTHER_JAVA_OPTS if -cp is specified in java_opts?

Copy link
Contributor Author

@oplantalech oplantalech Feb 27, 2024

Choose a reason for hiding this comment

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

No, because this line only evaluates when there is no -cp in args.java_opts

parser.add_argument('-jar', '--jar_path', type=str, required=False,
help='Path to scripts JAR file')
help='DEPRECATED ARGUMENT. Please, use -jvo/--java_opts instead. If you \
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not:

if args.jar_path:
    args.java_opts = f"-cp {args.jar_path} {args.java_opts}"

Then there is no 'need' to deprecate and you can replace it with something like 'WILL BE DEPRECATED IN THE FUTURE'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm... but we want people to move away from using jar_path, right? We should then force them somehow to use the new attribute

Copy link
Contributor

@JREastonMarks JREastonMarks left a comment

Choose a reason for hiding this comment

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

I like the idea of adding java_opts as a parameter to these scripts. However, I agree with @MatthijsPon that this should be a warning at the most and we should continue to support jar_path. Asking all sites that use this to change to a new way of launching this is a big ask especially with no warning. We are doing that enough with spinning out CORE into it's own repo.

@inodb
Copy link
Member

inodb commented Mar 7, 2024

Since JAVA_OPTS is an env parameter, another way of going about it is to pass the environment from the main process:

https://stackoverflow.com/questions/2231227/python-subprocess-popen-with-a-modified-environment

Avoids adding additional code to handle another cli parameter and u could e.g. set java opts directly as env on the container. Not sure if that is necessary more clear to a user tho (as you're sorta passing a JAVA_OPTS env variable to a Pyhon wrapper script)

@oplantalech
Copy link
Contributor Author

@inodb I've tried to set the JAVA_OPTS from the environment as the default for --java_opts (so only if --java_opts is not specified). Not sure if that's what we want, though. Also, if now the JAVA_OPTS from the environment defines the classpath, then we use that classpath instead of locating the JAR file relative to the import script. Is that what we want?

Copy link
Member

@inodb inodb left a comment

Choose a reason for hiding this comment

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

LGTM - thank you!

@oplantalech oplantalech changed the title Convert jar_path to java_opts Add java_opts to cbioportalImporter.py Apr 4, 2024
@inodb inodb merged commit 2047090 into main Apr 4, 2024
2 checks passed
@oplantalech oplantalech self-assigned this Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants