org.apache.spark.storage.RDDBlockId Scala Examples
The following examples show how to use org.apache.spark.storage.RDDBlockId.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: LocalRDDCheckpointData.scala From spark1.52 with Apache License 2.0 | 5 votes |
package org.apache.spark.rdd import scala.reflect.ClassTag import org.apache.spark.{Logging, SparkEnv, SparkException, TaskContext} import org.apache.spark.storage.{RDDBlockId, StorageLevel} import org.apache.spark.util.Utils def transformStorageLevel(level: StorageLevel): StorageLevel = { // If this RDD is to be cached off-heap, fail fast since we cannot provide any // correctness guarantees about subsequent computations after the first one //如果这个RDD要被堆栈缓存,那么快速失败,因为我们不能在第一个之后提供关于后续计算的任何正确性保证 if (level.useOffHeap) { throw new SparkException("Local checkpointing is not compatible with off-heap caching.") } StorageLevel(useDisk = true, level.useMemory, level.deserialized, level.replication) } }
Example 2
Source File: MemoryCheckpointRDD.scala From BigDatalog with Apache License 2.0 | 5 votes |
package org.apache.spark.rdd import org.apache.spark.storage.RDDBlockId import org.apache.spark.{Partition, SparkContext, SparkException, TaskContext} import scala.reflect.ClassTag // We use a different class than LocalCheckpointRDD, but the same functionality, // so that we easily identify (e..g, pattern match) this class in DAGScheduler. class MemoryCheckpointRDD[T: ClassTag](sc: SparkContext, rddId: Int, numPartitions: Int) extends LocalCheckpointRDD[T](sc, rddId, numPartitions) { def this(rdd: RDD[T]) { this(rdd.context, rdd.id, rdd.partitions.size) } override def compute(partition: Partition, context: TaskContext): Iterator[T] = { throw new SparkException( s"Checkpoint block ${RDDBlockId(rddId, partition.index)} not found! Either the executor " + s"that originally checkpointed this partition is no longer alive, or the original RDD is " + s"unpersisted. If this problem persists, you may consider using `rdd.checkpoint()` " + s"or `rdd.localcheckpoint()` instead, which are slower than memory checkpointing but more fault-tolerant.") } }