Class: Elasticity::HiveStep
- Inherits:
-
Object
- Object
- Elasticity::HiveStep
- Includes:
- JobFlowStep
- Defined in:
- lib/elasticity/hive_step.rb
Instance Attribute Summary collapse
-
#action_on_failure ⇒ Object
Returns the value of attribute action_on_failure.
-
#name ⇒ Object
Returns the value of attribute name.
-
#script ⇒ Object
Returns the value of attribute script.
-
#variables ⇒ Object
Returns the value of attribute variables.
Class Method Summary collapse
- .aws_installation_step_name ⇒ Object
- .aws_installation_steps ⇒ Object
- .requires_installation? ⇒ Boolean
Instance Method Summary collapse
-
#initialize(script) ⇒ HiveStep
constructor
A new instance of HiveStep.
- #to_aws_step(_) ⇒ Object
Methods included from JobFlowStep
#aws_installation_step_name, #aws_installation_steps, included, #requires_installation?, steps_requiring_installation
Constructor Details
permalink #initialize(script) ⇒ HiveStep
Returns a new instance of HiveStep.
12 13 14 15 16 17 |
# File 'lib/elasticity/hive_step.rb', line 12 def initialize(script) @name = "Elasticity Hive Step (#{script})" @script = script @variables = {} @action_on_failure = 'TERMINATE_JOB_FLOW' end |
Instance Attribute Details
permalink #action_on_failure ⇒ Object
Returns the value of attribute action_on_failure.
10 11 12 |
# File 'lib/elasticity/hive_step.rb', line 10 def action_on_failure @action_on_failure end |
permalink #name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/elasticity/hive_step.rb', line 7 def name @name end |
permalink #script ⇒ Object
Returns the value of attribute script.
8 9 10 |
# File 'lib/elasticity/hive_step.rb', line 8 def script @script end |
permalink #variables ⇒ Object
Returns the value of attribute variables.
9 10 11 |
# File 'lib/elasticity/hive_step.rb', line 9 def variables @variables end |
Class Method Details
permalink .aws_installation_step_name ⇒ Object
[View source]
39 40 41 |
# File 'lib/elasticity/hive_step.rb', line 39 def self.aws_installation_step_name 'Elasticity - Install Hive' end |
permalink .aws_installation_steps ⇒ Object
[View source]
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/elasticity/hive_step.rb', line 43 def self.aws_installation_steps steps = [ { :action_on_failure => 'TERMINATE_JOB_FLOW', :hadoop_jar_step => { :jar => 's3://elasticmapreduce/libs/script-runner/script-runner.jar', :args => %w(s3://elasticmapreduce/libs/hive/hive-script --base-path s3://elasticmapreduce/libs/hive/ --install-hive --hive-versions latest) }, :name => aws_installation_step_name } ] if Elasticity.configuration.hive_site steps << { :action_on_failure => 'TERMINATE_JOB_FLOW', :hadoop_jar_step => { :jar => 's3://elasticmapreduce/libs/script-runner/script-runner.jar', :args => [ 's3://elasticmapreduce/libs/hive/hive-script', '--base-path', 's3://elasticmapreduce/libs/hive/', '--install-hive-site', "--hive-site=#{Elasticity.configuration.hive_site}", '--hive-versions', 'latest' ], }, :name => 'Elasticity - Configure Hive via Hive Site' } end steps end |
permalink .requires_installation? ⇒ Boolean
35 36 37 |
# File 'lib/elasticity/hive_step.rb', line 35 def self.requires_installation? true end |
Instance Method Details
permalink #to_aws_step(_) ⇒ Object
[View source]
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/elasticity/hive_step.rb', line 19 def to_aws_step(_) args = %w(s3://elasticmapreduce/libs/hive/hive-script --base-path s3://elasticmapreduce/libs/hive/ --hive-versions latest --run-hive-script --args) args.concat(['-f', @script]) @variables.keys.sort.each do |name| args.concat(['-d', "#{name}=#{@variables[name]}"]) end { :name => @name, :action_on_failure => @action_on_failure, :hadoop_jar_step => { :jar => 's3://elasticmapreduce/libs/script-runner/script-runner.jar', :args => args } } end |