Capture BuildInfo when available
Author: Michael Armbrust <michael@databricks.com> Closes #45 from marmbrus/buildInfo.
This commit is contained in:
parent
4ba3802f95
commit
9269f8f594
@ -16,14 +16,14 @@
|
||||
|
||||
package com.databricks.spark.sql.perf
|
||||
|
||||
import org.apache.spark.rdd.RDD
|
||||
|
||||
import scala.collection.mutable
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
import scala.concurrent._
|
||||
import scala.concurrent.duration._
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.util.Try
|
||||
|
||||
import org.apache.spark.rdd.RDD
|
||||
import org.apache.spark.sql.{Dataset, AnalysisException, DataFrame, SQLContext}
|
||||
import org.apache.spark.sql.catalyst.analysis.UnresolvedRelation
|
||||
import org.apache.spark.sql.execution.SparkPlan
|
||||
@ -54,10 +54,19 @@ abstract class Benchmark(
|
||||
|
||||
protected implicit def toOption[A](a: A) = Option(a)
|
||||
|
||||
val buildInfo = Try(getClass.getClassLoader.loadClass("org.apache.spark.BuildInfo")).map { cls =>
|
||||
cls.getMethods
|
||||
.filter(_.getReturnType == classOf[String])
|
||||
.filterNot(_.getName == "toString")
|
||||
.map(m => m.getName -> m.invoke(cls).asInstanceOf[String])
|
||||
.toMap
|
||||
}.getOrElse(Map.empty)
|
||||
|
||||
def currentConfiguration = BenchmarkConfiguration(
|
||||
sqlConf = sqlContext.getAllConfs,
|
||||
sparkConf = sparkContext.getConf.getAll.toMap,
|
||||
defaultParallelism = sparkContext.defaultParallelism)
|
||||
defaultParallelism = sparkContext.defaultParallelism,
|
||||
buildInfo = buildInfo)
|
||||
|
||||
/**
|
||||
* A Variation represents a setting (e.g. the number of shuffle partitions or if tables
|
||||
|
||||
@ -43,7 +43,8 @@ case class BenchmarkConfiguration(
|
||||
sparkVersion: String = org.apache.spark.SPARK_VERSION,
|
||||
sqlConf: Map[String, String],
|
||||
sparkConf: Map[String, String],
|
||||
defaultParallelism: Int)
|
||||
defaultParallelism: Int,
|
||||
buildInfo: Map[String, String])
|
||||
|
||||
/**
|
||||
* The result of a query.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user