-
-
Notifications
You must be signed in to change notification settings - Fork 299
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
feat: Use jpype instead of subprocess #356
Conversation
@@ -22,4 +22,6 @@ def lint(session): | |||
@nox.session | |||
def tests(session): | |||
session.install(".[test]") | |||
session.run("pytest", "-v") | |||
session.run("pytest", "-v", "tests/test_read_pdf_table.py") | |||
session.run("pytest", "-v", "tests/test_read_pdf_jar_path.py") |
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.
This is due to jpype limitation that doesn not allow shutdown JVM. Hence, we need to make separate session run for JVM option testing.
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.
This is due to jpype limitation that doesn not allow shutdown JVM
how about jpype.shutdownJVM()
?
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.
According to the document, we have to reboot Python to relaunch JVM.
https://jpype.readthedocs.io/en/latest/api.html#jpype.shutdownJVM
Due to limitations in the JPype, it is not possible to restart the JVM after being terminated.
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.
Ah, I see.
The comparison of test running time is roughly 2.7 times faster than subprocess. master branch: $ Measure-Command { pytest .\tests\test_read_pdf_table.py }
Days : 0
Hours : 0
Minutes : 0
Seconds : 32
Milliseconds : 298
Ticks : 322984726
TotalDays : 0.000373824914351852
TotalHours : 0.00897179794444444
TotalMinutes : 0.538307876666667
TotalSeconds : 32.2984726
TotalMilliseconds : 32298.4726 This PR: Measure-Command { pytest .\tests\test_read_pdf_table.py; pytest .\tests\test_read_pdf_jar_path.py ; pytest .\tests\test_read_pdf_silent.py }
Days : 0
Hours : 0
Minutes : 0
Seconds : 12
Milliseconds : 47
Ticks : 120479953
TotalDays : 0.000139444390046296
TotalHours : 0.00334666536111111
TotalMinutes : 0.200799921666667
TotalSeconds : 12.0479953
TotalMilliseconds : 12047.9953 |
Description
Close #352
Successor of #355
Motivation and Context
To reduce JVM launch overhead for each execution.
How Has This Been Tested?
Unit test.
Screenshots (if appropriate):
Types of changes
Checklist: