Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to find out which port the Spark web UI is using?

I start my Spark session in Jupyter with something like this:

from pyspark.sql import SparkSession

spark = ( SparkSession
            .builder
            .appName('analysis')
            .getOrCreate() )

Is there a way to find out which port the web UI is using? Thanks!

like image 303
ceiling cat Avatar asked Oct 15 '25 06:10

ceiling cat


2 Answers

You can use uiWebUrl property:

>>> spark.sparkContext.uiWebUrl
'http://some_host:4040'

and for example split

>>> spark.sparkContext.uiWebUrl.split(":")[-1]
'4040'
like image 59
Alper t. Turker Avatar answered Oct 17 '25 20:10

Alper t. Turker


This is how I figured it out in pyspark.

>>> import pyspark
>>> sc = pyspark.SparkContext(appName="some_app")
>>> sc.uiWebUrl

[1]: http://localhost:4041/jobs/
like image 31
Kalanos Avatar answered Oct 17 '25 21:10

Kalanos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!