<?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 How to retrieve a Job Name from the SparkContext in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/how-to-retrieve-a-job-name-from-the-sparkcontext/m-p/49784#M1633</link>
    <description>&lt;P&gt;We are currently starting to build certain data pipelines using Databricks.&lt;/P&gt;&lt;P&gt;For this we use Jobs and the steps in these Jobs are implemented in Python Wheels.&lt;/P&gt;&lt;P&gt;We are able to retrieve the Job ID, Job Run ID and Task Run Id in our Python Wheels from the SparkContext using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;pyspark.context &lt;SPAN&gt;import &lt;/SPAN&gt;SparkContext&lt;BR /&gt;sc = SparkContext.getOrCreate()&lt;BR /&gt;sc.getLocalProperty(&lt;SPAN&gt;"spark.databricks.job.id"&lt;/SPAN&gt;)&lt;BR /&gt;sc.getLocalProperty(&lt;SPAN&gt;"spark.databricks.job.parentRunId"&lt;/SPAN&gt;)&lt;BR /&gt;sc.getLocalProperty(&lt;SPAN&gt;"spark.databricks.job.runId"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;/DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Now we would also like to get the name of the current Job which is running the wheel. Is there any local property containing that information? So far we did not manage to retrieve all available Keys which are stored as local Properties. Is there any documentation describing all available Properties? We did not find anything out there...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks in advance for your advice!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 24 Oct 2023 06:42:44 GMT</pubDate>
    <dc:creator>HHol</dc:creator>
    <dc:date>2023-10-24T06:42:44Z</dc:date>
    <item>
      <title>How to retrieve a Job Name from the SparkContext</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-retrieve-a-job-name-from-the-sparkcontext/m-p/49784#M1633</link>
      <description>&lt;P&gt;We are currently starting to build certain data pipelines using Databricks.&lt;/P&gt;&lt;P&gt;For this we use Jobs and the steps in these Jobs are implemented in Python Wheels.&lt;/P&gt;&lt;P&gt;We are able to retrieve the Job ID, Job Run ID and Task Run Id in our Python Wheels from the SparkContext using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;pyspark.context &lt;SPAN&gt;import &lt;/SPAN&gt;SparkContext&lt;BR /&gt;sc = SparkContext.getOrCreate()&lt;BR /&gt;sc.getLocalProperty(&lt;SPAN&gt;"spark.databricks.job.id"&lt;/SPAN&gt;)&lt;BR /&gt;sc.getLocalProperty(&lt;SPAN&gt;"spark.databricks.job.parentRunId"&lt;/SPAN&gt;)&lt;BR /&gt;sc.getLocalProperty(&lt;SPAN&gt;"spark.databricks.job.runId"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;/DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Now we would also like to get the name of the current Job which is running the wheel. Is there any local property containing that information? So far we did not manage to retrieve all available Keys which are stored as local Properties. Is there any documentation describing all available Properties? We did not find anything out there...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks in advance for your advice!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 24 Oct 2023 06:42:44 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-retrieve-a-job-name-from-the-sparkcontext/m-p/49784#M1633</guid>
      <dc:creator>HHol</dc:creator>
      <dc:date>2023-10-24T06:42:44Z</dc:date>
    </item>
  </channel>
</rss>

