zero323 commented on a change in pull request #34892:
URL: https://github.com/apache/spark/pull/34892#discussion_r770731044
##########
File path: python/pyspark/util.py
##########
@@ -326,16 +326,14 @@ def inheritable_thread_target(f: Callable) -> Callable:
# NOTICE the internal difference vs `InheritableThread`.
`InheritableThread`
# copies local properties when the thread starts but
`inheritable_thread_target`
# copies when the function is wrapped.
- properties = (
- SparkContext._active_spark_context._jsc.sc() # type:
ignore[attr-defined]
- .getLocalProperties()
- .clone()
- )
+ assert SparkContext._active_spark_context is not None
+ properties =
SparkContext._active_spark_context._jsc.sc().getLocalProperties().clone()
@functools.wraps(f)
def wrapped(*args: Any, **kwargs: Any) -> Any:
try:
# Set local properties in child thread.
+ assert SparkContext._active_spark_context is not None
SparkContext._active_spark_context._jsc.sc().setLocalProperties( # type:
ignore[attr-defined]
Review comment:
Also, this one.
--
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]