Created 09-18-2021 08:43 AM
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 operator import add
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:
Failed to get auth cookie contents data = {"cookies":[],"err":"http: named cookie not present","user":"cdsw"}
pyspark code just runs without finishing, please help
Created 09-20-2021 06:01 AM
@wbivp Is the TLS enabled? Can you try after disabling TLS.
Created 09-20-2021 06:51 AM
hi @GangWar
Disable TLS from CDP ? i'm using AutoTLS for CDP Cluster only , CDSW not enable TLS
Created on 09-20-2021 07:06 AM - edited 09-20-2021 07:09 AM