Support Questions

# CDSW 1.9.2 Private Failed to get auth cookie contents

Explorer

Hi All,

I try to running pyspark example code from CDSW template

our environment : CDSW 1.9.2 ,CDP Private Cloud Base 7.1.6

pi.py

# # Estimating $\pi$
#
# This is the simplest PySpark example. It shows how to estimate $\pi$ in parallel
# using Monte Carlo integration. If you're new to PySpark, start here!

from __future__ import print_function
import sys
from random import random
from pyspark.sql import SparkSession

spark = SparkSession\
.builder\
.appName("PythonPi")\
.getOrCreate()

partitions = int(sys.argv[1]) if len(sys.argv) > 1 else 2
n = 100000 * partitions

def f(_):
x = random() * 2 - 1
y = random() * 2 - 1
return 1 if x ** 2 + y ** 2 < 1 else 0

count = spark.sparkContext.parallelize(range(1, n + 1), partitions).map(f).reduce(add)
print("Pi is roughly %f" % (4.0 * count / n))

spark.stop()

and we got this message from session logs:

3 REPLIES 3
Guru

@wbivp Is the TLS enabled? Can you try after disabling TLS.

Cheers!
If you find a reply useful, say thanks by clicking on the thumbs up button.
Explorer

hi @GangWar

Disable TLS from  CDP ? i'm using AutoTLS for CDP Cluster only , CDSW not enable TLS

Guru
That fine. can you try below? sparkSession.builder() <--------------should work? then .config( config prop) .appName().getOrCreate() Also most important thing this could be a red herring you have to see if the session is running and you job succeed. We have seen this issue in past seems.

Cheers!