Skip to content

Commit

Permalink
Allowing println in audit-release examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jonalter committed Jun 30, 2015
1 parent 5b50da1 commit 5c8e283
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions dev/audit-release/sbt_app_core/src/main/scala/SparkApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/

// scalastyle:off println
package main.scala

import scala.util.Try
Expand All @@ -34,7 +35,6 @@ object SimpleApp {
val logData = sc.textFile(logFile, 2).cache()
val numAs = logData.filter(line => line.contains("a")).count()
val numBs = logData.filter(line => line.contains("b")).count()
// scalastyle:off println
if (numAs != 2 || numBs != 2) {
println("Failed to parse log files with Spark")
System.exit(-1)
Expand All @@ -58,6 +58,6 @@ object SimpleApp {
println("Kinesis was loaded via spark-core")
System.exit(-1)
}
// scalastyle:on println
}
}
// scalastyle:on println
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/

// scalastyle:off println
package main.scala

import scala.util.Try
Expand All @@ -27,7 +28,6 @@ object SimpleApp {
// Regression test for SPARK-1167: Remove metrics-ganglia from default build due to LGPL issue
val foundConsole = Try(Class.forName("org.apache.spark.metrics.sink.ConsoleSink")).isSuccess
val foundGanglia = Try(Class.forName("org.apache.spark.metrics.sink.GangliaSink")).isSuccess
// scalastyle:off println
if (!foundConsole) {
println("Console sink not loaded via spark-core")
System.exit(-1)
Expand All @@ -36,6 +36,6 @@ object SimpleApp {
println("Ganglia sink not loaded via spark-ganglia-lgpl")
System.exit(-1)
}
// scalastyle:on println
}
}
// scalastyle:on println
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/

// scalastyle:off println
package main.scala

import org.apache.spark.{SparkContext, SparkConf}
Expand Down Expand Up @@ -44,12 +45,11 @@ object GraphXApp {
// Notice that there is a user 0 (for which we have no information) connected to users
// 4 (peter) and 5 (franklin).
val triplets = graph.triplets.map(e => (e.srcAttr._1, e.dstAttr._1)).collect
// scalastyle:off println
if (!triplets.exists(_ == ("peter", "John Doe"))) {
println("Failed to run GraphX")
System.exit(-1)
}
println("Test succeeded")
// scalastyle:on println
}
}
// scalastyle:on println
4 changes: 2 additions & 2 deletions dev/audit-release/sbt_app_hive/src/main/scala/HiveApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/

// scalastyle:off println
package main.scala

import scala.collection.mutable.{ListBuffer, Queue}
Expand All @@ -41,7 +42,6 @@ object SparkSqlExample {
sql("CREATE TABLE IF NOT EXISTS src (key INT, value STRING)")
sql("LOAD DATA LOCAL INPATH 'data.txt' INTO TABLE src")
val results = sql("FROM src SELECT key, value WHERE key >= 0 AND KEY < 5").collect()
// scalastyle:off println
results.foreach(println)

def test(f: => Boolean, failureMsg: String) = {
Expand All @@ -53,7 +53,7 @@ object SparkSqlExample {

test(results.size == 5, "Unexpected number of selected elements: " + results)
println("Test succeeded")
// scalastyle:on println
sc.stop()
}
}
// scalastyle:on println
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/

// scalastyle:off println
package main.scala

import scala.util.Try
Expand All @@ -26,10 +27,9 @@ object SimpleApp {
def main(args: Array[String]) {
val foundKinesis = Try(Class.forName("org.apache.spark.streaming.kinesis.KinesisUtils")).isSuccess
if (!foundKinesis) {
// scalastyle:off println
println("Kinesis not loaded via kinesis-asl")
// scalastyle:on println
System.exit(-1)
}
}
}
// scalastyle:on println
4 changes: 2 additions & 2 deletions dev/audit-release/sbt_app_sql/src/main/scala/SqlApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/

// scalastyle:off println
package main.scala

import scala.collection.mutable.{ListBuffer, Queue}
Expand Down Expand Up @@ -43,7 +44,6 @@ object SparkSqlExample {
people.registerTempTable("people")
val teenagers = sql("SELECT name FROM people WHERE age >= 13 AND age <= 19")
val teenagerNames = teenagers.map(t => "Name: " + t(0)).collect()
// scalastyle:off println
teenagerNames.foreach(println)

def test(f: => Boolean, failureMsg: String) = {
Expand All @@ -55,7 +55,7 @@ object SparkSqlExample {

test(teenagerNames.size == 7, "Unexpected number of selected elements: " + teenagerNames)
println("Test succeeded")
// scalastyle:on println
sc.stop()
}
}
// scalastyle:on println
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/

// scalastyle:off println
package main.scala

import scala.collection.mutable.{ListBuffer, Queue}
Expand Down Expand Up @@ -45,7 +46,6 @@ object SparkStreamingExample {
ssc.start()
Thread.sleep(5000)

// scalastyle:off println
def test(f: => Boolean, failureMsg: String) = {
if (!f) {
println(failureMsg)
Expand All @@ -58,8 +58,8 @@ object SparkStreamingExample {
test(rddCounts.toSet == Set(100, 1000, 10000), "Did not find expected streams")

println("Test succeeded")
// scalastyle:on println

ssc.stop()
}
}
// scalastyle:on println

0 comments on commit 5c8e283

Please sign in to comment.