title: How to checkpoint RDD
body: <p>Spark 2.4.0</p>
  
  <hr>
  
  <pre><code>rdd = rdd.cache()
  print(rdd.getStorageLevel())
  </code></pre>
  
  <blockquote>
    <p>Memory Serialized 1x Replicated</p>
  </blockquote>
  
  <pre><code>sc.setCheckpointDir("/tmp/checkpoints")
  rdd.checkpoint()
  </code></pre>
  
  <p><strong>Action on rdd</strong></p>
  
  <pre><code>rdd.count()
  </code></pre>
  
  <blockquote>
    <p>25066</p>
  </blockquote>
  
  <p><strong>Check if checkpointed:</strong></p>
  
  <pre><code>rdd.isCheckpointed()
  </code></pre>
  
  <blockquote>
    <p>False</p>
  </blockquote>
  
  <pre><code>print(rdd.getCheckpointFile())
  </code></pre>
  
  <blockquote>
    <p>False</p>
  </blockquote>