-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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
[SPARK-6953] [PySpark] speed up python tests #5605
Conversation
[SPARK-6953] [PySpark] speed up python tests Signed-off-by: Reynold Xin <[email protected]> Conflicts: python/pyspark/streaming/tests.py (cherry picked from commit 21b15f5) Signed-off-by: Reynold Xin <[email protected]>
Note that this simply brings #5427 up to date. |
Test build #30651 has finished for PR 5605 at commit
|
@@ -303,7 +309,8 @@ def test_classification(self): | |||
self.assertEqual(same_dt_model.toDebugString(), dt_model.toDebugString()) | |||
|
|||
rf_model = RandomForest.trainClassifier( | |||
rdd, numClasses=2, categoricalFeaturesInfo=categoricalFeaturesInfo, numTrees=100) | |||
rdd, numClasses=2, categoricalFeaturesInfo=categoricalFeaturesInfo, numTrees=10, | |||
maxBins=4) | |||
self.assertTrue(rf_model.predict(features[0]) <= 0) |
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 line is failing now. is there some non-determinism? @mengxr
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.
There is, but you can pass "seed" If it's hard to find a good seed, I'd recommend setting featureSubsetStrategy = "all" as well (to eliminate a bit of stochasticity)
Sent you a PR at rxin#14. |
fix seed in tests
Test build #30704 has finished for PR 5605 at commit
|
Jenkins, retest this please. |
Test build #30708 has finished for PR 5605 at commit
|
I'm going to merge this. |
This PR try to speed up some python tests: ``` tests.py 144s -> 103s -41s mllib/classification.py 24s -> 17s -7s mllib/regression.py 27s -> 15s -12s mllib/tree.py 27s -> 13s -14s mllib/tests.py 64s -> 31s -33s streaming/tests.py 185s -> 84s -101s ``` Considering python3, the total saving will be 558s (almost 10 minutes) (core, and streaming run three times, mllib runs twice). During testing, it will show used time for each test file: ``` Run core tests ... Running test: pyspark/rdd.py ... ok (22s) Running test: pyspark/context.py ... ok (16s) Running test: pyspark/conf.py ... ok (4s) Running test: pyspark/broadcast.py ... ok (4s) Running test: pyspark/accumulators.py ... ok (4s) Running test: pyspark/serializers.py ... ok (6s) Running test: pyspark/profiler.py ... ok (5s) Running test: pyspark/shuffle.py ... ok (1s) Running test: pyspark/tests.py ... ok (103s) 144s ``` Author: Reynold Xin <[email protected]> Author: Xiangrui Meng <[email protected]> Closes apache#5605 from rxin/python-tests-speed and squashes the following commits: d08542d [Reynold Xin] Merge pull request apache#14 from mengxr/SPARK-6953 89321ee [Xiangrui Meng] fix seed in tests 3ad2387 [Reynold Xin] Merge pull request apache#5427 from davies/python_tests
This PR try to speed up some python tests:
Considering python3, the total saving will be 558s (almost 10 minutes) (core, and streaming run three times, mllib runs twice).
During testing, it will show used time for each test file: