Log cluster name

Abhishek Gaikwad 191 Reputation points
2021-04-24T09:04:03.153+00:00

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
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,162 questions
0 comments No comments
{count} votes

Accepted answer
  1. PRADEEPCHEEKATLA-MSFT 88,716 Reputation points Microsoft Employee
    2021-04-26T05:43:40.53+00:00

    Hello @Abhishek Gaikwad ,

    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.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.