Class: Lemans::Bench::Resources
- Inherits:
-
Data
- Object
- Data
- Lemans::Bench::Resources
- Defined in:
- lib/lemans/bench.rb
Overview
The machine shape a trial runs on; the same shape must mean the same thing on every backend.
Instance Attribute Summary collapse
-
#cpus ⇒ Object
readonly
Returns the value of attribute cpus.
-
#memory_mb ⇒ Object
readonly
Returns the value of attribute memory_mb.
-
#storage_mb ⇒ Object
readonly
Returns the value of attribute storage_mb.
Class Method Summary collapse
-
.from_config(config, field:, defaults:) ⇒ Object
Each field falls back on its own, so naming one does not revert the others to defaults.
Instance Attribute Details
#cpus ⇒ Object (readonly)
Returns the value of attribute cpus
16 17 18 |
# File 'lib/lemans/bench.rb', line 16 def cpus @cpus end |
#memory_mb ⇒ Object (readonly)
Returns the value of attribute memory_mb
16 17 18 |
# File 'lib/lemans/bench.rb', line 16 def memory_mb @memory_mb end |
#storage_mb ⇒ Object (readonly)
Returns the value of attribute storage_mb
16 17 18 |
# File 'lib/lemans/bench.rb', line 16 def storage_mb @storage_mb end |
Class Method Details
.from_config(config, field:, defaults:) ⇒ Object
Each field falls back on its own, so naming one does not revert the others to defaults.
18 19 20 21 22 23 24 |
# File 'lib/lemans/bench.rb', line 18 def self.from_config(config, field:, defaults:) new( cpus: config.fetch("cpus", defaults.cpus), memory_mb: Units.megabytes(config["memory"], field: "#{field}.memory") || defaults.memory_mb, storage_mb: Units.megabytes(config["storage"], field: "#{field}.storage") || defaults.storage_mb ) end |