Class: Elasticity::JobFlowStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/elasticity/job_flow_status.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeJobFlowStatus

Returns a new instance of JobFlowStatus.



19
20
21
22
# File 'lib/elasticity/job_flow_status.rb', line 19

def initialize
  @steps = []
  @installed_steps = []
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



9
10
11
# File 'lib/elasticity/job_flow_status.rb', line 9

def created_at
  @created_at
end

#installed_stepsObject

Returns the value of attribute installed_steps.



16
17
18
# File 'lib/elasticity/job_flow_status.rb', line 16

def installed_steps
  @installed_steps
end

#instance_countObject

Returns the value of attribute instance_count.



12
13
14
# File 'lib/elasticity/job_flow_status.rb', line 12

def instance_count
  @instance_count
end

#jobflow_idObject

Returns the value of attribute jobflow_id.



6
7
8
# File 'lib/elasticity/job_flow_status.rb', line 6

def jobflow_id
  @jobflow_id
end

#last_state_change_reasonObject

Returns the value of attribute last_state_change_reason.



15
16
17
# File 'lib/elasticity/job_flow_status.rb', line 15

def last_state_change_reason
  @last_state_change_reason
end

#master_instance_typeObject

Returns the value of attribute master_instance_type.



13
14
15
# File 'lib/elasticity/job_flow_status.rb', line 13

def master_instance_type
  @master_instance_type
end

#master_public_dns_nameObject

Returns the value of attribute master_public_dns_name.



17
18
19
# File 'lib/elasticity/job_flow_status.rb', line 17

def master_public_dns_name
  @master_public_dns_name
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/elasticity/job_flow_status.rb', line 5

def name
  @name
end

#ready_atObject

Returns the value of attribute ready_at.



11
12
13
# File 'lib/elasticity/job_flow_status.rb', line 11

def ready_at
  @ready_at
end

#slave_instance_typeObject

Returns the value of attribute slave_instance_type.



14
15
16
# File 'lib/elasticity/job_flow_status.rb', line 14

def slave_instance_type
  @slave_instance_type
end

#started_atObject

Returns the value of attribute started_at.



10
11
12
# File 'lib/elasticity/job_flow_status.rb', line 10

def started_at
  @started_at
end

#stateObject

Returns the value of attribute state.



7
8
9
# File 'lib/elasticity/job_flow_status.rb', line 7

def state
  @state
end

#stepsObject

Returns the value of attribute steps.



8
9
10
# File 'lib/elasticity/job_flow_status.rb', line 8

def steps
  @steps
end

Class Method Details

.from_member_element(xml_element) ⇒ Object

Create a jobflow from an AWS <member> (Nokogiri::XML::Element):

/DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows/member


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/elasticity/job_flow_status.rb', line 26

def self.from_member_element(xml_element)
  jobflow = JobFlowStatus.new

  jobflow.name = xml_element.xpath('./Name').text.strip
  jobflow.jobflow_id = xml_element.xpath('./JobFlowId').text.strip
  jobflow.state = xml_element.xpath('./ExecutionStatusDetail/State').text.strip
  jobflow.last_state_change_reason = xml_element.xpath('./ExecutionStatusDetail/LastStateChangeReason').text.strip

  jobflow.steps = JobFlowStatusStep.from_members_nodeset(xml_element.xpath('./Steps/member'))

  step_names = jobflow.steps.map(&:name)
  Elasticity::JobFlowStep.steps_requiring_installation.each do |step|
    jobflow.installed_steps << step if step_names.include?(step.aws_installation_step[:name])
  end

  jobflow.created_at = Time.parse(xml_element.xpath('./ExecutionStatusDetail/CreationDateTime').text.strip)

  started_at = xml_element.xpath('./ExecutionStatusDetail/StartDateTime').text.strip
  jobflow.started_at = (started_at == '') ? (nil) : (Time.parse(started_at))

  ready_at = xml_element.xpath('./ExecutionStatusDetail/ReadyDateTime').text.strip
  jobflow.ready_at = (ready_at == '') ? (nil) : (Time.parse(ready_at))

  jobflow.instance_count = xml_element.xpath('./Instances/InstanceCount').text.strip
  jobflow.master_instance_type = xml_element.xpath('./Instances/MasterInstanceType').text.strip
  jobflow.slave_instance_type = xml_element.xpath('./Instances/SlaveInstanceType').text.strip

  master_public_dns_name = xml_element.xpath('./Instances/MasterPublicDnsName').text.strip
  jobflow.master_public_dns_name = (master_public_dns_name == '') ? (nil) : (master_public_dns_name)

  jobflow
end

.from_members_nodeset(members_nodeset) ⇒ Object

Create JobFlows from a collection of AWS <member> nodes (Nokogiri::XML::NodeSet):

/DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows


61
62
63
64
65
66
67
# File 'lib/elasticity/job_flow_status.rb', line 61

def self.from_members_nodeset(members_nodeset)
  jobflows = []
  members_nodeset.each do |member|
    jobflows << from_member_element(member)
  end
  jobflows
end