Repository: spark Updated Branches: refs/heads/branch-1.4 e597692ac -> c9a80fc40
[SPARK-7711] Add a startTime property to match the corresponding one in Scala Author: Holden Karau <hol...@pigscanfly.ca> 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 6b18cdc1b1284b1d48d637d06a1e64829aeb6202) Signed-off-by: Josh Rosen <joshro...@databricks.com> Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/c9a80fc4 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/c9a80fc4 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/c9a80fc4 Branch: refs/heads/branch-1.4 Commit: c9a80fc40951ea9190ef24ca4faf969e5f86bba7 Parents: e597692 Author: Holden Karau <hol...@pigscanfly.ca> Authored: Thu May 21 14:08:57 2015 -0700 Committer: Josh Rosen <joshro...@databricks.com> Committed: Thu May 21 14:09:09 2015 -0700 ---------------------------------------------------------------------- python/pyspark/context.py | 5 +++++ python/pyspark/tests.py | 4 ++++ 2 files changed, 9 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/c9a80fc4/python/pyspark/context.py ---------------------------------------------------------------------- diff --git a/python/pyspark/context.py b/python/pyspark/context.py index 1f2b40b..aeb7ad4 100644 --- a/python/pyspark/context.py +++ b/python/pyspark/context.py @@ -292,6 +292,11 @@ class SparkContext(object): 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): """ Default level of parallelism to use when not given by user (e.g. for http://git-wip-us.apache.org/repos/asf/spark/blob/c9a80fc4/python/pyspark/tests.py ---------------------------------------------------------------------- diff --git a/python/pyspark/tests.py b/python/pyspark/tests.py index d8e3199..f9fb37f 100644 --- a/python/pyspark/tests.py +++ b/python/pyspark/tests.py @@ -1809,6 +1809,10 @@ class ContextTests(unittest.TestCase): 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): --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org