-
Notifications
You must be signed in to change notification settings - Fork 106
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
Pass args on JVM startup #72
Comments
Hi! Actually yes, you should have run_kernel.py file as a part of your kernel installation. And there, you may add any java arguments. In your case it will be ['java', '-Xmx=8G', '-jar'], and so on |
Thanks, this workaround will do the trick in my case ! |
I agree that this way is ugly and inconvinient. We will think about simplifying it, but I'm not sure that specifying options in notebook will work - it requires tweaking kernel connecting process. Thank you for pointing to this problem! |
Would also like the option to somehow influence the heap allocation without having users having to modify the kernel startup parameters. I see two options:
|
It's easy enough to parameterize based on an environment variable or config file in the kernelspec, which does require a separate kernel, but not a separate pip/conda package. See #287. I can PR something for it after #287, I would do it by adding an environment variable and a |
I haven't tested this, but I would think you could do something like |
If I understand correctly, that doesn't allow an normal end-user (so using a web-browser to access a notebook) to select a certain JVM heap size. For example this wouldn't allow me to select a different heap-size on datalore. |
I think you could set it via a secret, but regardless you'd need some sort of UI either in datalore or jupyter. Said UI would use the environment variable to pass it to the kernel. |
For my use-case I would prefer that in the kernel.json I can optionally specify JVM parameters that would be used by the run_kernel.py when starting the JVM. So similar how this was solved for IJava: Default: {
"display_name": "Kotlin",
"language": "kotlin",
"interrupt_mode": "message",
"argv": [
"python",
"-m",
"run_kotlin_kernel",
"{connection_file}"
]
} Added JVM options: {
"display_name": "Kotlin Large",
"language": "kotlin",
"interrupt_mode": "message",
"argv": [
"python",
"-m",
"run_kotlin_kernel",
"-jvm", "-Xmx8G"
"{connection_file}"
]
}
So the change would only be in run_kernel that would check for the -jvm argument being provided and if so add it to the startup command of the JVM. |
You can do that just fine with environment variables, in fact that's how I'm creating JVM kernels. Something like: {
"display_name": "Kotlin",
"language": "kotlin",
"interrupt_mode": "message",
"argv": [
"python",
"-m",
"run_kotlin_kernel",
"{connection_file}"
],
"env": {
"KOTLIN_JUPYTER_JVM_ARGS": "-Xmx8G"
}
} Would that work for you? |
Yes :) I wrongly assumed env variables are the ones set at shell level (and not kernel.json). But this is perfect. I now just need to create few kernel.json files with different display names and env settings and end-user can select the kernel he/she wants to use. |
Yeah, the settings in |
Could we get some simple example in readme.md that could show where to locate and how to change the configuration file? |
Not sure what config you are looking for (and fully agree we need more doc), but this is what I use to add kernels with different JVM settings:
|
Hi !
I'm hitting the 8G memory limit and wanted to pass the
-Xmx
startup flag but couldn't find how to it. I believe it's useful to be able to customize how the JVM starts up.I'm not familiar with Jupyter's internals, but is this where the args should be passed ?
kotlin-jupyter/distrib/run_kotlin_kernel/run_kernel.py
Line 42 in 3e3ebaa
Or should we pass them somewhere else ?
Cheers !
PS : If you have any tips on how to change the memory limit, I'm still interested :)
The text was updated successfully, but these errors were encountered: