Estimating Costs - testflows/TestFlows-GitHub-Hetzner-Runners GitHub Wiki
โ Available: | >= 1.7 |
---|
You can get an estimated cost for a job, a run, or a set of runs using the estimate command. The estimator will show typical worst-case and best-case cost scenarios.
All costs are in Euros (โฌ).
โWarning: | Manual monitoring is required to make sure server instances are cleaned up properly and costs are kept under control. |
---|
The cost estimator works using the new runner names, which include server type and server location in the runner name.
Runner name: |
github-hetzner-runner-{run id}-{job id}-{server type}-{server location} For example,
|
---|
You can estimate costs for a given job using the estimate job command and passing it the id of the job.
For example,
github-hetzner-runners estimate job 22754907649
You can estimate costs for a given run using the estimate run command and passing it the id of the run.
For example,
github-hetzner-runners estimate run 8315964014
Optionally, if you want to get an estimate for a specific attempt, you can specify the attempt number using the --attempt option.
For example,
github-hetzner-runners estimate run 8315964014 --attempt 1
You can estimate costs for different runs using the estimate runs command.
You can specify the following options to select specific runs:
Options: |
|
---|
The command will show estimates for one run at a time, and you will have to press Ctrl-D to continue to the next run.
For example,
$ github-hetzner-runners estimate runs
10:40:00 ๐ Logging in to Hetzner Cloud
...
โ Press any key to continue (Ctrl-D to abort)...
Calculating costs for runs created by versions <= 1.7 is not supported.
Costs are estimated using the latest server prices that are pulled up from Hetzner Cloud during the command execution.
The costs of the server used to run the cloud service are not included.
The costs for IPv4 and IPv6 addresses are fixed at 0.0008 and 0.0000, respectively, but can be manually modified using the --ipv4 and --ipv6 options.
Options: |
|
---|
The cost estimator only shows typical worst-case and best-case scenarios.
โWarning: |
The actual costs can vary significantly due to various factors, including but not limited to the following:
|
---|
Also,
โWarning: | The server setup and tear-down time are not included in the calculations. |
---|
โ Note: | Costs are estimated using the latest server prices that are pulled up from Hetzner Cloud during the command execution. Therefore, any differences in prices between when the job was actually executed and the current prices are not accounted for. All costs are in Euros (โฌ). |
---|
The typical worst-case scenario is calculated as follows:
math.ceil(duration.total_seconds() / 3600) * 3600 * price
and gives the cost assuming the server usage is billed per hour and is not reused for any other jobs; therefore, the duration of the job is rounded to the nearest hour.
The best-case scenario is calculated as follows:
duration.total_seconds() * price
and gives the idealized cost assuming the server is utilized 100% and absolutely no time is wasted in setting up a server or switching between the jobs.
The actual costs will vary, and in typical cases, they should be somewhere between the worst-case and best-case scenarios.
The number of jobs and their duration, for which costs could not be estimated, will be reflected as follows:
unknown_jobs: 1
unknown_duration: 0:00:11
You can save the output of any estimate commands to a file using the -o, --output option. The contents of the file will be in YAML format.
For example,
estimate.yaml: |
- name: vzakaznikov is testing out GitHub Actions ๐
id: 8345322092
attempt: 1
jobs:
- name: Explore-GitHub-Actions
id: 22839957391
status: completed
started_at: 2024-03-19 15:04:00
completed_at: 2024-03-19 15:04:23
duration: 00:00:23
url: https://api.github.com/repos/testflows/TestFlows-GitHub-Hetzner-Runners/actions/jobs/22839957391
run_id: 8345322092
run_url: https://api.github.com/repos/testflows/TestFlows-GitHub-Hetzner-Runners/actions/runs/8345322092
runner_id: 1047
runner_name: github-hetzner-runner-8333499151-22805094091-cx11-hel1
runner_group_id: 1
runner_group_name: Default
workflow_name: vzakaznikov is testing out GitHub Actions ๐
estimate:
servers:
- type: cx11
location: hel1
price: 0.006000
duration: 00:00:23
worst: 0.006000
best: 0.000038
worst: 0.006000
best: 0.000038
total:
jobs: 1
duration: 00:00:23
known:
jobs: 1
duration: 00:00:23
unknown:
jobs: 0
duration: 00:00:00
estimate:
servers:
- type: cx11
location: hel1
price: 0.006000
duration: 00:00:23
worst: 0.006000
best: 0.000038
worst: 0.006000
best: 0.000038 |
---|
The estimate command supports the following options:
Options: |
|
---|