Skip to content

Commit

Permalink
[SPARK-7711] Add a startTime property to match the corresponding one …
Browse files Browse the repository at this point in the history
…in Scala

Author: Holden Karau <[email protected]>

Closes apache#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
  • Loading branch information
holdenk authored and jeanlyn committed May 28, 2015
1 parent 63702e8 commit 5dd40d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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

0 comments on commit 5dd40d0

Please sign in to comment.