Overview
Compute credits are calculated based on a job's duration and its resource class.
The total duration billed for a workflow is based on the duration of each job in the workflow.
We can verify the total duration each job took, for a given workflow.
This may be useful for estimating a workflow's billable compute credits.
Fetching duration information
Here is a simple script that uses our CircleCI API to calculate each job's duration:
https://gist.github.com/kelvintaywl/726ab96f4d2eb26193512b29a22e9f0f
To use this script, you can download it and run the following
# script requires curl & jq
# NOTE: please set your CircleCI API token under $CIRCLE_TOKEN
$ sh ./calculate.sh <workflow ID>
Outcome
You can see each job's duration for a given workflow from the script output.
# Example
$ sh ./calculate.sh 481961c0-5fb5-4759-810c-2c301445c2c0
For Workflow ID 481961c0-5fb5-4759-810c-2c301445c2c0:
job gh/kelvintaywl-cci/cci-shells/job/45 took 2524 ms.
job gh/kelvintaywl-cci/cci-shells/job/43 took 190409 ms.
job gh/kelvintaywl-cci/cci-shells/job/42 took 2170 ms.
job gh/kelvintaywl-cci/cci-shells/job/44 took 4951 ms.
job gh/kelvintaywl-cci/cci-shells/job/46 took 2395 ms.
Comments
Article is closed for comments.