Module: ContainedMr::RunnerLogic
- Included in:
- Mock::Runner, Runner
- Defined in:
- lib/contained_mr/runner_logic.rb
Overview
Logic shared by Runner and Mock::Runner.
Instance Attribute Summary collapse
-
#container_id ⇒ String
readonly
The unique ID of the Docker container used to run the mapper / reducer; this is nil.
-
#ended_at ⇒ Time
readonly
The time when the mapper or reducer stops running or is killed.
-
#output ⇒ String
readonly
The contents of the file.
-
#started_at ⇒ Time
readonly
The time when the mapper or reducer starts running.
-
#status_code ⇒ Number
readonly
The time.
-
#stderr ⇒ String
readonly
The data written by the mapper or reducer to stderr.
-
#stdout ⇒ String
readonly
The data written by the mapper or reducer to stdout.
-
#timed_out ⇒ Boolean
readonly
True if the mapper or reducer was terminated due to running for too long.
Instance Method Summary collapse
-
#json_file ⇒ Hash<Symbol, Object>
The information written to the mapper status files given to the reducer.
-
#ran_for ⇒ Number
The container’s running time, in seconds.
Instance Attribute Details
#container_id ⇒ String (readonly)
Returns the unique ID of the Docker container used to run the mapper / reducer; this is nil.
22 23 24 |
# File 'lib/contained_mr/runner_logic.rb', line 22 def container_id @container_id end |
#ended_at ⇒ Time (readonly)
Returns the time when the mapper or reducer stops running or is killed.
6 7 8 |
# File 'lib/contained_mr/runner_logic.rb', line 6 def ended_at @ended_at end |
#output ⇒ String (readonly)
Returns the contents of the file.
18 19 20 |
# File 'lib/contained_mr/runner_logic.rb', line 18 def output @output end |
#started_at ⇒ Time (readonly)
Returns the time when the mapper or reducer starts running.
4 5 6 |
# File 'lib/contained_mr/runner_logic.rb', line 4 def started_at @started_at end |
#status_code ⇒ Number (readonly)
Returns the time.
8 9 10 |
# File 'lib/contained_mr/runner_logic.rb', line 8 def status_code @status_code end |
#stderr ⇒ String (readonly)
Returns the data written by the mapper or reducer to stderr.
16 17 18 |
# File 'lib/contained_mr/runner_logic.rb', line 16 def stderr @stderr end |
#stdout ⇒ String (readonly)
Returns the data written by the mapper or reducer to stdout.
14 15 16 |
# File 'lib/contained_mr/runner_logic.rb', line 14 def stdout @stdout end |
#timed_out ⇒ Boolean (readonly)
Returns true if the mapper or reducer was terminated due to running for too long.
11 12 13 |
# File 'lib/contained_mr/runner_logic.rb', line 11 def timed_out @timed_out end |
Instance Method Details
#json_file ⇒ Hash<Symbol, Object>
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.
35 36 37 |
# 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 ⇒ Number
Returns the container’s running time, in seconds.
25 26 27 |
# File 'lib/contained_mr/runner_logic.rb', line 25 def ran_for started_at && ended_at && (ended_at - started_at) end |