cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Unregistering / Removing A SparkListener

Scorpius
New Contributor II

Hey,

So currently I'm using Pyspark and utilizing SparkListener to track metrics of my spark jobs. The problem I can't seem to solve is why in databricks the listener cannot be removed with removeSparkListener as it still is attached to the context.

# Func--
def unregister(spark_context: SparkContext, *listeners: SparkListener):
    for listener in listeners:
      spark_context._jsc.sc().removeSparkListener(listener)
    #spark_context._gateway.shutdown_callback_server()
 
 
 
 
 
# Single--
sc._jsc.sc().removeSparkListener(listener) # Where SC is the SparkContext

1 REPLY 1

Thanks for the reply!

Although in practice this should work, but it doesn't work if it's running in Databricks. Is there any other readings you can provide?

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group