Class: Commands::PigInteractiveCommand

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

Instance Attribute Summary

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 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



371
372
373
374
375
# File 'lib/commands.rb', line 371

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

Instance Method Details

#jobflow_has_install_step(jobflow) ⇒ Object



389
390
391
392
393
394
395
396
# File 'lib/commands.rb', line 389

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-pig")
  end
  return install_steps.size > 0
end

#stepsObject



377
378
379
380
381
382
383
384
385
386
387
# File 'lib/commands.rb', line 377

def steps
  step = {
    "Name"            => get_field(:step_name, "Setup Pig"),
    "ActionOnFailure" => get_field(:step_action, "TERMINATE_JOB_FLOW"),
    "HadoopJarStep"   => {
      "Jar" => get_field(:script_runner_path),
      "Args" => get_field(:pig_cmd) + ["--install-pig"] + extra_args
    }
  }
  return [ step ]  
end