registerProgressHandler
Registers a progress handler to be called when a progress update is received from the server.
Syntax
registerProgressHandler(handler)
Parameters
Parameter | Type | Description |
|---|---|---|
| ProgressHandler | A callable that follows the |
Returns
None
Notes
This method is only supported with Spark Connect. With a regular Spark session it raises an exception.
Examples
Python
def progress_handler(stages, inflight_tasks, done):
print(f"{len(stages)} Stages known, Done: {done}")
spark.registerProgressHandler(progress_handler)
res = spark.range(10).repartition(1).collect()
# 3 Stages known, Done: False
# 3 Stages known, Done: True
spark.clearProgressHandlers()