Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions python/pyspark/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,11 @@ def version(self):
"""
return self._jsc.version()

@property
def startTime(self):
"""Return the epoch time when the Spark Context was started."""
return self._jsc.startTime()

@property
def defaultParallelism(self):
"""
Expand Down
4 changes: 4 additions & 0 deletions python/pyspark/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1809,6 +1809,10 @@ def run():

sc.stop()

def test_startTime(self):
with SparkContext() as sc:
self.assertGreater(sc.startTime, 0)


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