cloud-pipeline
cloud-pipeline copied to clipboard
Run estimation improvement
trafficstars
At the moment, run price estimation in UI might differ from the one, displayed in billing reports. It would be nice to make calculation procedures consistent.
Right now, billing-report-agent implements the following approach to determine compute resource billing for a certain period:
- Retrieve statuses of a run
- Adjust statuses:
- all the statuses outside desired period are omitted (could be skipped for UI, since estimated price is calculated for the period from the start till the current moment)
- in case pipeline is currently running – add STOPPED status with the current timestamp
- there should be at least 2 statuses after adjusting
- Calculate billings for all the active periods, received after adjusting. While iterating over statuses:
- period, started with RUNNING state, considered to be active
- all others periods are inactive (zero cost)
- Merge active periods to calculate a total cost
@Wedds @sidoruka backported to release/0.16 (d5e972abbb9dc45b67f7f9257156f73c6703d244)