sven-weber-db commented on code in PR #55716:
URL: https://github.com/apache/spark/pull/55716#discussion_r3210117970


##########
python/pyspark/taskcontext.py:
##########
@@ -161,7 +161,7 @@ def _getOrCreate(cls: Type["TaskContext"]) -> "TaskContext":
         return cls._taskContext
 
     @classmethod
-    def _setTaskContext(cls: Type["TaskContext"], taskContext: "TaskContext") 
-> None:
+    def _setTaskContext(cls: Type["TaskContext"], taskContext: 
Optional["TaskContext"]) -> None:

Review Comment:
   This change is required to make mypy happy due to the following call in 
`worker.py`:
   
   ```python
   # Cleanup
   # Reset task context to None. This is a guard code to avoid residual context 
when worker
   # reuse.
   TaskContext._setTaskContext(None)
   BarrierTaskContext._setTaskContext(None)
   ```
   
   It is unclear to my why this type check if failing only now since this code 
has been in `worker.py` for a long time.



##########
python/pyspark/taskcontext.py:
##########
@@ -161,7 +161,7 @@ def _getOrCreate(cls: Type["TaskContext"]) -> "TaskContext":
         return cls._taskContext
 
     @classmethod
-    def _setTaskContext(cls: Type["TaskContext"], taskContext: "TaskContext") 
-> None:
+    def _setTaskContext(cls: Type["TaskContext"], taskContext: 
Optional["TaskContext"]) -> None:

Review Comment:
   This change is required to make `mypy` happy due to the following call in 
`worker.py`:
   
   ```python
   # Cleanup
   # Reset task context to None. This is a guard code to avoid residual context 
when worker
   # reuse.
   TaskContext._setTaskContext(None)
   BarrierTaskContext._setTaskContext(None)
   ```
   
   It is unclear to my why this type check if failing only now since this code 
has been in `worker.py` for a long time.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to