<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unregistering / Removing A SparkListener in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/unregistering-removing-a-sparklistener/m-p/16996#M11077</link>
    <description>&lt;P&gt;Thanks for the reply!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jun 2022 19:56:07 GMT</pubDate>
    <dc:creator>Scorpius</dc:creator>
    <dc:date>2022-06-24T19:56:07Z</dc:date>
    <item>
      <title>Unregistering / Removing A SparkListener</title>
      <link>https://community.databricks.com/t5/data-engineering/unregistering-removing-a-sparklistener/m-p/16994#M11075</link>
      <description>&lt;P&gt;Hey, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So currently I'm using Pyspark and utilizing SparkListener&amp;nbsp;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;# Func--
def unregister(spark_context: SparkContext, *listeners: SparkListener):
    for listener in listeners:
      spark_context._jsc.sc().removeSparkListener(listener)
    #spark_context._gateway.shutdown_callback_server()
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
# Single--
sc._jsc.sc().removeSparkListener(listener) # Where SC is the SparkContext&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 22:26:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unregistering-removing-a-sparklistener/m-p/16994#M11075</guid>
      <dc:creator>Scorpius</dc:creator>
      <dc:date>2022-06-21T22:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: Unregistering / Removing A SparkListener</title>
      <link>https://community.databricks.com/t5/data-engineering/unregistering-removing-a-sparklistener/m-p/16996#M11077</link>
      <description>&lt;P&gt;Thanks for the reply!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 19:56:07 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unregistering-removing-a-sparklistener/m-p/16996#M11077</guid>
      <dc:creator>Scorpius</dc:creator>
      <dc:date>2022-06-24T19:56:07Z</dc:date>
    </item>
  </channel>
</rss>

