cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to get git commit ID of the repository the script runs on?

annagriv
New Contributor II

I have a script in a repository on DataBricks. The script should log the current git commit ID of the repository. How can that be implemented?

I tried various command, for example:

result = subprocess.run(['git', 'rev-parse', 'HEAD'], stdout=subprocess.PIPE, check=True)

but getting the following error:

Command '['git', 'rev-parse', 'HEAD']' returned non-zero exit status 128.

Any help with this will be appreciated ๐Ÿ™

1 ACCEPTED SOLUTION

Accepted Solutions

-werners-
Esteemed Contributor III

I think this is because of the fact that the code and execution (clusters) are separated.

View solution in original post

3 REPLIES 3

-werners-
Esteemed Contributor III

I think this is because of the fact that the code and execution (clusters) are separated.

annagriv
New Contributor II

Thanks for you reply, so this means its impossible to log the git commit id? There is no way to pass this information to the cluster?

-werners-
Esteemed Contributor III

I think that is indeed the case (not 100% sure as I do not know the innards of Databricks).

The on-demand cluster receives a program to be executed and I don't think a git history is passed.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group