Class: Elasticity::ClusterStepStatus

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#action_on_failureObject

Returns the value of attribute action_on_failure.



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

def action_on_failure
  @action_on_failure
end

#argsObject

Returns the value of attribute args.



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

def args
  @args
end

#created_atObject

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#ended_atObject

Returns the value of attribute ended_at.



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

def ended_at
  @ended_at
end

#jarObject

Returns the value of attribute jar.



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

def jar
  @jar
end

#main_classObject

Returns the value of attribute main_class.



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

def main_class
  @main_class
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#propertiesObject

Returns the value of attribute properties.



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

def properties
  @properties
end

#started_atObject

Returns the value of attribute started_at.



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

def started_at
  @started_at
end

#stateObject

Returns the value of attribute state.



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

def state
  @state
end

#state_change_reasonObject

Returns the value of attribute state_change_reason.



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

def state_change_reason
  @state_change_reason
end

#state_change_reason_messageObject

Returns the value of attribute state_change_reason_message.



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

def state_change_reason_message
  @state_change_reason_message
end

#step_idObject

Returns the value of attribute step_id.



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

def step_id
  @step_id
end

Class Method Details

.from_aws_list_data(cluster_step_data) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/elasticity/cluster_step_status.rb', line 20

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

.installed_steps(cluster_step_statuses) ⇒ Object



40
41
42
43
44
45
46
47
# File 'lib/elasticity/cluster_step_status.rb', line 40

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