Class: Rubadoop::Emr::JobflowBuilder::JobSpec
- Defined in:
- lib/rubadoop/emr/jobflow_builder/job_spec.rb
Constant Summary collapse
- STREAMING_JAR_LOCATION =
'/home/hadoop/contrib/streaming/hadoop-streaming.jar'
Instance Attribute Summary collapse
-
#additional_info ⇒ Object
Returns the value of attribute additional_info.
-
#ami_version ⇒ Object
Returns the value of attribute ami_version.
-
#bootstrap_actions ⇒ Object
Returns the value of attribute bootstrap_actions.
-
#instances ⇒ Object
Returns the value of attribute instances.
-
#log_uri ⇒ Object
Returns the value of attribute log_uri.
-
#name ⇒ Object
Returns the value of attribute name.
-
#steps ⇒ Object
Returns the value of attribute steps.
-
#supported_products ⇒ Object
Returns the value of attribute supported_products.
-
#termination_protected ⇒ Object
Returns the value of attribute termination_protected.
-
#visible_to_all_users ⇒ Object
Returns the value of attribute visible_to_all_users.
Attributes inherited from BaseDsl
Instance Method Summary collapse
- #add_jar_step(name, jar, main_class = nil, &block) ⇒ Object
- #add_streaming_step(name, &block) ⇒ Object
- #keep_alive(value) ⇒ Object
- #to_create_command ⇒ Object
- #to_steps_command ⇒ Object
- #with_bootstrap_action(path, &block) ⇒ Object
- #with_instances(master_type, core_type, core_count) ⇒ Object
Methods inherited from BaseDsl
#has_param?, #initialize, #optional_param
Constructor Details
This class inherits a constructor from Rubadoop::BaseDsl
Instance Attribute Details
#additional_info ⇒ Object
Returns the value of attribute additional_info.
5 6 7 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 5 def additional_info @additional_info end |
#ami_version ⇒ Object
Returns the value of attribute ami_version.
5 6 7 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 5 def ami_version @ami_version end |
#bootstrap_actions ⇒ Object
Returns the value of attribute bootstrap_actions.
5 6 7 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 5 def bootstrap_actions @bootstrap_actions end |
#instances ⇒ Object
Returns the value of attribute instances.
5 6 7 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 5 def instances @instances end |
#log_uri ⇒ Object
Returns the value of attribute log_uri.
5 6 7 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 5 def log_uri @log_uri end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 5 def name @name end |
#steps ⇒ Object
Returns the value of attribute steps.
5 6 7 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 5 def steps @steps end |
#supported_products ⇒ Object
Returns the value of attribute supported_products.
5 6 7 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 5 def supported_products @supported_products end |
#termination_protected ⇒ Object
Returns the value of attribute termination_protected.
6 7 8 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 6 def termination_protected @termination_protected end |
#visible_to_all_users ⇒ Object
Returns the value of attribute visible_to_all_users.
6 7 8 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 6 def visible_to_all_users @visible_to_all_users end |
Instance Method Details
#add_jar_step(name, jar, main_class = nil, &block) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 35 def add_jar_step(name, jar, main_class = nil, &block) builder = Step::Java.new(params, jar, main_class) builder.name = name if block_given? if block.arity == 1 yield builder else builder.instance_eval &block end end (@steps ||= []) << builder.to_h end |
#add_streaming_step(name, &block) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 48 def add_streaming_step(name, &block) builder = Step::Streaming.new(params, STREAMING_JAR_LOCATION) builder.name = name if block_given? if block.arity == 1 yield builder else builder.instance_eval &block end end (@steps ||= []) << builder.to_h end |
#keep_alive(value) ⇒ Object
29 30 31 32 33 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 29 def keep_alive(value) raise 'keep_alive value must be true/false' unless !!value == value @instances ||= {} @instances[:keep_job_flow_alive_when_no_steps] = value end |
#to_create_command ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 61 def to_create_command built = {} [:additional_info, :ami_version, :log_uri, :name, :bootstrap_actions, :instances, :supported_products].each do |attr| attr_value = self.instance_variable_get("@#{attr}") built[attr] = attr_value unless attr_value.nil? end built end |
#to_steps_command ⇒ Object
71 72 73 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 71 def to_steps_command @steps end |
#with_bootstrap_action(path, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 10 def with_bootstrap_action(path, &block) builder = BootstrapAction.new(params, path) if block_given? if block.arity == 1 yield builder else builder.instance_eval &block end end (@bootstrap_actions ||= []) << builder.to_h end |
#with_instances(master_type, core_type, core_count) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/rubadoop/emr/jobflow_builder/job_spec.rb', line 22 def with_instances(master_type, core_type, core_count) @instances ||= {} @instances[:master_instance_type] = master_type @instances[:slave_instance_type] = core_type @instances[:instance_count] = core_count + 1 end |