<?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: How do I get the current cluster id? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28411#M20207</link>
    <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Thank you for your answer.@Arti &lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Feb 2019 04:20:01 GMT</pubDate>
    <dc:creator>tonyp</dc:creator>
    <dc:date>2019-02-13T04:20:01Z</dc:date>
    <item>
      <title>How do I get the current cluster id?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28403#M20199</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I am adding Application Insights telemetry to my Databricks jobs and would like to include the cluster ID of the job run. How can I access the cluster id at run time? &lt;/P&gt;
&lt;P&gt;The requirement is that my job can programmatically retrieve the cluster id to insert into all telemetry. Retrieving the cluster ID through the UI will not be sufficient.&lt;/P&gt;
&lt;P&gt;I don't see any dbutils commands that would be of use.&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 23:43:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28403#M20199</guid>
      <dc:creator>ammobear</dc:creator>
      <dc:date>2019-02-11T23:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the current cluster id?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28404#M20200</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;In Databricks click on your cluster in the Clusters tab, Change the UI interface to json, It will give the all details about your cluster&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0693f000007OrnRAAS"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/2517i9EEB908F73EBADB6/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693f000007OrnRAAS" alt="0693f000007OrnRAAS" /&gt;&lt;/span&gt;&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 04:31:44 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28404#M20200</guid>
      <dc:creator>tonyp</dc:creator>
      <dc:date>2019-02-12T04:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the current cluster id?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28405#M20201</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Thank you for your answer. I have added more detail to my question. Unfortunately, the UI will not work as I need my job code to programmatically pull the cluster id.&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 16:33:18 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28405#M20201</guid>
      <dc:creator>ammobear</dc:creator>
      <dc:date>2019-02-12T16:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the current cluster id?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28406#M20202</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;You can use the cluster node initiaization script to grab the environment variable DB_CLUSTER_ID. Refer here &lt;A href="https://docs.databricks.com/user-guide/clusters/init-scripts.html#environment-variables" target="test_blank"&gt;https://docs.databricks.com/user-guide/clusters/init-scripts.html#environment-variables&lt;/A&gt;. Also from the notebook, the following also works :&lt;/P&gt;
&lt;P&gt;spark.conf.get("spark.databricks.clusterUsageTags.clusterName")&lt;/P&gt;
&lt;P&gt;spark.conf.get("spark.databricks.clusterUsageTags.clusterId")&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 18:23:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28406#M20202</guid>
      <dc:creator>Arti</dc:creator>
      <dc:date>2019-02-12T18:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the current cluster id?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28407#M20203</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;That's perfect! Thank you for your help Arti.&lt;/P&gt;
&lt;P&gt;Do you know if the properties of &lt;PRE&gt;&lt;CODE&gt;clusterUsageTabs&lt;/CODE&gt;&lt;/PRE&gt; are documented anywhere? I wonder what other useful properties I might be able to log.&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 18:54:16 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28407#M20203</guid>
      <dc:creator>ammobear</dc:creator>
      <dc:date>2019-02-12T18:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the current cluster id?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28408#M20204</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I am not sure if these are documented. Use the following code to get the entire list:&lt;/P&gt;
&lt;P&gt;%scala &lt;/P&gt;
&lt;P&gt;val configMap = spark.conf.getAll &lt;/P&gt;
&lt;P&gt;configMap.foreach(println)&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 19:00:33 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28408#M20204</guid>
      <dc:creator>Arti</dc:creator>
      <dc:date>2019-02-12T19:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the current cluster id?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28409#M20205</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Thanks! Feel free to make your first comment a separate post and I'll mark it as the answer.&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 19:31:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28409#M20205</guid>
      <dc:creator>ammobear</dc:creator>
      <dc:date>2019-02-12T19:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the current cluster id?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28410#M20206</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;You can use the cluster node initiaization script to grab the environment variable DB_CLUSTER_ID. Refer here &lt;A href="https://docs.databricks.com/user-guide/clusters/init-scripts.html#environment-variables" target="test_blank"&gt;https://docs.databricks.com/user-guide/clusters/init-scripts.html#environment-variables&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;Also from the notebook , the following also works :&lt;/P&gt;
&lt;P&gt;
 spark.conf.get("spark.databricks.clusterUsageTags.clusterName")
&lt;/P&gt;
&lt;P&gt;
 spark.conf.get("spark.databricks.clusterUsageTags.clusterId")
&lt;/P&gt;
&lt;P&gt;The entire list of spark properties is available in UI in Spark UI --&amp;gt; Environment tab.&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 04:08:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28410#M20206</guid>
      <dc:creator>Arti</dc:creator>
      <dc:date>2019-02-13T04:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the current cluster id?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28411#M20207</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Thank you for your answer.@Arti &lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 04:20:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28411#M20207</guid>
      <dc:creator>tonyp</dc:creator>
      <dc:date>2019-02-13T04:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the current cluster id?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28412#M20208</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Hi, I'm trying to install a library using the init script option. But the $DB_CLUSTER_ID it is empty, why? Also I tried to do in a Notebook cell a %sh echo $DB_CLUSTER_ID and also is empty&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;curl -X POST &lt;A href="https://dbc-myid.cloud.databricks.com/api/2.0/libraries/install" target="test_blank"&gt;https://dbc-myid.cloud.databricks.com/api/2.0/libraries/install&lt;/A&gt; -H 'Cache-Control:no-cache' -H 'Content-Type:application/json' -H 'Authorization: Bearer mytoken' -d '{"cluster_id": "$DB_CLUSTER_ID", "libraries": [{"egg": "dbfs:/FileStore/jars/library-0.1-py3.7.egg"}]}'&lt;/CODE&gt;&lt;/PRE&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2019 16:47:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28412#M20208</guid>
      <dc:creator>EricBellet</dc:creator>
      <dc:date>2019-10-03T16:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the current cluster id?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28413#M20209</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Are you using cluster init script or global init script ?&lt;/P&gt;
&lt;P&gt;DB_CLUSTER_ID - This env variable is available only during the cluster init script execution. I guess you will not be able to get the values for the these init script's env variables if you try from notebook.&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2019 23:21:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28413#M20209</guid>
      <dc:creator>Arti</dc:creator>
      <dc:date>2019-10-07T23:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the current cluster id?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28414#M20210</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I fixed, it should be "'$DB_CLUSTER_ID'"&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 16:06:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-do-i-get-the-current-cluster-id/m-p/28414#M20210</guid>
      <dc:creator>EricBellet</dc:creator>
      <dc:date>2019-10-08T16:06:35Z</dc:date>
    </item>
  </channel>
</rss>

