module ContainedMr::RunnerLogic

Logic shared by {ContainedMr::Runner} and {ContainedMr::Mock::Runner}.

Attributes

container_id[R]

@return {String} the unique ID of the Docker container used to run the

mapper / reducer; this is nil
ended_at[R]

@return {Time} the time when the mapper or reducer stops running or is killed

output[R]

@return {String} the contents of the file

started_at[R]

@return {Time} the time when the mapper or reducer starts running

status_code[R]

@return {Number} the time

stderr[R]

@return {String} the data written by the mapper or reducer to stderr

stdout[R]

@return {String} the data written by the mapper or reducer to stdout

timed_out[R]

@return {Boolean} true if the mapper or reducer was terminated due to

running for too long

Public Instance Methods

json_file() click to toggle source

The information written to the mapper status files given to the reducer.

This is saved in files named 1.json, 2.json, … provided to the reducer.

@return {Hash<Symbol, Object>} JSON-compatible representation of the

runner's information
# File lib/contained_mr/runner_logic.rb, line 35
def json_file
  { ran_for: ran_for, exit_code: status_code, timed_out: timed_out }
end
ran_for() click to toggle source

@return {Number} the container’s running time, in seconds

# File lib/contained_mr/runner_logic.rb, line 25
def ran_for
  started_at && ended_at && (ended_at - started_at)
end