HyukjinKwon commented on a change in pull request #24898: [SPARK-22340][PYTHON]
Add a mode to pin Python thread into JVM's
URL: https://github.com/apache/spark/pull/24898#discussion_r338088003
##########
File path: python/pyspark/ml/tests/test_wrapper.py
##########
@@ -50,19 +51,27 @@ def test_java_object_gets_detached(self):
model.__del__()
- with self.assertRaisesRegexp(py4j.protocol.Py4JError, error_no_object):
- model._java_obj.toString()
- self.assertIn("LinearRegressionTrainingSummary",
summary._java_obj.toString())
+ def condition():
+ with self.assertRaisesRegexp(py4j.protocol.Py4JError,
error_no_object):
+ model._java_obj.toString()
+ self.assertIn("LinearRegressionTrainingSummary",
summary._java_obj.toString())
+ return True
+
+ eventually(condition, timeout=10, catch_assertions=True)
try:
summary.__del__()
except:
pass
- with self.assertRaisesRegexp(py4j.protocol.Py4JError, error_no_object):
- model._java_obj.toString()
- with self.assertRaisesRegexp(py4j.protocol.Py4JError, error_no_object):
- summary._java_obj.toString()
+ def condition():
+ with self.assertRaisesRegexp(py4j.protocol.Py4JError,
error_no_object):
+ model._java_obj.toString()
+ with self.assertRaisesRegexp(py4j.protocol.Py4JError,
error_no_object):
+ summary._java_obj.toString()
+ return True
+
+ eventually(condition, timeout=10, catch_assertions=True)
Review comment:
Yeah, I just needed to wait a bit until it detaches. I don't know the root
cause but I guess it's fine since at least it's not the leak case.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]