pyspark.InheritableThread#

class pyspark.InheritableThread(target, *args, session=None, **kwargs)[source]#

Thread that is recommended to be used in PySpark when the pinned thread mode is enabled. The wrapper function, before calling original thread target, it inherits the inheritable properties specific to JVM thread such as InheritableThreadLocal, or thread local such as tags with Spark Connect.

When the pinned thread mode is off, this works as threading.Thread.

New in version 3.1.0.

Changed in version 3.5.0: Supports Spark Connect.

Notes

This API is experimental.

Methods

getName()

isDaemon()

is_alive()

Return whether the thread is alive.

join([timeout])

Wait until the thread terminates.

run()

Method representing the thread's activity.

setDaemon(daemonic)

setName(name)

start()

Start the thread's activity.

Attributes

daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

native_id

Native integral thread ID of this thread, or None if it has not been started.