Sha256: 0f8c290b6c96b5e8814ff87b267b77b2753ce6e0cd1642c280b7be63afd1ec0f

Contents?: true

Size: 1.29 KB

Versions: 6

Compression:

Stored size: 1.29 KB

Contents

module Elasticity

  class JobFlowStep

    attr_accessor :name
    attr_accessor :state
    attr_accessor :started_at
    attr_accessor :ended_at

    # Create a job flow from an AWS <member> (Nokogiri::XML::Element):
    #   /DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows/member/Steps/member
    def self.from_member_element(xml_element)
      job_flow_step = JobFlowStep.new
      job_flow_step.name = xml_element.xpath("./StepConfig/Name").text.strip
      job_flow_step.state = xml_element.xpath("./ExecutionStatusDetail/State").text.strip
      started_at = xml_element.xpath("./ExecutionStatusDetail/StartDateTime").text.strip
      job_flow_step.started_at = (started_at == "") ? (nil) : (Time.parse(started_at))
      ended_at = xml_element.xpath("./ExecutionStatusDetail/EndDateTime").text.strip
      job_flow_step.ended_at = (ended_at == "") ? (nil) : (Time.parse(ended_at))
      job_flow_step
    end

    # Create JobFlowSteps from a collection of AWS <member> nodes (Nokogiri::XML::NodeSet):
    #   /DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows/member/Steps/member
    def self.from_members_nodeset(members_nodeset)
      jobflow_steps = []
      members_nodeset.each do |member|
        jobflow_steps << from_member_element(member)
      end
      jobflow_steps
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
elasticity-1.5 lib/elasticity/job_flow_step.rb
elasticity-1.4.1 lib/elasticity/job_flow_step.rb
elasticity-1.4 lib/elasticity/job_flow_step.rb
elasticity-1.3.1 lib/elasticity/job_flow_step.rb
elasticity-1.3 lib/elasticity/job_flow_step.rb
elasticity-1.2.3 lib/elasticity/job_flow_step.rb