attilapiros opened a new pull request #31561:
URL: https://github.com/apache/spark/pull/31561


   ### What changes were proposed in this pull request?
   
   This PR introduces a new protected method in `SparkFunSuite` which is only 
called when the test failed and can be used to collect logs for failed test. By 
this PR it is implemented in the Kubernetes tests by `KubernetesSuite` class 
where it collects all the POD logs and logs them out.
   
   This unfortunately cannot be realized with a simple "after" method as in the 
"after" method the test outcome is not available.
   
   Moreover this PR removes the `appLocator` as a method argument as 
`appLocator` is available as a member variable.  
    
   ### Why are the changes needed?
   
   Currently both the driver and executors logs are lost.
   
   In [developer-tools](https://spark.apache.org/developer-tools.html) there is 
a hint:
   "Getting logs from the pods and containers directly is an exercise left to 
the reader."
   
   But when the test is executed by Jenkins and a failure happened we really 
need the POD logs to analyze problem.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   By integration testing. I have checked what would happen if one test fails, 
tho output would be:
   
   ```
   21/02/13 16:26:09.660 ScalaTest-main-running-KubernetesSuite INFO 
KubernetesSuite:
   
   ===== EXTRA LOGS FOR THE FAILED TEST
   
   21/02/13 16:26:09.673 ScalaTest-main-running-KubernetesSuite INFO 
KubernetesSuite: BEGIN driver POD log
   2021-02-13T15:23:03.348358955Z ++ id -u
   2021-02-13T15:23:03.348398231Z + myuid=185
   2021-02-13T15:23:03.348596015Z ++ id -g
   2021-02-13T15:23:03.349697464Z + mygid=0
   2021-02-13T15:23:03.349722749Z + set +e
   2021-02-13T15:23:03.349984594Z ++ getent passwd 185
   2021-02-13T15:23:03.35164901Z + uidentry=
   2021-02-13T15:23:03.351675794Z + set -e
   2021-02-13T15:23:03.351692684Z + '[' -z '' ']'
   2021-02-13T15:23:03.351713972Z + '[' -w /etc/passwd ']'
   2021-02-13T15:23:03.351770938Z + echo '185:x:185:0:anonymous 
uid:/opt/spark:/bin/false'
   2021-02-13T15:23:03.352600148Z + SPARK_CLASSPATH=':/opt/spark/jars/*'
   2021-02-13T15:23:03.352620836Z + env
   2021-02-13T15:23:03.354708802Z + grep SPARK_JAVA_OPT_
   2021-02-13T15:23:03.354731089Z + sort -t_ -k4 -n
   2021-02-13T15:23:03.354748278Z + sed 's/[^=]*=\(.*\)/\1/g'
   2021-02-13T15:23:03.355860821Z + readarray -t SPARK_EXECUTOR_JAVA_OPTS
   2021-02-13T15:23:03.355880409Z + '[' -n '' ']'
   2021-02-13T15:23:03.355916588Z + '[' -z ']'
   2021-02-13T15:23:03.35593048Z + '[' -z ']'
   2021-02-13T15:23:03.356239297Z + '[' -n '' ']'
   2021-02-13T15:23:03.356272278Z + '[' -z ']'
   2021-02-13T15:23:03.356290467Z + '[' -z x ']'
   2021-02-13T15:23:03.356308156Z + 
SPARK_CLASSPATH='/opt/spark/conf::/opt/spark/jars/*'
   2021-02-13T15:23:03.356324647Z + case "$1" in
   2021-02-13T15:23:03.35633654Z + shift 1
   2021-02-13T15:23:03.356349532Z + CMD=("$SPARK_HOME/bin/spark-submit" --conf 
"spark.driver.bindAddress=$SPARK_DRIVER_BIND_ADDRESS" --deploy-mode client "$@")
   2021-02-13T15:23:03.356410496Z + exec /usr/bin/tini -s -- 
/opt/spark/bin/spark-submit --conf spark.driver.bindAddress=172.17.0.3 
--deploy-mode client --properties-file /opt/spark/conf/spark.properties --class 
org.apache.spark.deploy.PythonRunner local:///opt/spark/tests/decommissioning.py
   2021-02-13T15:23:05.335798009Z 21/02/13 15:23:05 WARN NativeCodeLoader: 
Unable to load native-hadoop library for your platform... using builtin-java 
classes where applicable
   2021-02-13T15:23:05.711753805Z Starting decom test
   2021-02-13T15:23:05.818989624Z Using Spark's default log4j profile: 
org/apache/spark/log4j-defaults.properties
   ...
   2021-02-13T15:23:51.314768043Z 21/02/13 15:23:51 INFO ShutdownHookManager: 
Deleting directory /tmp/spark-3b37a876-589e-4fb8-8fcf-fd65ccb18d28
   2021-02-13T15:23:51.317773827Z 21/02/13 15:23:51 INFO ShutdownHookManager: 
Deleting directory 
/var/data/spark-664f3741-0d19-419c-b8b6-dff44d2b8739/spark-51951298-8155-4c9d-a5d9-559260286853/pyspark-dd2e8730-01ce-4b73-8612-900ce742de8a
   
   21/02/13 16:26:09.674 ScalaTest-main-running-KubernetesSuite INFO 
KubernetesSuite: END driver POD log
   ```
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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

Reply via email to