elastic-mapreduce 0.0.3 → 2011.11.23
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.
- data/.gitmodules +3 -0
- data/CHANGELOG +9 -0
- data/LICENSE.txt +513 -160
- data/NOTICE.txt +3 -3
- data/README +4 -2
- data/README.header +8 -0
- data/Rakefile +37 -0
- data/VERSION +1 -1
- data/bin/elastic-mapreduce +1 -22
- data/elastic-mapreduce.gemspec +18 -13
- data/lib/amazon/coral/call.rb +1 -1
- data/lib/amazon/coral/httpdestinationhandler.rb +1 -1
- data/lib/amazon/coral/httphandler.rb +1 -1
- data/lib/amazon/coral/querystringmap.rb +2 -3
- data/lib/amazon/retry_delegator.rb +2 -2
- data/lib/client.rb +3 -1
- data/lib/commands.rb +82 -38
- data/lib/elastic-mapreduce-cli.rb +24 -0
- data/lib/run_tests.rb +8 -0
- data/lib/uuidtools.rb +592 -573
- data/lib/uuidtools/version.rb +3 -3
- data/tests/commands_test.rb +10 -0
- metadata +41 -40
data/NOTICE.txt
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
Copyright 2008-
|
1
|
+
Copyright 2008-2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
2
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License").
|
4
4
|
You may not use this file except in compliance with the License. A
|
5
5
|
copy of the License is located at
|
6
6
|
|
7
7
|
http://aws.amazon.com/apache2.0/
|
8
8
|
|
9
|
-
or in the
|
9
|
+
or in the "license" file accompanying this file. This file is
|
10
10
|
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
11
11
|
OF ANY KIND, either express or implied. See the License for the
|
12
12
|
specific language governing permissions and limitations under the
|
data/README
CHANGED
@@ -4,7 +4,9 @@
|
|
4
4
|
$ gem install elastic-mapreduce
|
5
5
|
$ elastic-mapreduce --help
|
6
6
|
|
7
|
-
|
7
|
+
== Original Readme
|
8
|
+
|
9
|
+
= Amazon Elastic Map Reduce Ruby Client Readme
|
8
10
|
|
9
11
|
Location of the Ruby Client:
|
10
12
|
|
@@ -132,7 +134,7 @@ http://aws.amazon.com website under "Your Account/Access Identifiers"
|
|
132
134
|
"private-key": "<insert your AWS secret access key here>",
|
133
135
|
"key-pair": "<insert the name of your Amazon ec2 key-pair here>",
|
134
136
|
"key-pair-file": "<insert the path to the .pem file for your Amazon ec2 key pair here>",
|
135
|
-
"region": "<The region where you wish to launch your job flows. Should be one of us-east-1, us-west-1, eu-west-1, ap-southeast-1 or ap-northeast-1>"
|
137
|
+
"region": "<The region where you wish to launch your job flows. Should be one of us-east-1, us-west-1, us-west-2, eu-west-1, ap-southeast-1, or ap-northeast-1, sa-east-1>"
|
136
138
|
}
|
137
139
|
|
138
140
|
Windows Users: If you are running a Windows computer then create a
|
data/README.header
ADDED
data/Rakefile
CHANGED
@@ -25,6 +25,43 @@ Jeweler::Tasks.new do |gem|
|
|
25
25
|
end
|
26
26
|
Jeweler::RubygemsDotOrgTasks.new
|
27
27
|
|
28
|
+
require 'fileutils'
|
29
|
+
|
30
|
+
desc 'update files from original git repository'
|
31
|
+
task :update do
|
32
|
+
system 'git submodule update --init'
|
33
|
+
include FileUtils
|
34
|
+
|
35
|
+
rm_r('lib')
|
36
|
+
mkdir_p('lib')
|
37
|
+
|
38
|
+
target_dir = 'vendor/elastic-mapreduce-ruby/'
|
39
|
+
|
40
|
+
Dir.glob(target_dir + '*').each do |file|
|
41
|
+
case file
|
42
|
+
when /\/(amazon|json|uuidtools|.*\.rb|cacert\.pem)$/
|
43
|
+
cp_r(file, 'lib/')
|
44
|
+
when /\/elastic-mapreduce$/
|
45
|
+
cp_r(file, 'bin/')
|
46
|
+
else
|
47
|
+
cp_r(file, '.')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
readme = File.read('README')
|
52
|
+
File.open('README', 'w') {|f|
|
53
|
+
f.puts File.read('README.header')
|
54
|
+
f.puts readme
|
55
|
+
}
|
56
|
+
|
57
|
+
last_changelog_date = File.read('CHANGELOG').scan(/^==\s+(\d+-\d+-\d+)/m).flatten.last
|
58
|
+
open('VERSION', 'w') {|f|
|
59
|
+
f.puts last_changelog_date.gsub('-', '.')
|
60
|
+
}
|
61
|
+
|
62
|
+
Rake::Task["gemspec:generate"].invoke
|
63
|
+
end
|
64
|
+
|
28
65
|
require 'rake/testtask'
|
29
66
|
Rake::TestTask.new(:test) do |test|
|
30
67
|
test.libs << 'lib' << 'test'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2011.11.23
|
data/bin/elastic-mapreduce
CHANGED
@@ -3,25 +3,4 @@
|
|
3
3
|
# Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4
4
|
|
5
5
|
$LOAD_PATH.unshift File.dirname(__FILE__)
|
6
|
-
|
7
|
-
require 'commands'
|
8
|
-
require 'simple_logger'
|
9
|
-
require 'simple_executor'
|
10
|
-
|
11
|
-
exit_code = 0
|
12
|
-
begin
|
13
|
-
logger = SimpleLogger.new
|
14
|
-
executor = SimpleExecutor.new
|
15
|
-
commands = Commands::create_and_execute_commands(
|
16
|
-
ARGV, Amazon::Coral::ElasticMapReduceClient, logger, executor
|
17
|
-
)
|
18
|
-
rescue SystemExit => e
|
19
|
-
exit_code = -1
|
20
|
-
rescue Exception => e
|
21
|
-
STDERR.puts("Error: " + e.message)
|
22
|
-
STDERR.puts(e.backtrace.join("\n"))
|
23
|
-
exit_code = -1
|
24
|
-
end
|
25
|
-
|
26
|
-
exit(exit_code)
|
27
|
-
|
6
|
+
require 'elastic-mapreduce-cli'
|
data/elastic-mapreduce.gemspec
CHANGED
@@ -4,26 +4,29 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "
|
7
|
+
s.name = "elastic-mapreduce"
|
8
|
+
s.version = "2011.11.23"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
15
|
-
s.executables = [
|
11
|
+
s.authors = ["Amazon.com", "Koichi Fujikawa"]
|
12
|
+
s.date = "2012-06-28"
|
13
|
+
s.description = "Original is official but this is Unofficial gem."
|
14
|
+
s.email = "fujibee@hapyrus.com"
|
15
|
+
s.executables = ["elastic-mapreduce"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE.txt",
|
18
|
-
"README"
|
18
|
+
"README",
|
19
|
+
"README.header"
|
19
20
|
]
|
20
21
|
s.files = [
|
22
|
+
".gitmodules",
|
21
23
|
"CHANGELOG",
|
22
24
|
"Gemfile",
|
23
25
|
"Gemfile.lock",
|
24
26
|
"LICENSE.txt",
|
25
27
|
"NOTICE.txt",
|
26
28
|
"README",
|
29
|
+
"README.header",
|
27
30
|
"Rakefile",
|
28
31
|
"VERSION",
|
29
32
|
"bin/elastic-mapreduce",
|
@@ -63,9 +66,11 @@ Gem::Specification.new do |s|
|
|
63
66
|
"lib/commands.rb",
|
64
67
|
"lib/credentials.rb",
|
65
68
|
"lib/ec2_client_wrapper.rb",
|
69
|
+
"lib/elastic-mapreduce-cli.rb",
|
66
70
|
"lib/json.rb",
|
67
71
|
"lib/json/lexer.rb",
|
68
72
|
"lib/json/objects.rb",
|
73
|
+
"lib/run_tests.rb",
|
69
74
|
"lib/simple_executor.rb",
|
70
75
|
"lib/simple_logger.rb",
|
71
76
|
"lib/uuidtools.rb",
|
@@ -78,11 +83,11 @@ Gem::Specification.new do |s|
|
|
78
83
|
"tests/credentials.json",
|
79
84
|
"tests/example.json"
|
80
85
|
]
|
81
|
-
s.homepage =
|
82
|
-
s.licenses = [
|
83
|
-
s.require_paths = [
|
84
|
-
s.rubygems_version =
|
85
|
-
s.summary =
|
86
|
+
s.homepage = "http://github.com/hapyrus/elastic-mapreduce"
|
87
|
+
s.licenses = ["Apache License"]
|
88
|
+
s.require_paths = ["lib"]
|
89
|
+
s.rubygems_version = "1.8.15"
|
90
|
+
s.summary = "Amazon's commandline client for EMR (Elastic Map-Reduce) invocation (Unofficial Gem and Ruby 1.9 Version)"
|
86
91
|
|
87
92
|
if s.respond_to? :specification_version then
|
88
93
|
s.specification_version = 3
|
data/lib/amazon/coral/call.rb
CHANGED
@@ -40,7 +40,7 @@ module Amazon
|
|
40
40
|
# Invoke the remote service and return the result.
|
41
41
|
def call(input = {})
|
42
42
|
begin
|
43
|
-
@request_id = UUID.random_create if @request_id.nil?
|
43
|
+
@request_id = UUIDTools::UUID.random_create if @request_id.nil?
|
44
44
|
|
45
45
|
return @dispatcher.dispatch(self, input)
|
46
46
|
rescue Timeout::Error => timeout
|
@@ -41,7 +41,7 @@ module Amazon
|
|
41
41
|
@timeout = args[:timeout]
|
42
42
|
|
43
43
|
@connect_timeout = 5.0 if @connect_timeout.nil?
|
44
|
-
@timeout =
|
44
|
+
@timeout = 120.0 if @timeout.nil?
|
45
45
|
|
46
46
|
raise ArgumentError, "connect_timeout must be non-negative" if @connect_timeout < 0
|
47
47
|
raise ArgumentError, "timeout must be non-negative" if @timeout < 0
|
@@ -47,7 +47,7 @@ module Amazon
|
|
47
47
|
return if obj.nil?
|
48
48
|
|
49
49
|
case obj
|
50
|
-
when Hash
|
50
|
+
when Hash then
|
51
51
|
|
52
52
|
obj.each_pair { |k,v|
|
53
53
|
stack.push(k)
|
@@ -55,7 +55,7 @@ module Amazon
|
|
55
55
|
stack.pop
|
56
56
|
}
|
57
57
|
|
58
|
-
when Array
|
58
|
+
when Array then
|
59
59
|
|
60
60
|
# Do artificial list member wrapping (Coral requires this
|
61
61
|
# level of indirection, but doesn't validate the member name)
|
@@ -69,7 +69,6 @@ module Amazon
|
|
69
69
|
}
|
70
70
|
|
71
71
|
stack.pop
|
72
|
-
|
73
72
|
else
|
74
73
|
|
75
74
|
# this works for symbols also, because sym.id2name == sym.to_s
|
@@ -48,7 +48,7 @@ module Amazon
|
|
48
48
|
rescue Exception => e
|
49
49
|
if retries_remaining > 0 && is_retry_exception(e) then
|
50
50
|
if @log != nil then
|
51
|
-
@log.info "Exception #{e} while calling #{method} on #{@client.class}, retrying in #{@backoff_seconds * backoff_mult} seconds."
|
51
|
+
@log.info "Exception #{e.to_s} while calling #{method} on #{@client.class}, retrying in #{@backoff_seconds * backoff_mult} seconds."
|
52
52
|
end
|
53
53
|
sleep(@backoff_seconds * backoff_mult)
|
54
54
|
backoff_mult *= 2
|
@@ -56,7 +56,7 @@ module Amazon
|
|
56
56
|
retry
|
57
57
|
else
|
58
58
|
if @log != nil then
|
59
|
-
@log.info "Exception #{e} while calling #{method} on #{@client.class}, failing"
|
59
|
+
@log.info "Exception #{e.to_s} while calling #{method} on #{@client.class}, failing"
|
60
60
|
end
|
61
61
|
raise e
|
62
62
|
end
|
data/lib/client.rb
CHANGED
@@ -20,7 +20,9 @@ class EmrClient
|
|
20
20
|
:aws_secret_key => @options[:aws_secret_key],
|
21
21
|
:signature_algorithm => :V2,
|
22
22
|
:content_type => 'JSON',
|
23
|
-
:verbose => (@options[:verbose] != nil)
|
23
|
+
:verbose => (@options[:verbose] != nil),
|
24
|
+
:connect_timeout => 60.0,
|
25
|
+
:timeout => 160.0
|
24
26
|
}
|
25
27
|
|
26
28
|
@client = Amazon::RetryDelegator.new(
|
data/lib/commands.rb
CHANGED
@@ -10,7 +10,7 @@ require 'open3'
|
|
10
10
|
|
11
11
|
module Commands
|
12
12
|
|
13
|
-
ELASTIC_MAPREDUCE_CLIENT_VERSION = "
|
13
|
+
ELASTIC_MAPREDUCE_CLIENT_VERSION = "2011-11-23"
|
14
14
|
|
15
15
|
class Commands
|
16
16
|
attr_accessor :opts, :global_options, :commands, :logger, :executor
|
@@ -514,6 +514,11 @@ module Commands
|
|
514
514
|
|
515
515
|
GENERIC_OPTIONS = Set.new(%w(-conf -D -fs -jt -files -libjars -archives))
|
516
516
|
|
517
|
+
def initialize(*args)
|
518
|
+
super(*args)
|
519
|
+
@jobconf = []
|
520
|
+
end
|
521
|
+
|
517
522
|
def steps
|
518
523
|
timestr = Time.now.strftime("%Y-%m-%dT%H%M%S")
|
519
524
|
stream_options = []
|
@@ -574,6 +579,24 @@ module Commands
|
|
574
579
|
CLOSED_DOWN_STATES = Set.new(%w(TERMINATED SHUTTING_DOWN COMPLETED FAILED))
|
575
580
|
WAITING_OR_RUNNING_STATES = Set.new(%w(WAITING RUNNING))
|
576
581
|
|
582
|
+
def initialize(*args)
|
583
|
+
super(*args)
|
584
|
+
@ssh_opts = ["-o ServerAliveInterval=10", "-o StrictHostKeyChecking=no"]
|
585
|
+
@scp_opts = ["-r"]
|
586
|
+
end
|
587
|
+
|
588
|
+
def opts
|
589
|
+
(get_field(:ssh_opts, []) + get_field(:scp_opts, [])).join(" ")
|
590
|
+
end
|
591
|
+
|
592
|
+
def get_ssh_opts
|
593
|
+
get_field(:ssh_opts, []).join(" ")
|
594
|
+
end
|
595
|
+
|
596
|
+
def get_scp_opts
|
597
|
+
get_field(:scp_opts, []).join(" ")
|
598
|
+
end
|
599
|
+
|
577
600
|
def exec(cmd)
|
578
601
|
commands.exec(cmd)
|
579
602
|
end
|
@@ -605,7 +628,7 @@ module Commands
|
|
605
628
|
end
|
606
629
|
|
607
630
|
class SSHCommand < AbstractSSHCommand
|
608
|
-
attr_accessor :cmd
|
631
|
+
attr_accessor :cmd, :ssh_opts, :scp_opts
|
609
632
|
|
610
633
|
def initialize(*args)
|
611
634
|
super(*args)
|
@@ -618,7 +641,7 @@ module Commands
|
|
618
641
|
|
619
642
|
def enact(client)
|
620
643
|
super(client)
|
621
|
-
exec "ssh -i #{key_pair_file} hadoop@#{hostname} #{get_field(:cmd, "")}"
|
644
|
+
exec "ssh #{get_ssh_opts} -i #{key_pair_file} hadoop@#{hostname} #{get_field(:cmd, "")}"
|
622
645
|
end
|
623
646
|
end
|
624
647
|
|
@@ -626,9 +649,9 @@ module Commands
|
|
626
649
|
def enact(client)
|
627
650
|
super(client)
|
628
651
|
if get_field(:dest) then
|
629
|
-
exec "scp -i #{key_pair_file} #{@arg} hadoop@#{hostname}:#{get_field(:dest)}"
|
652
|
+
exec "scp #{self.get_scp_opts} -i #{key_pair_file} #{@arg} hadoop@#{hostname}:#{get_field(:dest)}"
|
630
653
|
else
|
631
|
-
exec "scp -i #{key_pair_file} #{@arg} hadoop@#{hostname}:#{File.basename(@arg)}"
|
654
|
+
exec "scp #{self.get_scp_opts} -i #{key_pair_file} #{@arg} hadoop@#{hostname}:#{File.basename(@arg)}"
|
632
655
|
end
|
633
656
|
end
|
634
657
|
end
|
@@ -637,9 +660,9 @@ module Commands
|
|
637
660
|
def enact(client)
|
638
661
|
super(client)
|
639
662
|
if get_field(:dest) then
|
640
|
-
exec "scp -i #{key_pair_file} hadoop@#{hostname}:#{@arg} #{get_field(:dest)}"
|
663
|
+
exec "scp #{self.get_scp_opts} -i #{key_pair_file} hadoop@#{hostname}:#{@arg} #{get_field(:dest)}"
|
641
664
|
else
|
642
|
-
exec "scp -i #{key_pair_file} hadoop@#{hostname}:#{@arg} #{File.basename(@arg)}"
|
665
|
+
exec "scp #{self.get_scp_opts} -i #{key_pair_file} hadoop@#{hostname}:#{@arg} #{File.basename(@arg)}"
|
643
666
|
end
|
644
667
|
end
|
645
668
|
end
|
@@ -757,15 +780,21 @@ module Commands
|
|
757
780
|
|
758
781
|
class CreateJobFlowCommand < StepProcessingCommand
|
759
782
|
attr_accessor :jobflow_name, :alive, :with_termination_protection, :instance_count, :slave_instance_type,
|
760
|
-
:master_instance_type, :key_pair, :key_pair_file, :log_uri, :az, :ainfo,
|
783
|
+
:master_instance_type, :key_pair, :key_pair_file, :log_uri, :az, :ainfo, :ami_version, :with_supported_products,
|
761
784
|
:hadoop_version, :plain_output, :instance_type,
|
762
|
-
:instance_group_commands, :bootstrap_commands
|
785
|
+
:instance_group_commands, :bootstrap_commands, :subnet_id
|
763
786
|
|
764
787
|
|
765
788
|
OLD_OPTIONS = [:instance_count, :slave_instance_type, :master_instance_type]
|
766
789
|
# FIXME: add code to setup collapse instance group commands
|
767
790
|
|
768
|
-
|
791
|
+
def default_hadoop_version
|
792
|
+
if get_field(:ami_version) == "1.0" then
|
793
|
+
"0.20"
|
794
|
+
else
|
795
|
+
"0.20.205"
|
796
|
+
end
|
797
|
+
end
|
769
798
|
|
770
799
|
def initialize(*args)
|
771
800
|
super(*args)
|
@@ -796,9 +825,6 @@ module Commands
|
|
796
825
|
cmd.validate
|
797
826
|
end
|
798
827
|
|
799
|
-
if ! have(:hadoop_version) then
|
800
|
-
@hadoop_version = DEFAULT_HADOOP_VERSION
|
801
|
-
end
|
802
828
|
end
|
803
829
|
|
804
830
|
def enact(client)
|
@@ -809,6 +835,10 @@ module Commands
|
|
809
835
|
apply_jobflow_option(:hadoop_version, "Instances", "HadoopVersion")
|
810
836
|
apply_jobflow_option(:az, "Instances", "Placement", "AvailabilityZone")
|
811
837
|
apply_jobflow_option(:log_uri, "LogUri")
|
838
|
+
apply_jobflow_option(:ami_version, "AmiVersion")
|
839
|
+
apply_jobflow_option(:subnet_id, "Instances", "Ec2SubnetId")
|
840
|
+
|
841
|
+
@jobflow["AmiVersion"] ||= "latest"
|
812
842
|
|
813
843
|
self.step_commands = reorder_steps(@jobflow, self.step_commands)
|
814
844
|
@jobflow["Steps"] = step_commands.map { |x| x.steps }.flatten
|
@@ -836,7 +866,7 @@ module Commands
|
|
836
866
|
|
837
867
|
def apply_jobflow_option(field_symbol, *keys)
|
838
868
|
value = get_field(field_symbol)
|
839
|
-
if value != nil then
|
869
|
+
if value != nil then
|
840
870
|
map = @jobflow
|
841
871
|
for key in keys[0..-2] do
|
842
872
|
nmap = map[key]
|
@@ -899,6 +929,12 @@ module Commands
|
|
899
929
|
"Steps" => [],
|
900
930
|
"BootstrapActions" => []
|
901
931
|
}
|
932
|
+
products_string = get_field(:with_supported_products)
|
933
|
+
if products_string then
|
934
|
+
products = products_string.split(/,/).map { |s| s.strip }
|
935
|
+
@jobflow["SupportedProducts"] = products
|
936
|
+
end
|
937
|
+
@jobflow
|
902
938
|
end
|
903
939
|
|
904
940
|
def default_job_flow_name
|
@@ -931,7 +967,7 @@ module Commands
|
|
931
967
|
end
|
932
968
|
|
933
969
|
class AbstractListCommand < Command
|
934
|
-
attr_accessor :state, :max_results, :active, :all, :no_steps
|
970
|
+
attr_accessor :state, :max_results, :active, :all, :no_steps, :created_after, :created_before
|
935
971
|
|
936
972
|
def enact(client)
|
937
973
|
options = {}
|
@@ -942,15 +978,17 @@ module Commands
|
|
942
978
|
if get_field(:active) then
|
943
979
|
states = %w(RUNNING SHUTTING_DOWN STARTING WAITING BOOTSTRAPPING)
|
944
980
|
end
|
945
|
-
if get_field(:
|
946
|
-
states
|
981
|
+
if get_field(:state) then
|
982
|
+
states << get_field(:state)
|
947
983
|
end
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
options = { }
|
984
|
+
|
985
|
+
if get_field(:all) then
|
986
|
+
options = { 'CreatedAfter' => (Time.now - (58 * 24 * 3600)).xmlschema }
|
952
987
|
else
|
953
|
-
options = {
|
988
|
+
options = {}
|
989
|
+
options['CreatedAfter'] = get_field(:created_after) if get_field(:created_after)
|
990
|
+
options['CreatedBefore'] = get_field(:created_before) if get_field(:created_before)
|
991
|
+
options['JobFlowStates'] = states if states.size > 0
|
954
992
|
end
|
955
993
|
end
|
956
994
|
result = client.describe_jobflow(options)
|
@@ -1318,6 +1356,19 @@ module Commands
|
|
1318
1356
|
end
|
1319
1357
|
end
|
1320
1358
|
|
1359
|
+
def region_from_az(az)
|
1360
|
+
md = az.match(/((\w+-)+\d+)\w+/)
|
1361
|
+
if md then
|
1362
|
+
md[1]
|
1363
|
+
else
|
1364
|
+
raise "Unable to convert Availability Zone '#{az}' to region"
|
1365
|
+
end
|
1366
|
+
end
|
1367
|
+
|
1368
|
+
def ec2_endpoint_from_az(az)
|
1369
|
+
return "https://ec2.#{region_from_az(az)}.amazonaws.com"
|
1370
|
+
end
|
1371
|
+
|
1321
1372
|
def enact(client)
|
1322
1373
|
self.jobflow_id = require_single_jobflow
|
1323
1374
|
self.jobflow_detail = client.describe_jobflow_with_id(self.jobflow_id)
|
@@ -1330,21 +1381,9 @@ module Commands
|
|
1330
1381
|
exit(-1)
|
1331
1382
|
end
|
1332
1383
|
|
1333
|
-
ec2_endpoint = "https://ec2.amazonaws.com"
|
1334
1384
|
az = self.jobflow_detail['Instances']['Placement']['AvailabilityZone']
|
1335
|
-
|
1336
|
-
|
1337
|
-
ec2_endpoint = "https://ec2.us-east-1.amazonaws.com"
|
1338
|
-
elsif az[0, reg_length] == "us-west-1" then
|
1339
|
-
ec2_endpoint = "https://ec2.us-west-1.amazonaws.com"
|
1340
|
-
elsif az[0, reg_length] == "eu-west-1" then
|
1341
|
-
ec2_endpoint = "https://ec2.eu-west-1.amazonaws.com"
|
1342
|
-
elsif az[0, reg_length] == "ap-southeast-1" then
|
1343
|
-
ec2_endpoint = "https://ec2.ap-southeast-1.amazonaws.com"
|
1344
|
-
elsif az[0, reg_length] == "ap-northeast-1" then
|
1345
|
-
ec2_endpoint = "https://ec2.ap-northeast-1.amazonaws.com"
|
1346
|
-
end
|
1347
|
-
commands.global_options[:ec2_endpoint] = ec2_endpoint
|
1385
|
+
|
1386
|
+
commands.global_options[:ec2_endpoint] = ec2_endpoint_from_az(az)
|
1348
1387
|
|
1349
1388
|
self.key_pair_file = require(:key_pair_file, "Missing required option --key-pair-file for #{name}")
|
1350
1389
|
eip = get_field(:arg)
|
@@ -1394,14 +1433,17 @@ module Commands
|
|
1394
1433
|
[ OptionWithArg, "--name NAME", "The name of the job flow being created", :jobflow_name ],
|
1395
1434
|
[ FlagOption, "--alive", "Create a job flow that stays running even though it has executed all its steps", :alive ],
|
1396
1435
|
[ OptionWithArg, "--with-termination-protection", "Create a job with termination protection (default is no termination protection)", :with_termination_protection ],
|
1436
|
+
[ OptionWithArg, "--with-supported-products PRODUCTS", "Add supported products", :with_supported_products ],
|
1397
1437
|
[ OptionWithArg, "--num-instances NUM", "Number of instances in the job flow", :instance_count ],
|
1398
1438
|
[ OptionWithArg, "--slave-instance-type TYPE", "The type of the slave instances to launch", :slave_instance_type ],
|
1399
1439
|
[ OptionWithArg, "--master-instance-type TYPE", "The type of the master instance to launch", :master_instance_type ],
|
1440
|
+
[ OptionWithArg, "--ami-version VERSION", "The version of ami to launch the job flow with", :ami_version ],
|
1400
1441
|
[ OptionWithArg, "--key-pair KEY_PAIR", "The name of your Amazon EC2 Keypair", :key_pair ],
|
1401
1442
|
[ OptionWithArg, "--availability-zone A_Z", "Specify the Availability Zone in which to launch the job flow", :az ],
|
1402
1443
|
[ OptionWithArg, "--info INFO", "Specify additional info to job flow creation", :ainfo ],
|
1403
1444
|
[ OptionWithArg, "--hadoop-version INFO", "Specify the Hadoop Version to install", :hadoop_version ],
|
1404
1445
|
[ FlagOption, "--plain-output", "Return the job flow id from create step as simple text", :plain_output ],
|
1446
|
+
[ OptionWithArg, "--subnet EC2-SUBNET_ID", "Specify the VPC subnet that you want to run in", :subnet_id ],
|
1405
1447
|
])
|
1406
1448
|
commands.parse_command(CreateInstanceGroupCommand, "--instance-group ROLE", "Specify an instance group while creating a jobflow")
|
1407
1449
|
commands.parse_options(["--instance-group", "--add-instance-group"], [
|
@@ -1441,6 +1483,7 @@ module Commands
|
|
1441
1483
|
commands.parse_command(HiveSiteCommand, "--hive-site HIVE_SITE", "Override Hive configuration with configuration from HIVE_SITE")
|
1442
1484
|
commands.parse_options(["--hive-script", "--hive-interactive", "--hive-site"], [
|
1443
1485
|
[ OptionWithArg, "--hive-versions VERSIONS", "A comma separated list of Hive version", :hive_versions],
|
1486
|
+
[ OptionWithArg, "--step-action STEP_ACTION", "Action to take when step finishes. One of CANCEL_AND_WAIT, TERMINATE_JOB_FLOW or CONTINUE", :step_action ],
|
1444
1487
|
])
|
1445
1488
|
|
1446
1489
|
opts.separator "\n Adding Jar Steps to Job Flows\n"
|
@@ -1519,7 +1562,9 @@ module Commands
|
|
1519
1562
|
commands.parse_options(["--list", "--describe"], [
|
1520
1563
|
[ OptionWithArg, "--state NAME", "Set the name of the bootstrap action", :state ],
|
1521
1564
|
[ FlagOption, "--active", "List running, starting or shutting down job flows", :active ],
|
1522
|
-
[ FlagOption, "--all", "List all job flows in the last 2
|
1565
|
+
[ FlagOption, "--all", "List all job flows in the last 2 weeks", :all ],
|
1566
|
+
[ OptionWithArg, "--created-after=DATETIME", "List all jobflows created after DATETIME (xml date time format)", :created_after],
|
1567
|
+
[ OptionWithArg, "--created-before=DATETIME", "List all jobflows created before DATETIME (xml date time format)", :created_before],
|
1523
1568
|
[ FlagOption, "--no-steps", "Do not list steps when listing jobs", :no_steps ],
|
1524
1569
|
])
|
1525
1570
|
|
@@ -1697,4 +1742,3 @@ module Commands
|
|
1697
1742
|
end
|
1698
1743
|
end
|
1699
1744
|
end
|
1700
|
-
|