Class: Lemans::Bench::Agent

Inherits:
Section
  • Object
show all
Defined in:
lib/lemans/bench.rb

Overview

The agent section: who works the task and under what budget.

Constant Summary collapse

VALIDATED =
%i[name version model timeout_sec step_limit cost_limit
exec_timeout_sec config models network].freeze

Instance Method Summary collapse

Methods inherited from Section

#validate!

Constructor Details

#initialize(config) ⇒ Agent

Returns a new instance of Agent.



144
# File 'lib/lemans/bench.rb', line 144

def initialize(config) = super(config, "agent")

Instance Method Details

#configObject



153
# File 'lib/lemans/bench.rb', line 153

def config           = (self["config"] || {}).freeze

#cost_limitObject



151
# File 'lib/lemans/bench.rb', line 151

def cost_limit       = float("cost_limit")

#exec_timeout_secObject



152
# File 'lib/lemans/bench.rb', line 152

def exec_timeout_sec = seconds("exec_timeout", default: 30)

#modelObject



148
# File 'lib/lemans/bench.rb', line 148

def model            = models.first

#modelsObject

model takes one name or a list; a list turns the run into a sweep, one full grid per model.



156
# File 'lib/lemans/bench.rb', line 156

def models = Array(self["model"]).map(&:to_s).freeze

#nameObject



146
# File 'lib/lemans/bench.rb', line 146

def name             = fetch("name")

#networkObject

The only environment knob the agent phase owns: agent.environment.network.



159
160
161
# File 'lib/lemans/bench.rb', line 159

def network
  NetworkPolicy.from_config((self["environment"] || {})["network"], field: dotted("environment.network"))
end

#step_limitObject



150
# File 'lib/lemans/bench.rb', line 150

def step_limit       = integer("step_limit") || 0

#timeout_secObject



149
# File 'lib/lemans/bench.rb', line 149

def timeout_sec      = seconds("timeout", default: "30m")

#versionObject



147
# File 'lib/lemans/bench.rb', line 147

def version          = self["version"]&.to_s