Class: Awful::EMR
Constant Summary
collapse
- COLORS =
{
RUNNING: :green,
TERMINATING: :red,
TERMINATED: :red,
TERMINATED_WITH_ERRORS: :red,
}
Instance Method Summary
collapse
Methods inherited from Cli
#initialize, #ll, #version
Constructor Details
This class inherits a constructor from Awful::Cli
Instance Method Details
38
39
40
41
42
|
# File 'lib/awful/emr.rb', line 38
def dump(id)
emr.describe_cluster(cluster_id: id).cluster.output do |cluster|
puts YAML.dump(stringify_keys(cluster.to_hash))
end
end
|
#instances(id) ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/awful/emr.rb', line 47
def instances(id)
emr.list_instances(cluster_id: id, instance_group_types: options[:group].map(&:upcase)).instances.output do |instances|
if options[:long]
print_table instances.map { |i|
[i.ec2_instance_id, i.instance_group_id, color(i.status.state), i.instance_type, i.public_ip_address, i.private_ip_address, i.status.timeline.creation_date_time]
}
else
puts instances.map(&:ec2_instance_id)
end
end
end
|
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/awful/emr.rb', line 25
def ls
emr.list_clusters(cluster_states: options[:states].map(&:upcase)).clusters.output do |clusters|
if options[:long]
print_table clusters.map { |c|
[c.name, c.id, color(c.status.state), c.status.timeline.creation_date_time, "#{c.normalized_instance_hours}h"]
}
else
puts clusters.map(&:name)
end
end
end
|