Skip to content

Commit c9a80fc

Browse files
holdenkJoshRosen
authored andcommitted
[SPARK-7711] Add a startTime property to match the corresponding one in Scala
Author: Holden Karau <[email protected]> Closes #6275 from holdenk/SPARK-771-startTime-is-missing-from-pyspark and squashes the following commits: 06662dc [Holden Karau] add mising blank line for style checks 7a87410 [Holden Karau] add back missing newline 7a7876b [Holden Karau] Add a startTime property to match the corresponding one in the Scala SparkContext (cherry picked from commit 6b18cdc) Signed-off-by: Josh Rosen <[email protected]>
1 parent e597692 commit c9a80fc

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

python/pyspark/context.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,11 @@ def version(self):
291291
"""
292292
return self._jsc.version()
293293

294+
@property
295+
def startTime(self):
296+
"""Return the epoch time when the Spark Context was started."""
297+
return self._jsc.startTime()
298+
294299
@property
295300
def defaultParallelism(self):
296301
"""

python/pyspark/tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,6 +1809,10 @@ def run():
18091809

18101810
sc.stop()
18111811

1812+
def test_startTime(self):
1813+
with SparkContext() as sc:
1814+
self.assertGreater(sc.startTime, 0)
1815+
18121816

18131817
@unittest.skipIf(not _have_scipy, "SciPy not installed")
18141818
class SciPyTests(PySparkTestCase):

0 commit comments

Comments
 (0)