Class: Vangrail::AdaptiveRunners::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/vangrail/adaptive_benchmark.rb

Overview

One bounded JSON request on stdin and one response on stdout.

Constant Summary collapse

DEFAULT_TIMEOUT =
300
DEFAULT_MAX_INPUT_BYTES =
4 * 1024 * 1024
DEFAULT_MAX_OUTPUT_BYTES =
16 * 1024 * 1024

Instance Method Summary collapse

Constructor Details

#initialize(command:, timeout: DEFAULT_TIMEOUT, max_input_bytes: DEFAULT_MAX_INPUT_BYTES, max_output_bytes: DEFAULT_MAX_OUTPUT_BYTES, environment: {}, inherit_environment: false) ⇒ Command

Returns a new instance of Command.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vangrail/adaptive_benchmark.rb', line 19

def initialize(command:, timeout: DEFAULT_TIMEOUT,
               max_input_bytes: DEFAULT_MAX_INPUT_BYTES,
               max_output_bytes: DEFAULT_MAX_OUTPUT_BYTES,
               environment: {}, inherit_environment: false)
  @transport = BoundedJsonCommand.new(
    command: command,
    timeout: timeout,
    max_input_bytes: max_input_bytes,
    max_output_bytes: max_output_bytes,
    environment: environment,
    inherit_environment: inherit_environment,
    label: 'adaptive runner',
  )
end

Instance Method Details

#run(request) ⇒ Object



34
35
36
# File 'lib/vangrail/adaptive_benchmark.rb', line 34

def run(request)
  @transport.call(request)
end