Class: Lemans::Bench::Environment

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

Overview

The environment block: the one machine a trial runs on. The agent works in it, and the verifier verifies in it.

Constant Summary collapse

VALIDATED =
%i[image workdir resources build_timeout_sec network setup].freeze

Instance Method Summary collapse

Methods inherited from Section

#validate!

Constructor Details

#initialize(config) ⇒ Environment

Returns a new instance of Environment.



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

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

Instance Method Details

#build_timeout_secObject



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

def build_timeout_sec = seconds("build_timeout", default: "10m")

#imageObject

A bench that names no image builds one per task from each task's own Dockerfile.



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

def image = self["image"]

#networkObject



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

def network = policy

#resourcesObject



128
129
130
# File 'lib/lemans/bench.rb', line 128

def resources
  Resources.from_config(self["resources"] || {}, field: dotted("resources"), defaults: DEFAULT_RESOURCES)
end

#setupObject



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

def setup = commands("setup")

#workdirObject



121
122
123
124
125
126
# File 'lib/lemans/bench.rb', line 121

def workdir
  fetch("workdir", "/app").tap do |dir|
    raise ConfigError, "#{dotted("workdir")} must be an absolute path, got #{dir.inspect}" unless
      dir.start_with?("/")
  end
end