feat: Vultr bare-metal cost calculation with provider/machine-type overrides - #19
Open
alinzh wants to merge 3 commits into
Open
feat: Vultr bare-metal cost calculation with provider/machine-type overrides#19alinzh wants to merge 3 commits into
alinzh wants to merge 3 commits into
Conversation
…e overrides - Add bare-metal plans (vbm-*) to CLOUD_PRICING from Vultr API - Add detect_provider() vbm token, read_provider_and_machine_type_from_config() - Add --provider, --engine, --machine-type CLI flags to dft-report-aiida/dft-report - Rename hetzner_rate->cloud_rate, cost_eur->cost, add currency field - provider+machine_type fallback: CLI flag -> /etc/yascheduler/yascheduler.conf -> skip - When no provider info available (no flag, no config), cost columns are omitted from CSV - --engine filter skips expensive FLEUR enrichment (Seebeck/displacement) - Remove dead code in pricing.py (duplicate lines after return) - 62 tests: bare-metal rates, config read, skip_cost, provider/engine/machine_type overrides Closes #17
All tasks complete (62 tests pass, verified on real AiiDA data). Moved to openspec/changes/archive/2026-08-04-add-vultr-cost-calculation/
- Fix amd5 substring collision: longest-key-first matching in get_cloud_rate - Unknown provider/plan returns None instead of 0.0 (no silent 'free' cost) - UpCloud recognised in config but has no pricing → rate/currency None - resolve_provider_and_rate(): single shared helper, validates provider+machine_type consistency (no cross-cloud mixing, e.g. vultr+ccx13 → rate None) - Remove skip_cost: auto-detect from computer name still works without config - Currency set even when rate is None (provider known, plan unknown) - Config tests use tmp_path (no /etc/yascheduler/ dependency) - Engine filter tests verify QueryBuilder.append() gets process_type filter - 81 tests: amd5, cross-provider mismatch, unknown plans, no-config auto-detect Addresses PR #19 review feedback.
Collaborator
Author
|
Important note: the issue here is that it is impossible to calculate cost for "broken" calculations, as there is no source for their duration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Vultr cost calculation (including bare-metal plans) for AiiDA reports. Previously, cost was hardcoded to Hetzner (
provider="hetzner"); Vultr rates existed inpricing.pybut were never used.What changed
Pricing (
pricing.py):vbm-24c-256gb-amd$0.993/h,vbm-8c-132gb-v2$0.479/h, and 7 more) — prices from Vultr APIdetect_provider()now recognizes thevbmtokenread_provider_and_machine_type_from_config()— reads provider and plan from/etc/yascheduler/yascheduler.confresolve_provider_and_rate()— single shared helper that validates provider+machine_type consistency (no cross-cloud mixing)get_cloud_rate()uses longest-key-first matching (fixesamdvsamd5collision)Noneinstead of0.0(no silent "free" cost)None, cost omittedreturninget_cloud_rate)CLI (
report_aiida_cli.py,report_cli.py):--provider [hetzner|vultr_usa]— override cloud provider--engine [crystal|fleur]— filter by engine (skips expensive FLEUR enrichment: Seebeck/displacement)--machine-type TEXT— override machine plan (e.g.vbm-24c-256gb-amd)Report fields (
aiida/reporting.py,reporting.py):hetzner_rate→cloud_rate,cost_eur→cost, addedcurrency(EUR/USD)Cost determination logic
Priority:
--provider/--machine-type(CLI) →/etc/yascheduler/yascheduler.conf→detect_provider(computer_name)→Nonerate → omitWhen no config is available, cost is still attempted via auto-detection from the AiiDA computer name. Cost columns are omitted only when no rate can be determined (e.g. unknown computer name or cross-provider mismatch).
Cross-provider mismatch (e.g.
--provider vultr_usa --machine-type ccx13) → rate isNone, cost omitted, warning logged.Tests
81 tests (
tests/test_pricing.py,tests/test_reporting_provider.py):amd5vsamdsubstring matchingdetect_provider(incl.vbmtoken), config read (all viatmp_path, no/etc/dependency)resolve_provider_and_rate: provider/machine_type override, cross-provider mismatch, auto-detect from computer nameQueryBuilder.append()receivesprocess_typefiltervultr-ams-vc2-4c-8gb→ USD/0.06 without configNonerate (not0.0)Verification
Verified on 92 CRYSTAL calcs (2026-06-01): Vultr bare-metal $996.34, Hetzner ccx13 €25.69, default config matches explicit flags.
Closes #17