[ 
https://issues.apache.org/jira/browse/SPARK-7736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14618110#comment-14618110
 ] 

Esben S. Nielsen commented on SPARK-7736:
-----------------------------------------

Platform: spark 1.3.0, CDH 5.4.1

To reproduce with pyspark:

---
from pyspark import SparkContext
with SparkContext(appName="raise_uncaught") as sc:
    raise Exception('Fail')
---
$ spark-submit --master yarn-cluster /path/to/my/pythonscript.py

This ends up with the following YARN status:
State:  FINISHED
FinalStatus:    SUCCEEDED
Diagnostics:    Shutdown hook called before final status was reported.

If the exception is thrown before the SparkContext is initialized YARN status 
displays as expected:
---
from pyspark import SparkContext
raise Exception('Fail')
with SparkContext(appName="raise_caught") as sc:
    pass
---

This ends up with the following YARN status:
State:  FAILED
FinalStatus:    FAILED
Diagnostics: <trace>

It seems (from the Diagnostics message) that  
https://github.com/apache/spark/blob/19834fa9184f0365a160bcb54bcd33eaa87c70dc/yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala
 : L118 is hit when exceptions are raised after initializing SparkContext. This 
also means applications are not retried when failures happen after SparkContext 
initialization.


> Exception not failing Python applications (in yarn cluster mode)
> ----------------------------------------------------------------
>
>                 Key: SPARK-7736
>                 URL: https://issues.apache.org/jira/browse/SPARK-7736
>             Project: Spark
>          Issue Type: Bug
>          Components: YARN
>         Environment: Spark 1.3.1, Yarn 2.7.0, Ubuntu 14.04
>            Reporter: Shay Rojansky
>
> It seems that exceptions thrown in Python spark apps after the SparkContext 
> is instantiated don't cause the application to fail, at least in Yarn: the 
> application is marked as SUCCEEDED.
> Note that any exception right before the SparkContext correctly places the 
> application in FAILED state.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to