aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorHolden Karau <holden@us.ibm.com>2016-12-20 15:51:21 -0800
committerReynold Xin <rxin@databricks.com>2016-12-20 15:51:21 -0800
commit047a9d92caa1f0af2305e4afeba8339abf32518b (patch)
treeae8588410abee1171dc0cf18ffcbd71a99f62399 /core
parentcaed89321fdabe83e46451ca4e968f86481ad500 (diff)
downloadspark-047a9d92caa1f0af2305e4afeba8339abf32518b.tar.gz
spark-047a9d92caa1f0af2305e4afeba8339abf32518b.tar.bz2
spark-047a9d92caa1f0af2305e4afeba8339abf32518b.zip
[SPARK-18576][PYTHON] Add basic TaskContext information to PySpark
## What changes were proposed in this pull request? Adds basic TaskContext information to PySpark. ## How was this patch tested? New unit tests to `tests.py` & existing unit tests. Author: Holden Karau <holden@us.ibm.com> Closes #16211 from holdenk/SPARK-18576-pyspark-taskcontext.
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala b/core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala
index 0ca91b9bf8..04ae97ed3c 100644
--- a/core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala
+++ b/core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala
@@ -275,6 +275,11 @@ private[spark] class PythonRunner(
dataOut.writeInt(partitionIndex)
// Python version of driver
PythonRDD.writeUTF(pythonVer, dataOut)
+ // Write out the TaskContextInfo
+ dataOut.writeInt(context.stageId())
+ dataOut.writeInt(context.partitionId())
+ dataOut.writeInt(context.attemptNumber())
+ dataOut.writeLong(context.taskAttemptId())
// sparkFilesDir
PythonRDD.writeUTF(SparkFiles.getRootDirectory(), dataOut)
// Python includes (*.zip and *.egg files)