[ 
https://issues.apache.org/jira/browse/SPARK-52687?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated SPARK-52687:
-----------------------------------
    Labels: pull-request-available  (was: )

> pyspark startup script: Parsing of SPARK_CONNECT_MODE is error prone
> --------------------------------------------------------------------
>
>                 Key: SPARK-52687
>                 URL: https://issues.apache.org/jira/browse/SPARK-52687
>             Project: Spark
>          Issue Type: Bug
>          Components: PySpark
>    Affects Versions: 4.0.0
>            Reporter: Mario Grgic
>            Priority: Minor
>              Labels: pull-request-available
>
> I am using Apache Spark 4.0.0 and don't have {{SPARK_CONNECT_MODE}} 
> environment variable set. When launching {{pyspark}} a message:
> ??The environment variable SPARK_CONNECT_MODE has unknown value or 
> pyspark.util package is not available: 0??
> is always shown. Even after exporting the value for this environment 
> variable, the message is still shown with the value of the variable instead 
> of 0.
> Looking at the pyspark BASH script it looks like the value of the environment 
> variable is calculated:
>  
> {{export SPARK_CONNECT_MODE=$($PYSPARK_DRIVER_PYTHON -c "from pyspark.util 
> import spark_connect_mode; print(spark_connect_mode())")}}
>  
> which can (at least on my system) can contain newline and spaces (if the 
> environment variable is not set). This is why the check below:
>  
> {{if [[ "$SPARK_CONNECT_MODE" != "0" && "$SPARK_CONNECT_MODE" != "1" ]]; 
> then}}
> {{  echo "The environment variable SPARK_CONNECT_MODE has unknown value or 
> pyspark.util package is not available: $SPARK_CONNECT_MODE"}}
> {{  unset SPARK_CONNECT_MODE}}
> {{fi}}
> fails. Note however, that this check will fail *always* even if 
> {{SPARK_CONNECT_MODE}} is set to any value other than 0 or 1. So basically, 
> the script will not accept valid values for this variable and will unset the 
> value.
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to