question

abhishek6555 avatar image
0 Votes"
abhishek6555 asked abhishek6555 commented

Log cluster name

When i run any notebook I want to log by using which cluster the notebook was executed.
Is their any way to get the cluster name using python in databricks

azure-databricks
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

PRADEEPCHEEKATLA-MSFT avatar image
0 Votes"
PRADEEPCHEEKATLA-MSFT answered abhishek6555 commented

Hello @abhishek6555,

Thanks for the ask and using Microsoft Q&A platform.

Is their any way to get the cluster name using python in databricks?

You can use the below command to get the cluster name using python in databricks:

 cluster_name = spark.conf.get("spark.databricks.clusterUsageTags.clusterName")
 print(cluster_name)

91163-image.png

Hope this helps. Do let us know if you any further queries.


Please don’t forget to Accept Answer and Up-Vote wherever the information provided helps you, this can be beneficial to other community members.


image.png (52.2 KiB)
image.png (46.7 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks this helps

0 Votes 0 ·