[jira] [Commented] (SPARK-26365) spark-submit for k8s cluster doesn't propagate exit code

2019-03-27 Thread Maxime Nannan (JIRA)


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

Maxime Nannan commented on SPARK-26365:
---

I had a similar problem and I've created a docker image if you want to 
reproduce it.

Docker image has been created with the following script
{code:java}
curl  
http://mirror.easyname.ch/apache/spark/spark-2.4.0/spark-2.4.0-bin-hadoop2.7.tgz
 | tar -xz
echo "raise RuntimeError()" > test.py
cp test.py spark-2.4.0-bin-hadoop2.7/python/lib
cd spark-2.4.0-bin-hadoop2.7
./bin/docker-image-tool.sh -t issue_exit_code -r mnannanph/spark build
./bin/docker-image-tool.sh -t issue_exit_code -r mnannanph/spark push{code}
The docker image is public on dockerhub 
[https://cloud.docker.com/repository/docker/mnannanph/spark-py] and can be 
pulled by running
{noformat}
docker pull mnannanph/spark-py:issue_exit_code{noformat}
 

 If you run the following command on a kubernetes cluster that can run spark on 
kubernetes

 
{code:java}
MASTER_URL= # Fill with your kubernetes master ip 

bin/spark-submit \
--master ${MASTER_URL} \
--deploy-mode cluster \
--conf spark.kubernetes.authenticate.driver.serviceAccountName=spark \
--name spark-test \
--conf spark.executor.instances=1 \
--conf spark.kubernetes.container.image=mnannanph/spark-py:issue_exit_code\
/opt/spark/python/lib/test.py{code}
 

You will obtain an exit code 0 whereas the spark-submit has failed. 
The script executed raises an error so the exit code should be 1.

test.py is just a one-line python script with this command 
{code:java}
raise RuntimeError()
{code}
Find below one part of driver pod logs:

 
{code:java}
2019-03-27 14:38:43 WARN  NativeCodeLoader:62 - Unable to load native-hadoop 
library for your platform... using builtin-java classes where applicable
Traceback (most recent call last):
  File "/opt/spark/python/lib/test.py", line 1, in 
    raise RuntimeError()
RuntimeError
2019-03-27 14:38:44 INFO  ShutdownHookManager:54 - Shutdown hook called
2019-03-27 14:38:44 INFO  ShutdownHookManager:54 - Deleting directory 
/tmp/spark-9d85097e-c848-4c29-8e67-a0d0c0cdeb71
{code}
Hope this will help.

 

 

> spark-submit for k8s cluster doesn't propagate exit code
> 
>
> Key: SPARK-26365
> URL: https://issues.apache.org/jira/browse/SPARK-26365
> Project: Spark
>  Issue Type: Bug
>  Components: Kubernetes, Spark Submit
>Affects Versions: 2.3.2, 2.4.0
>Reporter: Oscar Bonilla
>Priority: Minor
>
> When launching apps using spark-submit in a kubernetes cluster, if the Spark 
> applications fails (returns exit code = 1 for example), spark-submit will 
> still exit gracefully and return exit code = 0.
> This is problematic, since there's no way to know if there's been a problem 
> with the Spark application.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org



[jira] [Created] (SPARK-25978) Pyspark can only be used in spark-submit in spark-py docker image for kubernetes

2018-11-08 Thread Maxime Nannan (JIRA)
Maxime Nannan created SPARK-25978:
-

 Summary: Pyspark can only be used in spark-submit in spark-py 
docker image for kubernetes
 Key: SPARK-25978
 URL: https://issues.apache.org/jira/browse/SPARK-25978
 Project: Spark
  Issue Type: Bug
  Components: Kubernetes
Affects Versions: 2.4.0
Reporter: Maxime Nannan


Currently in spark-py docker image for kubernetes defined by the Dockerfile in 
resource-managers/kubernetes/docker/src/main/dockerfiles/spark/bindings/python/Dockerfile,
 the PYTHONPATH is defined as follows: 
{code:java}
ENV PYTHONPATH 
${SPARK_HOME}/python/lib/pyspark.zip:${SPARK_HOME}/python/lib/py4j-*.zip{code}
I think that the problem is that PYTHONPATH does not support wildcards so py4j 
cannot be imported with the default PYTHONPATH and pyspark cannot be imported 
too as it needs py4j.
This does not impact spark-submit of python files because py4j is dynamically 
added to PYTHONPATH when running python process in 
core/src/main/scala/org/apache/spark/deploy/PythonRunner.scala.

 

It's not really an issue as the main purpose of that docker image is to be run 
as driver or executors on k8s but it's worth mentionning this.

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org