Class: Commands::LogsCommand
- Inherits:
-
AbstractSSHCommand
- Object
- Command
- AbstractSSHCommand
- Commands::LogsCommand
- Defined in:
- lib/commands.rb
Constant Summary collapse
- INTERESTING_STEP_STATES =
['RUNNING', 'COMPLETED', 'FAILED']
Constants inherited from AbstractSSHCommand
AbstractSSHCommand::CLOSED_DOWN_STATES, AbstractSSHCommand::WAITING_OR_RUNNING_STATES
Instance Attribute Summary collapse
-
#step_index ⇒ Object
Returns the value of attribute step_index.
Attributes inherited from AbstractSSHCommand
#dest, #hostname, #jobflow_detail, #jobflow_id, #key_pair_file, #no_wait
Attributes inherited from Command
#arg, #commands, #description, #logger, #name
Instance Method Summary collapse
Methods inherited from AbstractSSHCommand
#exec, #get_scp_opts, #get_ssh_opts, #initialize, #opts, #wait_for_jobflow
Methods inherited from Command
#get_field, #has_value, #have, #initialize, #option, #require, #require_single_jobflow, #resolve, #validate
Constructor Details
This class inherits a constructor from Commands::AbstractSSHCommand
Instance Attribute Details
#step_index ⇒ Object
Returns the value of attribute step_index.
690 691 692 |
# File 'lib/commands.rb', line 690 def step_index @step_index end |
Instance Method Details
#enact(client) ⇒ Object
694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 |
# File 'lib/commands.rb', line 694 def enact(client) super(client) # find the last interesting step if that exists if get_field(:step_index) == nil then steps = resolve(jobflow_detail, "Steps") self.step_index = (0 ... steps.size).select { |index| INTERESTING_STEP_STATES.include?(resolve(steps, index, 'ExecutionStatusDetail', 'State')) }.last + 1 end if get_field(:step_index) then logger.puts "Listing steps for step #{get_field(:step_index)}" exec "ssh -i #{key_pair_file} hadoop@#{hostname} cat /mnt/var/log/hadoop/steps/#{get_field(:step_index)}/{syslog,stderr,stdout}" else raise RuntimeError, "No steps that could have logs found in jobflow" end end |