pyspark.TaskContext.get

classmethod TaskContext.get() → Optional[pyspark.taskcontext.TaskContext][source]

Return the currently active TaskContext. This can be called inside of user functions to access contextual information about running tasks.

Returns
TaskContext, optional

Notes

Must be called on the worker, not the driver. Returns None if not initialized.