Question

Python SDK - How to detect new commits.

  • 11 September 2023
  • 2 replies
  • 9 views

Hello, 

 

I have been looking through the SDK docs looking for a functionality that would let me see all new pipeline commits made in a certain time frame. I wasn’t having much luck finding anything and I was wondering if there are any functions that support this.

 

Thank you, 

-Nate


2 replies

Userlevel 2
Badge

Hi Nate,

On a PipelineCommit object there is an attribute called commit_time, that you can use.

e.g. sample script just to print the commit times and versiona of a pipelines

pipeline = sch.pipelines.get(pipeline_id=cur_pipeline_id)

commit_times_versions = [(commit.commit_time, commit.version) for commit in pipeline.commits]

print(commit_times_versions)

which has output like → [(1692061097378, '1'), (1692061185605, '2'), (1692213843955, '3')]

 

So then you can code for the desired time frame checks using commit_time.

Hope it helps.

Regards-

Kirti

Thank you for the response! 

 

Just to clarify what I am asking; I would like to see all new commits across all pipelines. So, say in the last day, 2 existing pipelines have new commits, and one new pipeline is created. I would like to be able to see a log that reports there 3 pipelines have had new commits made, and what their ID /commit_id is. 

Reply