Run mllib small in unit tests (#141)

* Add mllib unit test to run mllib-small.yaml.

* Check results in unit tests and fail tests if failures are present.

* Rename to be MLLibSuite instead of MLLibTest.

* Better error message on failed benchmarks.
This commit is contained in:
Bago Amirbekian 2018-05-09 16:24:30 -07:00 committed by Xiangrui Meng
parent 9ece11ff20
commit 15d9283473

View File

@ -0,0 +1,23 @@
package com.databricks.spark.sql.perf.mllib
import org.scalatest.FunSuite
import org.apache.spark.sql.Row
class MLLibTest extends FunSuite {
test("test MlLib benchmarks with mllib-small.yaml.") {
val results = MLLib.run(yamlConfig = MLLib.smallConfig)
val failures = results.na.drop(Seq("failure"))
if (failures.count() > 0) {
failures.select("name", "failure.*").collect().foreach {
case Row(name: String, error: String, message: String) =>
println(
s"""There as a failure in the benchmark for $name:
| $error ${message.replace("\n", "\n ")}
""".stripMargin)
}
fail("Unable to run all benchmarks successfully, see console output for more info.")
}
}
}