Skip to content

Commit 19bc07b

Browse files
author
Andrew Or
committed
Treat checkpoint as an RDD operation
1 parent f496bf3 commit 19bc07b

File tree

1 file changed

+11
-1
lines changed
  • core/src/main/scala/org/apache/spark/rdd

1 file changed

+11
-1
lines changed

core/src/main/scala/org/apache/spark/rdd/RDD.scala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,16 @@ abstract class RDD[T: ClassTag](
285285
*/
286286
private[spark] def withScope[U](body: => U): U = RDDOperationScope.withScope[U](sc)(body)
287287

288+
/**
289+
* Execute a block of code in a scope such that all new RDDs created in this body will
290+
* be part of the same scope. For more detail, see {{org.apache.spark.rdd.RDDOperationScope}}.
291+
*
292+
* Note: Return statements are NOT allowed in the given body.
293+
*/
294+
private[spark] def withNamedScope[U](scopeName: String)(body: => U): U = {
295+
RDDOperationScope.withScope[U](sc)(body)
296+
}
297+
288298
// Transformations (return a new RDD)
289299

290300
/**
@@ -1512,7 +1522,7 @@ abstract class RDD[T: ClassTag](
15121522
* has completed (therefore the RDD has been materialized and potentially stored in memory).
15131523
* doCheckpoint() is called recursively on the parent RDDs.
15141524
*/
1515-
private[spark] def doCheckpoint() {
1525+
private[spark] def doCheckpoint(): Unit = withNamedScope("checkpoint") {
15161526
if (!doCheckpointCalled) {
15171527
doCheckpointCalled = true
15181528
if (checkpointData.isDefined) {

0 commit comments

Comments
 (0)