Class: ContainedMr::Runner
- Inherits:
-
Object
- Object
- ContainedMr::Runner
- Includes:
- RunnerLogic
- Defined in:
- lib/contained_mr/runner.rb
Overview
Handles running a single mapper or reducer.
Instance Attribute Summary
Attributes included from RunnerLogic
#container_id, #ended_at, #output, #started_at, #status_code, #stderr, #stdout, #timed_out
Instance Method Summary collapse
-
#destroy!(container = nil) ⇒ ContainedMr::Runner
Removes the container used to run a mapper / reducer.
-
#initialize(container_options, time_limit, output_path) ⇒ Runner
constructor
Initialize a runner.
-
#perform ⇒ ContainedMr::Runner
Performs a full mapper / reducer step.
Methods included from RunnerLogic
Constructor Details
#initialize(container_options, time_limit, output_path) ⇒ Runner
Initialize a runner.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/contained_mr/runner.rb', line 18 def initialize(, time_limit, output_path) @_container_options = @_time_limit = time_limit @_output_path = output_path @container_id = nil @started_at = @ended_at = nil @status_code = nil @timed_out = nil @stdout = @stderr = nil @output = nil end |
Instance Method Details
#destroy!(container = nil) ⇒ ContainedMr::Runner
Removes the container used to run a mapper / reducer.
50 51 52 53 54 55 56 57 |
# File 'lib/contained_mr/runner.rb', line 50 def destroy!(container = nil) unless @container_id.nil? container ||= Docker::Container.get @container_id container.delete force: true @container_id = nil end self end |
#perform ⇒ ContainedMr::Runner
Performs a full mapper / reducer step.
34 35 36 37 38 39 40 41 42 |
# File 'lib/contained_mr/runner.rb', line 34 def perform container = create @container_id = container.id execute container fetch_console_output container fetch_file_output container destroy! container end |