Spark Job keeps failing by the running the same map 3 times
<p>My job has a step where I am converting the data frame as RDD[(key, value)] but the step runs three 3 times and getting stuck in the third time and fails</p>

<p>Spark UI shows : </p>

<p>Active Jobs(1)</p>

<pre><code>  Job Id (Job Group)      Description    Submitted  Duration    Stages: Succeeded/Total Tasks (for all stages): Succeeded/Total

    3 (zeppelin-20161017-005442_839671900)   Zeppelin map at &lt;console&gt;:69      2016/10/25 05:50:02  1.6 min     0/1      210/45623
</code></pre>

<p>Completed Jobs (2)</p>

<pre><code>  2 (zeppelin-20161017-005442_839671900)    Zeppelin map at &lt;console&gt;:69    2016/10/25 05:16:28     23 min  1/1       46742/46075 (21 failed)
  1 (zeppelin-20161017-005442_839671900)    Zeppelin map at &lt;console&gt;:69    2016/10/25 04:47:58     17 min  1/1        47369/46795 (20 failed) 
</code></pre>

<p>This is the code :</p>

<pre><code> val eventsRDD = eventsDF.map {

      r =&gt;
        val customerId = r.getAs[String]("customerId")
        val itemId = r.getAs[String]("itemId")
        val countryId = r.getAs[Long]("countryId").toInt
        val timeStamp = r.getAs[String]("eventTimestamp")

        val totalRent = r.getAs[Int]("totalRent")
        val totalPurchase = r.getAs[Int]("totalPurchase")
        val totalProfit = r.getAs[Int]("totalProfit")

        val store = r.getAs[String]("store")
        val itemName = r.getAs[String]("itemName")

        val itemName = if (itemName.size &gt; 0 &amp;&amp; itemName.nonEmpty &amp;&amp; itemName != null ) itemName else "NA"


        (itemId, (customerId, countryId, timeStamp, totalRent, totalProfit, totalPurchase, store,itemName ))



    }
</code></pre>

<p>Can someone tell what is wrong here ? If I want persist/cache which one I should do ? </p>

<p>Error :</p>

<pre><code>16/10/25 23:28:55 INFO YarnClientSchedulerBackend: Asked to remove non-existent executor 181
16/10/25 23:28:55 WARN YarnSchedulerBackend$YarnSchedulerEndpoint: Container marked as failed: container_1477415847345_0005_02_031011 on host: ip-172-31-14-104.ec2.internal. Exit status: 52. Diagnostics: Exception from container-launch.
Container id: container_1477415847345_0005_02_031011
Exit code: 52
Stack trace: ExitCodeException exitCode=52:
                at org.apache.hadoop.util.Shell.runCommand(Shell.java:545)
                at org.apache.hadoop.util.Shell.run(Shell.java:456)
                at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:722)
                at org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:211)
                at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:302)
                at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:82)
                at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
                at java.lang.Thread.run(Thread.java:745)
</code></pre>