Github user rgbkrk commented on a diff in the pull request:
https://github.com/apache/spark/pull/17662#discussion_r111833037
--- Diff: python/pyspark/context.py ---
@@ -240,6 +240,26 @@ def signal_handler(signal, frame):
if isinstance(threading.current_thread(), threading._MainThread):
signal.signal(signal.SIGINT, signal_handler)
+ def __repr__(self):
+ return "<SparkContext master={master} appName={appName}>".format(
+ master=self.master,
+ appName=self.appName
+ )
+
+ 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>
+ </div>
+ """.format(
+ spark_version=self.version,
+ spark_ui_url=self.uiWebUrl,
--- End diff --
You're allowed to have trailing commas in Python. It's purely aesthetic --
the primary benefit is for the next coder. Every line has the same format and
adding entries to the end is the same as adding them to the middle.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]