Class: Commands::HiveInteractiveCommand

Inherits:
HiveCommand show all
Defined in:
lib/commands.rb

Instance Attribute Summary

Attributes inherited from HiveCommand

#hive_versions

Attributes inherited from StepCommand

#apps_path, #args, #beta_path, #enable_debugging_path, #hive_cmd, #hive_path, #pig_cmd, #pig_path, #script_runner_path, #step_action, #step_name

Attributes inherited from Command

#arg, #commands, #description, #logger, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from HiveCommand

#get_version_args

Methods inherited from StepCommand

#default_enable_debugging_path, #default_hive_cmd, #default_hive_path, #default_pig_cmd, #default_pig_path, #default_resize_jobflow_cmd, #default_script_runner_path, #ensure_install_cmd, #extra_args, #initialize, #reorder_steps, #script_args, #validate

Methods inherited from Command

#enact, #get_field, #has_value, #have, #initialize, #option, #require, #require_single_jobflow, #resolve, #validate

Constructor Details

This class inherits a constructor from Commands::StepCommand

Class Method Details

.new_from_commands(commands, parent) ⇒ Object



485
486
487
488
489
490
# File 'lib/commands.rb', line 485

def self.new_from_commands(commands, parent)
  sc = self.new("--hive-interactive", "Run a jobflow with Hive Installed", nil, commands)
  sc.hive_versions = parent.hive_versions
  sc.step_action = parent.step_action
  return sc
end

Instance Method Details

#jobflow_has_install_step(jobflow) ⇒ Object



475
476
477
478
479
480
481
482
483
# File 'lib/commands.rb', line 475

def jobflow_has_install_step(jobflow)
  install_steps = jobflow['Steps'].select do |step|
    step["ExecutionStatusDetail"]["State"] != "FAILED" &&
    has_value(step, 'StepConfig', 'HadoopJarStep', 'Jar', get_field(:script_runner_path)) &&
    has_value(step, 'StepConfig', 'HadoopJarStep', 'Args', 3, "--install-hive") &&
    has_value(step, 'StepConfig', 'HadoopJarStep', 'Args', 5, get_version_args(true)[1])
  end
  return install_steps.size > 0
end

#stepsObject



462
463
464
465
466
467
468
469
470
471
472
473
# File 'lib/commands.rb', line 462

def steps
  step = {
    "Name"            => get_field(:step_name, "Setup Hive"),
    "ActionOnFailure" => get_field(:step_action, "TERMINATE_JOB_FLOW"),
    "HadoopJarStep"   => {
      "Jar" => get_field(:script_runner_path),
      "Args" => get_field(:hive_cmd) + [ "--install-hive" ] + 
        get_version_args(false) + extra_args
    }
  }
  [ step ]
end