ConeyLiu commented on a change in pull request #26239: [SPARK-29582][PYSPARK] 
Unify the behavior of pyspark.TaskContext with spark core
URL: https://github.com/apache/spark/pull/26239#discussion_r339888940
 
 

 ##########
 File path: python/pyspark/taskcontext.py
 ##########
 @@ -162,7 +166,10 @@ def get(cls):
         running tasks.
 
         .. note:: Must be called on the worker, not the driver. Returns None 
if not initialized.
+            A RuntimeError will raise if it's not in a barrier stage.
         """
+        if not isinstance(cls._taskContext, BarrierTaskContext):
+            raise RuntimeError('''It's not in a barrier stage''')
 
 Review comment:
   updated

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to