Class: Stax::Cmd::Emr
Constant Summary
collapse
- COLORS =
{
RUNNING: :green,
WAITING: :green,
TERMINATING: :red,
TERMINATED: :red,
TERMINATED_WITH_ERRORS: :red,
}
Instance Method Summary
collapse
Methods inherited from SubCommand
#info, stax_info, stax_info_tasks
Instance Method Details
#describe ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/stax/mixin/emr.rb', line 38
def describe
stack_emr_clusters.each do |r|
Aws::Emr.describe(r.physical_resource_id).tap do |c|
puts YAML.dump(stringify_keys(c.to_hash))
end
end
end
|
#groups ⇒ Object
47
48
49
50
51
52
53
54
|
# File 'lib/stax/mixin/emr.rb', line 47
def groups
stack_emr_clusters.each do |r|
debug("Instance groups for #{r.logical_resource_id} #{r.physical_resource_id}")
print_table Aws::Emr.groups(r.physical_resource_id).map { |g|
[g.id, color(g.status.state, COLORS), g.name, g.instance_type, g.running_instance_count, g.market]
}
end
end
|
#instances ⇒ Object
57
58
59
60
61
62
63
64
65
|
# File 'lib/stax/mixin/emr.rb', line 57
def instances
stack_emr_clusters.each do |r|
debug("Instances for #{r.logical_resource_id} #{r.physical_resource_id}")
group_names = Aws::Emr.groups(r.physical_resource_id).each_with_object({}) { |g,h| h[g.id] = g.name }
print_table Aws::Emr.instances(r.physical_resource_id).map { |i|
[i.id, i.ec2_instance_id, group_names[i.instance_group_id], i.instance_type, color(i.status.state, COLORS), i.public_ip_address]
}
end
end
|
#status ⇒ Object
30
31
32
33
34
35
|
# File 'lib/stax/mixin/emr.rb', line 30
def status
print_table stack_emr_clusters.map { |r|
c = Aws::Emr.describe(r.physical_resource_id)
[color(c.status.state, COLORS), c.status.state_change_reason.message]
}
end
|