Sha256: 60ea4015e1e22d070688e4294aa92a63054ddf7c332db4e6c1d77dc1a5ec0932

Contents?: true

Size: 1.82 KB

Versions: 13

Compression:

Stored size: 1.82 KB

Contents

module Elasticity

  class ClusterStepStatus

    attr_accessor :action_on_failure
    attr_accessor :args
    attr_accessor :jar
    attr_accessor :main_class
    attr_accessor :properties
    attr_accessor :step_id
    attr_accessor :name
    attr_accessor :state
    attr_accessor :state_change_reason
    attr_accessor :state_change_reason_message
    attr_accessor :created_at
    attr_accessor :started_at
    attr_accessor :ended_at

    # Constructed from http://docs.aws.amazon.com/ElasticMapReduce/latest/API/API_ListSteps.html
    def self.from_aws_list_data(cluster_step_data)
      cluster_step_data['Steps'].map do |s|
        ClusterStepStatus.new.tap do |c|
          c.action_on_failure = s['ActionOnFailure']
          c.args = s['Config']['Args']
          c.jar = s['Config']['Jar']
          c.main_class = s['Config']['MainClass']
          c.properties = s['Config']['Properties']
          c.step_id = s['Id']
          c.name = s['Name']
          c.state = s['Status']['State']
          c.state_change_reason = s['Status']['StateChangeReason']['Code']
          c.state_change_reason_message = s['Status']['StateChangeReason']['Message']
          c.created_at = Time.at(s['Status']['Timeline']['CreationDateTime'])
          c.started_at = s['Status']['Timeline']['StartDateTime'] ? Time.at(s['Status']['Timeline']['StartDateTime']) : nil
          c.ended_at   = s['Status']['Timeline']['EndDateTime'] ? Time.at(s['Status']['Timeline']['EndDateTime']) : nil
        end
      end
    end

    def self.installed_steps(cluster_step_statuses)
      step_names = cluster_step_statuses.map(&:name)
      installed_steps = []
      Elasticity::JobFlowStep.steps_requiring_installation.each do |step|
        installed_steps << step if step_names.include?(step.aws_installation_step_name)
      end
      installed_steps
    end

  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
elasticity-6.0.14 lib/elasticity/cluster_step_status.rb
elasticity-6.0.13 lib/elasticity/cluster_step_status.rb
elasticity-6.0.12 lib/elasticity/cluster_step_status.rb
elasticity-6.0.11 lib/elasticity/cluster_step_status.rb
elasticity-6.0.10 lib/elasticity/cluster_step_status.rb
elasticity-6.0.9 lib/elasticity/cluster_step_status.rb
elasticity-6.0.8 lib/elasticity/cluster_step_status.rb
elasticity-6.0.7 lib/elasticity/cluster_step_status.rb
elasticity-6.0.6 lib/elasticity/cluster_step_status.rb
elasticity-6.0.5 lib/elasticity/cluster_step_status.rb
elasticity-6.0.4 lib/elasticity/cluster_step_status.rb
elasticity-6.0.3 lib/elasticity/cluster_step_status.rb
elasticity-6.0.2 lib/elasticity/cluster_step_status.rb