awful 0.0.182 → 0.0.183
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/emr +7 -0
- data/lib/awful/emr.rb +64 -0
- data/lib/awful/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1ab2fc365e4aaccd052206843ef554704ffd86d
|
4
|
+
data.tar.gz: b4afadc9463ef855311cdea9e3e03ce6ebb3ee7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7fbe4141ddaf40a4482d9562e12fd542ac0cdd42e84093beccdbfa36fd0e9c49525566cfa030a5e561e6b94fbd674f68ba1c248e8cede2a262e870a6fb108f8
|
7
|
+
data.tar.gz: 89db4d459b0846fa4d7b2b4b7e1075a9daf7f538833e14139cdf937eb3b0212d59bfbea0ce31b0fe47545658d5a4f3877096945c2c881bae47a8d2098404f9a3
|
data/bin/emr
ADDED
data/lib/awful/emr.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
module Awful
|
2
|
+
module Short
|
3
|
+
def emr(*args)
|
4
|
+
Awful::EMR.new.invoke(*args)
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
class EMR < Cli
|
9
|
+
COLORS = {
|
10
|
+
RUNNING: :green,
|
11
|
+
TERMINATING: :red,
|
12
|
+
TERMINATED: :red,
|
13
|
+
TERMINATED_WITH_ERRORS: :red,
|
14
|
+
}
|
15
|
+
|
16
|
+
no_commands do
|
17
|
+
def emr
|
18
|
+
@emr ||= Aws::EMR::Client.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def color(string)
|
22
|
+
set_color(string, COLORS.fetch(string.to_sym, :yellow))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'ls', 'list clusters'
|
27
|
+
method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'long listing'
|
28
|
+
method_option :states, aliases: '-s', type: :array, default: [], desc: 'limit to clusters with given states'
|
29
|
+
def ls
|
30
|
+
emr.list_clusters(cluster_states: options[:states].map(&:upcase)).clusters.output do |clusters|
|
31
|
+
if options[:long]
|
32
|
+
print_table clusters.map { |c|
|
33
|
+
[c.name, c.id, color(c.status.state), c.status.timeline.creation_date_time, "#{c.normalized_instance_hours}h"]
|
34
|
+
}
|
35
|
+
else
|
36
|
+
puts clusters.map(&:name)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
desc 'dump ID', 'describe cluster with ID'
|
42
|
+
def dump(id)
|
43
|
+
emr.describe_cluster(cluster_id: id).cluster.output do |cluster|
|
44
|
+
puts YAML.dump(stringify_keys(cluster.to_hash))
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
desc 'instances', 'list instances for cluster'
|
49
|
+
method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'long listing'
|
50
|
+
method_option :group, aliases: '-g', type: :array, default: [], desc: 'instance group types: MASTER, CORE, TASK'
|
51
|
+
def instances(id)
|
52
|
+
emr.list_instances(cluster_id: id, instance_group_types: options[:group].map(&:upcase)).instances.output do |instances|
|
53
|
+
if options[:long]
|
54
|
+
print_table instances.map { |i|
|
55
|
+
[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]
|
56
|
+
}
|
57
|
+
else
|
58
|
+
puts instances.map(&:ec2_instance_id)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
data/lib/awful/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.183
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ric Lister
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -104,6 +104,7 @@ executables:
|
|
104
104
|
- eip
|
105
105
|
- elasticache
|
106
106
|
- elb
|
107
|
+
- emr
|
107
108
|
- iam
|
108
109
|
- keypair
|
109
110
|
- kms
|
@@ -152,6 +153,7 @@ files:
|
|
152
153
|
- bin/eip
|
153
154
|
- bin/elasticache
|
154
155
|
- bin/elb
|
156
|
+
- bin/emr
|
155
157
|
- bin/iam
|
156
158
|
- bin/keypair
|
157
159
|
- bin/kms
|
@@ -198,6 +200,7 @@ files:
|
|
198
200
|
- lib/awful/eip.rb
|
199
201
|
- lib/awful/elasticache.rb
|
200
202
|
- lib/awful/elb.rb
|
203
|
+
- lib/awful/emr.rb
|
201
204
|
- lib/awful/iam.rb
|
202
205
|
- lib/awful/keypair.rb
|
203
206
|
- lib/awful/kms.rb
|