Skip to content

Commit

Permalink
[SPARK-20360][PYTHON] Cleaner SparkContext HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
rgbkrk committed Apr 18, 2017
1 parent 1c60087 commit a2acd97
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
20 changes: 13 additions & 7 deletions python/pyspark/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,21 @@ def __repr__(self):
def _repr_html_(self):
return """
<div>
<p><b>Spark Context</b></p>
<ul>
<li>Spark <code>v{spark_version}</code></li>
<li><a href="{spark_ui_url}">Spark UI</a></li>
</ul>
<p><b>SparkContext</b></p>
<p><a href="{sc.uiWebUrl}">Spark UI</a></p>
<dl>
<dt>Version</dt>
<dd><code>v{sc.version}</code></dd>
<dt>Master</dt>
<dd><code>{sc.master}</code></dd>
<dt>AppName</dt>
<dd><code>{sc.appName}</code></dd>
</dl>
</div>
""".format(
spark_version=self.version,
spark_ui_url=self.uiWebUrl,
sc=self
)

def _initialize_context(self, jconf):
Expand Down
3 changes: 3 additions & 0 deletions python/pyspark/sql/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ def __init__(self, sparkContext, jsparkSession=None):
or SparkSession._instantiatedSession._sc._jsc is None:
SparkSession._instantiatedSession = self

def _repr_html_(self):
return self.sparkContext._repr_html_()

@since(2.0)
def newSession(self):
"""
Expand Down

0 comments on commit a2acd97

Please sign in to comment.