<?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 Azure Databricks job and exception handling in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/azure-databricks-job-and-exception-handling/m-p/15797#M10070</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm working on Azure Databricks and I created two jobs, one based on a python wheel and the other based on a notebook, with the same code. The code get data from Azure blob storage, process data with pyspark and send data to EventHub. The whole code is wrapped in a try / except, like this one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;# import libraries
from opencensus.ext.azure.log_exporter import AzureLogHandler
import logging
&amp;nbsp;
# add before def main()..
logger = logging.getLogger()
logger.addHandler(
    AzureLogHandler(
        connection_string = 'my-connection-string'
    )
)
&amp;nbsp;
if __name__ == '__main__':
    try:
        main() # main code: get data, process data, send data to eventhub
    except Exception as e:
        msg = str(getattr(e, 'message', repr(e)))
        logger.exception(msg)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I tried to generate an exception to test logging in App Insights for both the wheel based job and the notebook based job, and I noticed that even if they worked fine the first one (wheel job) return "&lt;I&gt;failed&lt;/I&gt;" in the end, instead the second one (notebook job) return "&lt;I&gt;succeded&lt;/I&gt;". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does someone knows why the behavior changes in relation to the job "format"? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help!&lt;/P&gt;</description>
    <pubDate>Tue, 20 Dec 2022 08:36:18 GMT</pubDate>
    <dc:creator>lcalca95</dc:creator>
    <dc:date>2022-12-20T08:36:18Z</dc:date>
    <item>
      <title>Azure Databricks job and exception handling</title>
      <link>https://community.databricks.com/t5/data-engineering/azure-databricks-job-and-exception-handling/m-p/15797#M10070</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm working on Azure Databricks and I created two jobs, one based on a python wheel and the other based on a notebook, with the same code. The code get data from Azure blob storage, process data with pyspark and send data to EventHub. The whole code is wrapped in a try / except, like this one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;# import libraries
from opencensus.ext.azure.log_exporter import AzureLogHandler
import logging
&amp;nbsp;
# add before def main()..
logger = logging.getLogger()
logger.addHandler(
    AzureLogHandler(
        connection_string = 'my-connection-string'
    )
)
&amp;nbsp;
if __name__ == '__main__':
    try:
        main() # main code: get data, process data, send data to eventhub
    except Exception as e:
        msg = str(getattr(e, 'message', repr(e)))
        logger.exception(msg)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I tried to generate an exception to test logging in App Insights for both the wheel based job and the notebook based job, and I noticed that even if they worked fine the first one (wheel job) return "&lt;I&gt;failed&lt;/I&gt;" in the end, instead the second one (notebook job) return "&lt;I&gt;succeded&lt;/I&gt;". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does someone knows why the behavior changes in relation to the job "format"? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 08:36:18 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/azure-databricks-job-and-exception-handling/m-p/15797#M10070</guid>
      <dc:creator>lcalca95</dc:creator>
      <dc:date>2022-12-20T08:36:18Z</dc:date>
    </item>
  </channel>
</rss>

