Class: ContainedMr::Template
- Inherits:
-
Object
- Object
- ContainedMr::Template
- Includes:
- TemplateLogic
- Defined in:
- lib/contained_mr/template.rb
Overview
A template is used to spawn multiple Map-Reduce jobs.
Instance Attribute Summary
Attributes included from TemplateLogic
#id, #image_id, #item_count, #name_prefix
Instance Method Summary collapse
-
#destroy! ⇒ ContainedMr::Template
Tears down the template’s state.
-
#initialize(name_prefix, id, zip_io) ⇒ Template
constructor
A new instance of Template.
-
#job_class ⇒ Class
The class instantiated by ContainedMr::TemplateLogic#new_job.
Methods included from TemplateLogic
#image_tag, #mapper_dockerfile, #mapper_env, #mapper_output_path, #new_job, #reducer_dockerfile, #reducer_env, #reducer_output_path
Constructor Details
#initialize(name_prefix, id, zip_io) ⇒ Template
Returns a new instance of Template.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/contained_mr/template.rb', line 13 def initialize(name_prefix, id, zip_io) @name_prefix = name_prefix @id = id @image_id = nil @item_count = nil @_definition = nil tar_buffer = StringIO.new process_zip zip_io, tar_buffer tar_buffer.rewind build_image tar_buffer end |
Instance Method Details
#destroy! ⇒ ContainedMr::Template
Tears down the template’s state.
This removes the template’s base Docker image.
31 32 33 34 35 36 37 38 39 |
# File 'lib/contained_mr/template.rb', line 31 def destroy! unless @image_id.nil? # HACK(pwnall): Trick docker-api into issuing a DELETE request by tag. image = Docker::Image.new Docker.connection, 'id' => image_tag image.remove @image_id = nil end self end |
#job_class ⇒ Class
The class instantiated by ContainedMr::TemplateLogic#new_job.
45 46 47 |
# File 'lib/contained_mr/template.rb', line 45 def job_class ContainedMr::Job end |