Module: HotCell

Defined in:
lib/hot_cell/test_operations.rb,
lib/hot_cell/log.rb,
lib/hot_cell/slot.rb,
lib/hot_cell/limits.rb,
lib/hot_cell/server.rb,
lib/hot_cell/timing.rb,
lib/hot_cell/worker.rb,
lib/hot_cell/control.rb,
lib/hot_cell/counters.rb,
lib/hot_cell/registry.rb,
lib/hot_cell/operation.rb,
lib/hot_cell/test_cell.rb,
lib/hot_cell/supervisor.rb,
lib/hot_cell/configuration.rb,
lib/hot_cell/server/errors.rb,
lib/hot_cell/server/version.rb

Overview

Fixture operations, so the whole surface can be exercised in milliseconds, with no tool installed and no container running.

They ship rather than sitting in this gem's own test directory, for the reason hot_cell/test_cell.rb does: hotcell-client boots a real cell and needs an inventory to point it at. It had written its own, and five of those answered to routing names these already claim — so test.uppercase meant one thing when the client suite proved it and another when this one did.

Namespaced because this is a shipped file and Fixtures at the top level belongs to the application. Both suites alias it in their own helper.

Defined Under Namespace

Modules: Fixtures, Registry, Server Classes: Configuration, Control, Counters, Limits, Log, MemoryExhausted, Operation, OperationError, Slot, Supervisor, TestCell, Timing, UnreadableInput, Worker

Class Method Summary collapse

Class Method Details

.configurationObject



21
22
23
# File 'lib/hot_cell/server.rb', line 21

def configuration
  @configuration ||= Configuration.new
end

.limits(**options) ⇒ Object

A cell is configured once, and everything about scheduling lives here rather than on an operation.

HotCell.limits concurrency: 4, queue_size: 8, deadline: 60, queue_wait: 10, max_requests_per_worker: 1,
             memory: 1536 * 1024**2, file_size: 48 * 1024**2


29
30
31
32
33
# File 'lib/hot_cell/server.rb', line 29

def limits(**options)
  return configuration if options.empty?

  @configuration = Configuration.new(**options)
end

.load!(config: ENV.fetch("HOTCELL_CONFIG", "/hotcell/config.rb"), operations: ENV.fetch("HOTCELL_OPERATIONS", "/hotcell/operations")) ⇒ Object

Boots a cell's code: the configuration file first, explicitly, then every operation file in sorted order. A derived image adds these by copying files in, never by changing this gem, and a cell with no config.rb takes every default.



38
39
40
41
42
43
# File 'lib/hot_cell/server.rb', line 38

def load!(config: ENV.fetch("HOTCELL_CONFIG", "/hotcell/config.rb"),
          operations: ENV.fetch("HOTCELL_OPERATIONS", "/hotcell/operations"))
  require config if File.exist?(config)

  Dir.glob(File.join(operations, "**", "*.rb")).sort.each { |file| require file }
end