import requests
url = "https://platform.ankra.app/api/v1/org/applications/{application_id}/pipeline-runs/{run_id}/time-saved"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://platform.ankra.app/api/v1/org/applications/{application_id}/pipeline-runs/{run_id}/time-saved', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://platform.ankra.app/api/v1/org/applications/{application_id}/pipeline-runs/{run_id}/time-saved \
--header 'Authorization: Bearer <token>'{
"run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"saved_seconds": 1,
"saved_cpu_minutes": 1,
"estimated_count": 1,
"unknown_count": 1,
"savings": [
{
"step_key": "<string>",
"stage": "<string>",
"reason": "path_filter",
"cause_stage": "<string>",
"basis": "stage_history",
"sample_count": 1,
"saved_seconds": 1,
"saved_cpu_minutes": 1,
"source_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"method": {
"statistic": "median",
"sample_window": 2,
"history_run_scan": 2
}
}Get the time an application run saved
The same savings addressed by application. Each saving is estimated when the run is planned or skipped, from the stage’s own history in the same repository: the median of its newest 20 successful runs among the repository’s newest 300 concluded runs (a promoted step uses its duration in the run it was promoted from; a whole run uses the median total of the newest 20 successful runs of the same trigger). CPU-minutes are requested CPU times duration. A stage with no history is counted as unknown, never as a saving. The time is runner time, not wall-clock time. Requires pipelines.read. Read-only.
import requests
url = "https://platform.ankra.app/api/v1/org/applications/{application_id}/pipeline-runs/{run_id}/time-saved"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://platform.ankra.app/api/v1/org/applications/{application_id}/pipeline-runs/{run_id}/time-saved', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://platform.ankra.app/api/v1/org/applications/{application_id}/pipeline-runs/{run_id}/time-saved \
--header 'Authorization: Bearer <token>'{
"run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"saved_seconds": 1,
"saved_cpu_minutes": 1,
"estimated_count": 1,
"unknown_count": 1,
"savings": [
{
"step_key": "<string>",
"stage": "<string>",
"reason": "path_filter",
"cause_stage": "<string>",
"basis": "stage_history",
"sample_count": 1,
"saved_seconds": 1,
"saved_cpu_minutes": 1,
"source_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"method": {
"statistic": "median",
"sample_window": 2,
"history_run_scan": 2
}
}Authorizations
Response
The run's savings.
The CI time one run did not spend. An empty savings list is a run that skipped nothing that counts, or one planned before savings were recorded.