End date of build into Palantir Foundry

105 Views Asked by At

Is there a way to track the end timestamp of a dataset build into Palantir Foundry?

I need to track daily (with a Dataset or with an Health Check) the timestamp of build end.

Thank u!

1

There are 1 best solutions below

1
On

You could use this foundry endpoint to save build data and end timestamps to a dataset:

import requests

base = "your foundry base url"
token = "your foundry token"

headers = {
    'Authorization': f'Bearer {token}',
    'Content-Type': 'application/json'
}

url = f"{base}/job-tracker/api/builds/summary"
query = {
    "buildFilter": {
        "scheduleIds": ["the RID of your schedule"]
    }
}
response = requests.post(url, headers=headers, json=query)

which returns a response in this format (I replaced some of the actual IDs with 'ID'). I think finishedTime might be what you're looking for:

b'{"builds":[{"buildId":"ri.foundry.main.build.ID","buildStatus":"SUCCEEDED","finishedTime":"2023-10-20T11:22:27.098896034Z","startedTime":"2023-10-20T08:37:02.558295811Z","userId":"ID","jobCount":82,"scheduleId":"ri.scheduler.main.schedule.ID"}]}'