Skip to content

Commit

Permalink
Feature flag this new behavior
Browse files Browse the repository at this point in the history
... in case anything breaks, we should be able to resort to old
behavior.
  • Loading branch information
Andrew Or committed Apr 24, 2015
1 parent 86f7823 commit 2390a60
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion core/src/main/scala/org/apache/spark/SparkContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,8 @@ class SparkContext(config: SparkConf) extends Logging with ExecutorAllocationCli
* serializable
*/
private[spark] def clean[F <: AnyRef](f: F, checkSerializable: Boolean = true): F = {
ClosureCleaner.clean(f, checkSerializable)
val cleanTransitively = conf.getBoolean("spark.closureCleaner.transitive", true)
ClosureCleaner.clean(f, checkSerializable, cleanTransitively)
f
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ClosureCleanerSuite extends FunSuite {
val obj = new TestClassWithNesting(1)
assert(obj.run() === 96) // 4 * (1+2+3+4) + 4 * (1+2+3+4) + 16 * 1
}

test("toplevel return statements in closures are identified at cleaning time") {
val ex = intercept[SparkException] {
TestObjectWithBogusReturns.run()
Expand Down

0 comments on commit 2390a60

Please sign in to comment.