mortar 0.15.37 → 0.15.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mortar/command/base.rb +2 -2
- data/lib/mortar/local/controller.rb +1 -1
- data/lib/mortar/local/pig.rb +7 -7
- data/lib/mortar/pigversion.rb +6 -27
- data/lib/mortar/templates/project/project.properties +2 -2
- data/lib/mortar/version.rb +1 -1
- data/spec/mortar/command/base_spec.rb +13 -13
- data/spec/mortar/command/describe_spec.rb +4 -4
- data/spec/mortar/command/illustrate_spec.rb +7 -7
- data/spec/mortar/command/jobs_spec.rb +16 -16
- data/spec/mortar/command/local_spec.rb +11 -11
- data/spec/mortar/command/validate_spec.rb +4 -4
- data/spec/mortar/local/controller_spec.rb +7 -7
- data/spec/mortar/local/pig_spec.rb +25 -26
- metadata +4 -5
- data/spec/mortar/command/spark_spec.rb +0 -154
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffc0b8718edcb166d6efb97aa313f93f62cbe05a
|
4
|
+
data.tar.gz: e50a708d63e897a055528aeb61b0a2a023c6cb78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c57ea3f3a078fd0896b92973d5bd731bdedd2024c2ddfae3f74121dce10fddef75b374c4b6f6618345f724ce79963cf501065553b7494c919627aa64815b715
|
7
|
+
data.tar.gz: b62dc6bb899b601ea4c6162a2bcdf068d47e23d13d1acf75cfefb40bcefdd757d0475d0dd91d6325b7031352ea4a3097e96a733ec65123eff2d08f4ca0d96cc0
|
data/lib/mortar/command/base.rb
CHANGED
@@ -296,7 +296,7 @@ protected
|
|
296
296
|
|
297
297
|
def self.replace_templates(help)
|
298
298
|
help.each do |line|
|
299
|
-
line.gsub!("<PIG_VERSION_OPTIONS>", "0.12
|
299
|
+
line.gsub!("<PIG_VERSION_OPTIONS>", "0.12-Hadoop-2")
|
300
300
|
end
|
301
301
|
end
|
302
302
|
|
@@ -608,7 +608,7 @@ protected
|
|
608
608
|
end
|
609
609
|
|
610
610
|
def pig_version
|
611
|
-
pig_version_str = options[:pigversion] || '0.12'
|
611
|
+
pig_version_str = options[:pigversion] || '0.12-Hadoop-2'
|
612
612
|
pig_version = Mortar::PigVersion.from_string(pig_version_str)
|
613
613
|
end
|
614
614
|
|
data/lib/mortar/local/pig.rb
CHANGED
@@ -84,7 +84,7 @@ class Mortar::Local::Pig
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def pig_directory(pig_version)
|
87
|
-
return File.join(local_install_directory, pig_version.
|
87
|
+
return File.join(local_install_directory, pig_version.pig_version)
|
88
88
|
end
|
89
89
|
|
90
90
|
def lib_directory
|
@@ -113,7 +113,7 @@ class Mortar::Local::Pig
|
|
113
113
|
# Determines if a pig install needs to occur, true if server side
|
114
114
|
# pig tgz is newer than date of the existing install
|
115
115
|
def should_do_pig_update?(pig_version, command=nil)
|
116
|
-
return is_newer_version(pig_version.
|
116
|
+
return is_newer_version(pig_version.pig_version, pig_archive_url(pig_version), command)
|
117
117
|
end
|
118
118
|
|
119
119
|
def should_do_lib_update?
|
@@ -122,11 +122,11 @@ class Mortar::Local::Pig
|
|
122
122
|
|
123
123
|
def install_or_update(pig_version, command=nil)
|
124
124
|
if should_do_pig_install?(pig_version)
|
125
|
-
action "Installing #{pig_version.
|
125
|
+
action "Installing #{pig_version.pig_version} to #{local_install_directory_name}" do
|
126
126
|
install_pig(pig_version, command)
|
127
127
|
end
|
128
128
|
elsif should_do_pig_update?(pig_version, command)
|
129
|
-
action "Updating to latest #{pig_version.
|
129
|
+
action "Updating to latest #{pig_version.pig_version} in #{local_install_directory_name}" do
|
130
130
|
install_pig(pig_version)
|
131
131
|
end
|
132
132
|
end
|
@@ -159,7 +159,7 @@ class Mortar::Local::Pig
|
|
159
159
|
FileUtils.chmod(0755, command(pig_version))
|
160
160
|
|
161
161
|
File.delete(local_tgz)
|
162
|
-
note_install(pig_version.
|
162
|
+
note_install(pig_version.pig_version)
|
163
163
|
end
|
164
164
|
|
165
165
|
def install_lib
|
@@ -323,7 +323,7 @@ class Mortar::Local::Pig
|
|
323
323
|
def template_params_classpath(pig_version=nil)
|
324
324
|
# Need to support old watchtower plugins that don't set pig_version
|
325
325
|
if pig_version.nil?
|
326
|
-
pig_version = Mortar::PigVersion::
|
326
|
+
pig_version = Mortar::PigVersion::Pig012Hadoop2.new
|
327
327
|
end
|
328
328
|
[ "#{pig_directory(pig_version)}/*",
|
329
329
|
"#{pig_directory(pig_version)}/lib-local/*",
|
@@ -362,7 +362,7 @@ class Mortar::Local::Pig
|
|
362
362
|
def pig_command_script_template_parameters(cmd, pig_version, pig_parameters)
|
363
363
|
template_params = {}
|
364
364
|
template_params['pig_params_file'] = make_pig_param_file(pig_parameters)
|
365
|
-
template_params['pig_dir'] = pig_version.
|
365
|
+
template_params['pig_dir'] = pig_version.pig_version
|
366
366
|
template_params['pig_home'] = pig_directory(pig_version)
|
367
367
|
template_params['pig_classpath'] = pig_classpath(pig_version)
|
368
368
|
template_params['classpath'] = template_params_classpath
|
data/lib/mortar/pigversion.rb
CHANGED
@@ -16,41 +16,16 @@
|
|
16
16
|
|
17
17
|
module Mortar
|
18
18
|
module PigVersion
|
19
|
-
PIG_0_12_TGZ_NAME = "pig-0.12.tar.gz"
|
20
|
-
PIG_0_12_TGZ_DEFAULT_URL_PATH = "resource/pig_0_12"
|
21
|
-
|
22
19
|
PIG_0_12_HADOOP_2_TGZ_NAME = "pig-0.12-hadoop-2.tar.gz"
|
23
20
|
PIG_0_12_HADOOP_2_TGZ_DEFAULT_URL_PATH = "resource/pig_0_12_hadoop_2"
|
24
21
|
|
25
22
|
def PigVersion.from_string(pig_version_str)
|
26
23
|
if pig_version_str == '0.12'
|
27
|
-
|
24
|
+
raise ArgumentError, "Our Hadoop 1 clusters are no longer supported by EMR. Please use the default version of Pig: 0.12-Hadoop-2. If you're unsure of why you're seeing this error please ensure that the project.properties file is not setting pigversion to an unsupported value."
|
28
25
|
elsif pig_version_str == '0.12-Hadoop-2'
|
29
26
|
return Pig012Hadoop2.new
|
30
27
|
else
|
31
|
-
raise ArgumentError, "Unsupported pig version: #{pig_version_str}. Options are: ['0.12
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
class Pig012
|
36
|
-
def tgz_name
|
37
|
-
PIG_0_12_TGZ_NAME
|
38
|
-
end
|
39
|
-
|
40
|
-
def tgz_default_url_path
|
41
|
-
PIG_0_12_TGZ_DEFAULT_URL_PATH
|
42
|
-
end
|
43
|
-
|
44
|
-
def name
|
45
|
-
"pig-#{version}"
|
46
|
-
end
|
47
|
-
|
48
|
-
def version
|
49
|
-
"0.12"
|
50
|
-
end
|
51
|
-
|
52
|
-
def cluster_backend
|
53
|
-
Mortar::API::Jobs::CLUSTER_BACKEND__EMR_HADOOP_1
|
28
|
+
raise ArgumentError, "Unsupported pig version: #{pig_version_str}. Options are: ['0.12-Hadoop-2]."
|
54
29
|
end
|
55
30
|
end
|
56
31
|
|
@@ -71,6 +46,10 @@ module Mortar
|
|
71
46
|
"0.12-Hadoop-2"
|
72
47
|
end
|
73
48
|
|
49
|
+
def pig_version
|
50
|
+
"pig-0.12"
|
51
|
+
end
|
52
|
+
|
74
53
|
def cluster_backend
|
75
54
|
Mortar::API::Jobs::CLUSTER_BACKEND__EMR_HADOOP_2
|
76
55
|
end
|
data/lib/mortar/version.rb
CHANGED
@@ -106,7 +106,7 @@ other\tgit@github.com:other.git (push)
|
|
106
106
|
context "method_added" do
|
107
107
|
it "replaces help templates" do
|
108
108
|
lines = Base.replace_templates(["line", "start <PIG_VERSION_OPTIONS>"])
|
109
|
-
lines.join("").should == 'linestart 0.12
|
109
|
+
lines.join("").should == 'linestart 0.12-Hadoop-2'
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
@@ -147,7 +147,7 @@ other\tgit@github.com:other.git (push)
|
|
147
147
|
with_git_initialized_project do |p|
|
148
148
|
text = """
|
149
149
|
[DEFAULTS]
|
150
|
-
pigversion=0.12
|
150
|
+
pigversion=0.12-Hadoop-2
|
151
151
|
|
152
152
|
[other]
|
153
153
|
no_browser=true
|
@@ -155,7 +155,7 @@ no_browser=true
|
|
155
155
|
write_file(File.join(p.root_path, ".mortar-defaults"), text)
|
156
156
|
|
157
157
|
b = Base.new
|
158
|
-
b.options.should == {:pigversion => "0.12"}
|
158
|
+
b.options.should == {:pigversion => "0.12-Hadoop-2"}
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
@@ -166,7 +166,7 @@ no_browser=true
|
|
166
166
|
with_git_initialized_project do |p|
|
167
167
|
text = """
|
168
168
|
[DEFAULTS]
|
169
|
-
pigversion=0.12
|
169
|
+
pigversion=0.12-Hadoop-2
|
170
170
|
|
171
171
|
[other]
|
172
172
|
no_browser=true
|
@@ -176,14 +176,14 @@ no_browser=true
|
|
176
176
|
describe_id = "c571a8c7f76a4fd4a67c103d753e2dd5"
|
177
177
|
describe_url = "https://mdog.datadoghq.com/describe/#{describe_id}"
|
178
178
|
|
179
|
-
mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters=>[]) {Excon::Response.new(:body => {"describe_id" => describe_id})}
|
179
|
+
mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters=>[]) {Excon::Response.new(:body => {"describe_id" => describe_id})}
|
180
180
|
mock(Mortar::Auth.api).get_describe(describe_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Describe::STATUS_SUCCESS, "status_description" => "Success", "web_result_url" => describe_url})).ordered
|
181
181
|
mock(Launchy).open(describe_url) {Thread.new {}}
|
182
182
|
|
183
183
|
write_file(File.join(p.pigscripts_path, "my_script.pig"))
|
184
184
|
|
185
185
|
stderr, stdout, d = execute_and_return_command("describe pigscripts/my_script.pig my_alias --polling_interval 0.05", p, git)
|
186
|
-
d.options.should == {:pigversion => "0.12", :polling_interval => "0.05"}
|
186
|
+
d.options.should == {:pigversion => "0.12-Hadoop-2", :polling_interval => "0.05"}
|
187
187
|
end
|
188
188
|
end
|
189
189
|
|
@@ -194,7 +194,7 @@ no_browser=true
|
|
194
194
|
with_git_initialized_project do |p|
|
195
195
|
text = """
|
196
196
|
[DEFAULTS]
|
197
|
-
pigversion=0.12
|
197
|
+
pigversion=0.12-Hadoop-2
|
198
198
|
|
199
199
|
[my_script]
|
200
200
|
no_browser=true
|
@@ -204,12 +204,12 @@ no_browser=true
|
|
204
204
|
describe_id = "c571a8c7f76a4fd4a67c103d753e2dd5"
|
205
205
|
describe_url = "https://mdog.datadoghq.com/describe/#{describe_id}"
|
206
206
|
|
207
|
-
mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters=>[]) {Excon::Response.new(:body => {"describe_id" => describe_id})}
|
207
|
+
mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters=>[]) {Excon::Response.new(:body => {"describe_id" => describe_id})}
|
208
208
|
mock(Mortar::Auth.api).get_describe(describe_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Describe::STATUS_SUCCESS, "status_description" => "Success", "web_result_url" => describe_url})).ordered
|
209
209
|
write_file(File.join(p.pigscripts_path, "my_script.pig"))
|
210
210
|
|
211
211
|
stderr, stdout, d = execute_and_return_command("describe pigscripts/my_script.pig my_alias --polling_interval 0.05", p, git)
|
212
|
-
d.options.should == {:pigversion => "0.12", :polling_interval => "0.05", :no_browser => true}
|
212
|
+
d.options.should == {:pigversion => "0.12-Hadoop-2", :polling_interval => "0.05", :no_browser => true}
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
@@ -232,7 +232,7 @@ polling_interval=10
|
|
232
232
|
describe_id = "c571a8c7f76a4fd4a67c103d753e2dd5"
|
233
233
|
describe_url = "https://mdog.datadoghq.com/describe/#{describe_id}"
|
234
234
|
|
235
|
-
mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters=>[]) {Excon::Response.new(:body => {"describe_id" => describe_id})}
|
235
|
+
mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters=>[]) {Excon::Response.new(:body => {"describe_id" => describe_id})}
|
236
236
|
mock(Mortar::Auth.api).get_describe(describe_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Describe::STATUS_SUCCESS, "status_description" => "Success", "web_result_url" => describe_url})).ordered
|
237
237
|
write_file(File.join(p.pigscripts_path, "my_script.pig"))
|
238
238
|
|
@@ -250,19 +250,19 @@ polling_interval=10
|
|
250
250
|
[DEFAULTS]
|
251
251
|
clustersize=5
|
252
252
|
no_browser=true
|
253
|
-
pigversion=0.12
|
253
|
+
pigversion=0.12-Hadoop-2
|
254
254
|
"""
|
255
255
|
write_file(File.join(p.root_path, "project.properties"), text)
|
256
256
|
|
257
257
|
describe_id = "c571a8c7f76a4fd4a67c103d753e2dd5"
|
258
258
|
describe_url = "https://mdog.datadoghq.com/describe/#{describe_id}"
|
259
259
|
|
260
|
-
mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters=>[]) {Excon::Response.new(:body => {"describe_id" => describe_id})}
|
260
|
+
mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters=>[]) {Excon::Response.new(:body => {"describe_id" => describe_id})}
|
261
261
|
mock(Mortar::Auth.api).get_describe(describe_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Describe::STATUS_SUCCESS, "status_description" => "Success", "web_result_url" => describe_url})).ordered
|
262
262
|
write_file(File.join(p.pigscripts_path, "my_script.pig"))
|
263
263
|
|
264
264
|
stderr, stdout, d = execute_and_return_command("describe pigscripts/my_script.pig my_alias --polling_interval 0.05", p, git)
|
265
|
-
d.options.should == {:polling_interval => "0.05", :no_browser => true, :clustersize => "5", :pigversion => "0.12"}
|
265
|
+
d.options.should == {:polling_interval => "0.05", :no_browser => true, :clustersize => "5", :pigversion => "0.12-Hadoop-2"}
|
266
266
|
end
|
267
267
|
end
|
268
268
|
|
@@ -98,7 +98,7 @@ STDERR
|
|
98
98
|
describe_url = "https://mdog.datadoghq.com/describe/#{describe_id}"
|
99
99
|
parameters = ["name"=>"key", "value"=>"value" ]
|
100
100
|
|
101
|
-
mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"describe_id" => describe_id})}
|
101
|
+
mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"describe_id" => describe_id})}
|
102
102
|
mock(Mortar::Auth.api).get_describe(describe_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Describe::STATUS_QUEUED, "status_description" => "Pending"})).ordered
|
103
103
|
mock(Mortar::Auth.api).get_describe(describe_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Describe::STATUS_GATEWAY_STARTING, "status_description" => "Gateway starting"})).ordered
|
104
104
|
mock(Mortar::Auth.api).get_describe(describe_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Describe::STATUS_PROGRESS, "status_description" => "Starting pig"})).ordered
|
@@ -129,7 +129,7 @@ STDOUT
|
|
129
129
|
describe_url = "https://mdog.datadoghq.com/describe/#{describe_id}"
|
130
130
|
parameters = ["name"=>"key", "value"=>"value" ]
|
131
131
|
|
132
|
-
mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"describe_id" => describe_id})}
|
132
|
+
mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"describe_id" => describe_id})}
|
133
133
|
mock(Mortar::Auth.api).get_describe(describe_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Describe::STATUS_QUEUED, "status_description" => "Pending"})).ordered
|
134
134
|
mock(Mortar::Auth.api).get_describe(describe_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Describe::STATUS_GATEWAY_STARTING, "status_description" => "Gateway starting"})).ordered
|
135
135
|
mock(Mortar::Auth.api).get_describe(describe_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Describe::STATUS_PROGRESS, "status_description" => "Starting pig"})).ordered
|
@@ -163,7 +163,7 @@ STDOUT
|
|
163
163
|
column_number = 32
|
164
164
|
error_type = 'PigError'
|
165
165
|
|
166
|
-
mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters => []) {Excon::Response.new(:body => {"describe_id" => describe_id})}
|
166
|
+
mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters => []) {Excon::Response.new(:body => {"describe_id" => describe_id})}
|
167
167
|
mock(Mortar::Auth.api).get_describe(describe_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Describe::STATUS_QUEUED, "status_description" => "Pending"})).ordered
|
168
168
|
mock(Mortar::Auth.api).get_describe(describe_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Describe::STATUS_FAILURE, "status_description" => "Failed",
|
169
169
|
"error_message" => error_message,
|
@@ -198,7 +198,7 @@ STDERR
|
|
198
198
|
describe_url = "https://mdog.datadoghq.com/describe/#{describe_id}"
|
199
199
|
parameters = ["name"=>"key", "value"=>"value" ]
|
200
200
|
|
201
|
-
mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"describe_id" => describe_id})}
|
201
|
+
mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"describe_id" => describe_id})}
|
202
202
|
mock(Mortar::Auth.api).get_describe(describe_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Describe::STATUS_QUEUED, "status_description" => "Pending"})).ordered
|
203
203
|
mock(Mortar::Auth.api).get_describe(describe_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Describe::STATUS_GATEWAY_STARTING, "status_description" => "Gateway starting"})).ordered
|
204
204
|
mock(Mortar::Auth.api).get_describe(describe_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Describe::STATUS_PROGRESS, "status_description" => "Starting pig"})).ordered
|
@@ -74,7 +74,7 @@ STDERR
|
|
74
74
|
parameters = ["name"=>"key", "value"=>"value" ]
|
75
75
|
|
76
76
|
# These don't test the validity of the error message, it only tests that the CLI can handle a message returned from the server
|
77
|
-
mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", false, is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
|
77
|
+
mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", false, is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
|
78
78
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_QUEUED, "status_description" => "Pending"})).ordered
|
79
79
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_GATEWAY_STARTING, "status_description" => "GATEWAY_STARTING"})).ordered
|
80
80
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_PROGRESS, "status_description" => "In progress"})).ordered
|
@@ -108,7 +108,7 @@ STDOUT
|
|
108
108
|
parameters = ["name"=>"key", "value"=>"value" ]
|
109
109
|
|
110
110
|
# These don't test the validity of the error message, it only tests that the CLI can handle a message returned from the server
|
111
|
-
mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", false, is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
|
111
|
+
mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", false, is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
|
112
112
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_QUEUED, "status_description" => "Pending"})).ordered
|
113
113
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_GATEWAY_STARTING, "status_description" => "GATEWAY_STARTING"})).ordered
|
114
114
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_PROGRESS, "status_description" => "In progress"})).ordered
|
@@ -142,7 +142,7 @@ STDOUT
|
|
142
142
|
parameters = ["name"=>"key", "value"=>"value" ]
|
143
143
|
|
144
144
|
# These don't test the validity of the error message, it only tests that the CLI can handle a message returned from the server
|
145
|
-
mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", false, is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
|
145
|
+
mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", false, is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
|
146
146
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_QUEUED, "status_description" => "Pending"})).ordered
|
147
147
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_SUCCESS, "status_description" => "Succeeded", "web_result_url" => illustrate_url})).ordered
|
148
148
|
|
@@ -169,7 +169,7 @@ STDOUT
|
|
169
169
|
parameters = ["name"=>"key", "value"=>"value" ]
|
170
170
|
|
171
171
|
# These don't test the validity of the error message, it only tests that the CLI can handle a message returned from the server
|
172
|
-
mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", true, is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
|
172
|
+
mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", true, is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
|
173
173
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_QUEUED, "status_description" => "Pending"})).ordered
|
174
174
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_SUCCESS, "status_description" => "Succeeded", "web_result_url" => illustrate_url})).ordered
|
175
175
|
|
@@ -195,7 +195,7 @@ STDOUT
|
|
195
195
|
parameters = ["name"=>"key", "value"=>"value" ]
|
196
196
|
|
197
197
|
# These don't test the validity of the error message, it only tests that the CLI can handle a message returned from the server
|
198
|
-
mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", nil, false, is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
|
198
|
+
mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", nil, false, is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
|
199
199
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_QUEUED, "status_description" => "Pending"})).ordered
|
200
200
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_GATEWAY_STARTING, "status_description" => "GATEWAY_STARTING"})).ordered
|
201
201
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_PROGRESS, "status_description" => "In progress"})).ordered
|
@@ -232,7 +232,7 @@ STDOUT
|
|
232
232
|
error_type = 'PigError'
|
233
233
|
|
234
234
|
# These don't test the validity of the error message, it only tests that the CLI can handle a message returned from the server
|
235
|
-
mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", false, is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters => []) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
|
235
|
+
mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", false, is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters => []) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
|
236
236
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_QUEUED, "status_description" => "Pending"})).ordered
|
237
237
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_FAILURE,
|
238
238
|
"error_message" => error_message,
|
@@ -268,7 +268,7 @@ STDERR
|
|
268
268
|
parameters = ["name"=>"key", "value"=>"value" ]
|
269
269
|
|
270
270
|
# These don't test the validity of the error message, it only tests that the CLI can handle a message returned from the server
|
271
|
-
mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", nil, false, is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
|
271
|
+
mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", nil, false, is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
|
272
272
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_QUEUED, "status_description" => "Pending"})).ordered
|
273
273
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_GATEWAY_STARTING, "status_description" => "GATEWAY_STARTING"})).ordered
|
274
274
|
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_PROGRESS, "status_description" => "In progress"})).ordered
|
@@ -47,7 +47,7 @@ module Mortar::Command
|
|
47
47
|
cluster_size = 5
|
48
48
|
|
49
49
|
mock(Mortar::Auth.api).post_pig_job_new_cluster("myproject", "my_script", is_a(String), cluster_size,
|
50
|
-
:pig_version => "0.12",
|
50
|
+
:pig_version => "0.12-Hadoop-2",
|
51
51
|
:project_script_path => be_a_kind_of(String),
|
52
52
|
:parameters => match_array([{"name" => "FIRST_PARAM", "value" => "FOO"}, {"name" => "SECOND_PARAM", "value" => "BAR"}]),
|
53
53
|
:cluster_type => Jobs::CLUSTER_TYPE__SINGLE_JOB,
|
@@ -83,7 +83,7 @@ STDOUT
|
|
83
83
|
cluster_size = 5
|
84
84
|
|
85
85
|
mock(Mortar::Auth.api).post_pig_job_new_cluster("myproject", "my_script", is_a(String),cluster_size,
|
86
|
-
:pig_version => "0.12",
|
86
|
+
:pig_version => "0.12-Hadoop-2",
|
87
87
|
:project_script_path => be_a_kind_of(String),
|
88
88
|
:parameters => match_array([{"name" => "FIRST_PARAM", "value" => "FOO"}, {"name" => "SECOND_PARAM", "value" => "BAR"}]),
|
89
89
|
:cluster_type => Jobs::CLUSTER_TYPE__PERMANENT,
|
@@ -143,7 +143,7 @@ STDERR
|
|
143
143
|
cluster_size = 5
|
144
144
|
|
145
145
|
mock(Mortar::Auth.api).post_pig_job_new_cluster("myproject", "my_script", is_a(String),cluster_size,
|
146
|
-
:pig_version => "0.12",
|
146
|
+
:pig_version => "0.12-Hadoop-2",
|
147
147
|
:project_script_path => be_a_kind_of(String),
|
148
148
|
:parameters => match_array([{"name" => "FIRST_PARAM", "value" => "FOO"}, {"name" => "SECOND_PARAM", "value" => "BAR"}]),
|
149
149
|
:cluster_type => Jobs::CLUSTER_TYPE__PERSISTENT,
|
@@ -179,7 +179,7 @@ STDOUT
|
|
179
179
|
cluster_size = 5
|
180
180
|
|
181
181
|
mock(Mortar::Auth.api).post_pig_job_new_cluster("myproject", "my_script", is_a(String),cluster_size,
|
182
|
-
:pig_version => "0.12",
|
182
|
+
:pig_version => "0.12-Hadoop-2",
|
183
183
|
:project_script_path => be_a_kind_of(String),
|
184
184
|
:parameters => match_array([{"name" => "FIRST_PARAM", "value" => "FOO"}, {"name" => "SECOND_PARAM", "value" => "BAR"}]),
|
185
185
|
:cluster_type => Jobs::CLUSTER_TYPE__PERSISTENT,
|
@@ -215,7 +215,7 @@ STDOUT
|
|
215
215
|
cluster_id = "e2790e7e8c7d48e39157238d58191346"
|
216
216
|
|
217
217
|
mock(Mortar::Auth.api).post_pig_job_existing_cluster("myproject", "my_script", is_a(String), cluster_id,
|
218
|
-
:pig_version => "0.12",
|
218
|
+
:pig_version => "0.12-Hadoop-2",
|
219
219
|
:project_script_path => be_a_kind_of(String),
|
220
220
|
:parameters => [],
|
221
221
|
:notify_on_job_finish => false,
|
@@ -249,7 +249,7 @@ STDOUT
|
|
249
249
|
cluster_id = "e2790e7e8c7d48e39157238d58191346"
|
250
250
|
|
251
251
|
mock(Mortar::Auth.api).post_pig_job_existing_cluster("myproject", "my_script", is_a(String), cluster_id,
|
252
|
-
:pig_version => "0.12",
|
252
|
+
:pig_version => "0.12-Hadoop-2",
|
253
253
|
:project_script_path => be_a_kind_of(String),
|
254
254
|
:parameters => [],
|
255
255
|
:notify_on_job_finish => false,
|
@@ -281,9 +281,9 @@ STDOUT
|
|
281
281
|
job_url = "http://127.0.0.1:5000/jobs/job_detail?job_id=c571a8c7f76a4fd4a67c103d753e2dd5"
|
282
282
|
cluster_size = 2
|
283
283
|
|
284
|
-
mock(Mortar::Auth.api).get_clusters(Mortar::API::Jobs::
|
284
|
+
mock(Mortar::Auth.api).get_clusters(Mortar::API::Jobs::CLUSTER_BACKEND__EMR_HADOOP_2) {Excon::Response.new(:body => {'clusters' => []})}
|
285
285
|
mock(Mortar::Auth.api).post_pig_job_new_cluster("myproject", "my_script", is_a(String), cluster_size,
|
286
|
-
:pig_version => "0.12",
|
286
|
+
:pig_version => "0.12-Hadoop-2",
|
287
287
|
:project_script_path => be_a_kind_of(String),
|
288
288
|
:parameters => [],
|
289
289
|
:cluster_type => Jobs::CLUSTER_TYPE__PERSISTENT,
|
@@ -319,9 +319,9 @@ STDOUT
|
|
319
319
|
job_url = "http://127.0.0.1:5000/jobs/job_detail?job_id=c571a8c7f76a4fd4a67c103d753e2dd5"
|
320
320
|
cluster_size = 2
|
321
321
|
|
322
|
-
mock(Mortar::Auth.api).get_clusters(Mortar::API::Jobs::
|
322
|
+
mock(Mortar::Auth.api).get_clusters(Mortar::API::Jobs::CLUSTER_BACKEND__EMR_HADOOP_2) {Excon::Response.new(:body => {'clusters' => []})}
|
323
323
|
mock(Mortar::Auth.api).post_pig_job_new_cluster("myproject", "my_script", is_a(String), cluster_size,
|
324
|
-
:pig_version => "0.12",
|
324
|
+
:pig_version => "0.12-Hadoop-2",
|
325
325
|
:project_script_path => be_a_kind_of(String),
|
326
326
|
:parameters => [],
|
327
327
|
:cluster_type => Jobs::CLUSTER_TYPE__PERSISTENT,
|
@@ -358,7 +358,7 @@ STDOUT
|
|
358
358
|
job_url = "http://127.0.0.1:5000/jobs/job_detail?job_id=c571a8c7f76a4fd4a67c103d753e2dd5"
|
359
359
|
cluster_id = "e2790e7e8c7d48e39157238d58191346"
|
360
360
|
|
361
|
-
mock(Mortar::Auth.api).post_pig_job_existing_cluster("myproject", "my_script", is_a(String), cluster_id, :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters => [], :notify_on_job_finish => false, :is_control_script=>false) {Excon::Response.new(:body => {"job_id" => job_id, "web_job_url" => job_url})}
|
361
|
+
mock(Mortar::Auth.api).post_pig_job_existing_cluster("myproject", "my_script", is_a(String), cluster_id, :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters => [], :notify_on_job_finish => false, :is_control_script=>false) {Excon::Response.new(:body => {"job_id" => job_id, "web_job_url" => job_url})}
|
362
362
|
|
363
363
|
write_file(File.join(p.pigscripts_path, "my_script.pig"))
|
364
364
|
stderr, stdout = execute("jobs:run pigscripts/my_script.pig --clusterid e2790e7e8c7d48e39157238d58191346 -d", p, @git)
|
@@ -399,7 +399,7 @@ STDOUT
|
|
399
399
|
huge_busy_cluster_status = Mortar::API::Clusters::STATUS_RUNNING
|
400
400
|
|
401
401
|
|
402
|
-
mock(Mortar::Auth.api).get_clusters(Mortar::API::Jobs::
|
402
|
+
mock(Mortar::Auth.api).get_clusters(Mortar::API::Jobs::CLUSTER_BACKEND__EMR_HADOOP_2) {
|
403
403
|
Excon::Response.new(:body => {
|
404
404
|
'clusters' => [
|
405
405
|
{ 'cluster_id' => small_cluster_id, 'size' => small_cluster_size, 'running_jobs' => [], 'status_code' => small_cluster_status },
|
@@ -411,7 +411,7 @@ STDOUT
|
|
411
411
|
]})
|
412
412
|
}
|
413
413
|
mock(Mortar::Auth.api).post_pig_job_existing_cluster("myproject", "my_script", is_a(String), large_cluster_id,
|
414
|
-
:pig_version => "0.12",
|
414
|
+
:pig_version => "0.12-Hadoop-2",
|
415
415
|
:project_script_path => be_a_kind_of(String),
|
416
416
|
:parameters => [],
|
417
417
|
:notify_on_job_finish => true,
|
@@ -493,7 +493,7 @@ STDOUT
|
|
493
493
|
cluster_size = 5
|
494
494
|
|
495
495
|
mock(Mortar::Auth.api).post_pig_job_new_cluster("myproject", "my_script", is_a(String), cluster_size,
|
496
|
-
:pig_version => "0.12",
|
496
|
+
:pig_version => "0.12-Hadoop-2",
|
497
497
|
:project_script_path => be_a_kind_of(String),
|
498
498
|
:parameters => match_array([{"name" => "FIRST", "value" => "FOO"}, {"name" => "SECOND", "value" => "BAR"}, {"name" => "THIRD", "value" => "BEAR"}]),
|
499
499
|
:cluster_type => Jobs::CLUSTER_TYPE__PERSISTENT,
|
@@ -521,7 +521,7 @@ PARAMS
|
|
521
521
|
cluster_size = 5
|
522
522
|
|
523
523
|
mock(Mortar::Auth.api).post_pig_job_new_cluster("myproject", "my_script", is_a(String), cluster_size,
|
524
|
-
:pig_version => "0.12",
|
524
|
+
:pig_version => "0.12-Hadoop-2",
|
525
525
|
:project_script_path => be_a_kind_of(String),
|
526
526
|
:parameters => match_array([{"name" => "FIRST", "value" => "FOO"}, {"name" => "SECOND", "value" => "BAR"}, {"name" => "THIRD", "value" => "BEAR"}]),
|
527
527
|
:cluster_type => Jobs::CLUSTER_TYPE__PERSISTENT,
|
@@ -577,7 +577,7 @@ STDERR
|
|
577
577
|
mock(@git).sync_embedded_project.with_any_args.times(1) { "somewhere_over_the_rainbow" }
|
578
578
|
|
579
579
|
mock(Mortar::Auth.api).post_pig_job_new_cluster("myproject", "my_script", is_a(String), cluster_size,
|
580
|
-
:pig_version => "0.12",
|
580
|
+
:pig_version => "0.12-Hadoop-2",
|
581
581
|
:project_script_path => be_a_kind_of(String),
|
582
582
|
:parameters => match_array([{"name" => "FIRST_PARAM", "value" => "FOO"}, {"name" => "SECOND_PARAM", "value" => "BAR"}]),
|
583
583
|
:cluster_type => Jobs::CLUSTER_TYPE__PERSISTENT,
|
@@ -48,7 +48,7 @@ STDERR
|
|
48
48
|
mock(u).config_parameters.returns([])
|
49
49
|
end
|
50
50
|
any_instance_of(Mortar::Local::Controller) do |u|
|
51
|
-
mock(u).illustrate(pigscript, "some_alias", is_a(Mortar::PigVersion::
|
51
|
+
mock(u).illustrate(pigscript, "some_alias", is_a(Mortar::PigVersion::Pig012Hadoop2), [], false, false).returns(nil)
|
52
52
|
end
|
53
53
|
stderr, stdout = execute("local:illustrate #{script_name} some_alias", p)
|
54
54
|
stderr.should == ""
|
@@ -66,9 +66,9 @@ STDERR
|
|
66
66
|
mock(u).config_parameters.returns([])
|
67
67
|
end
|
68
68
|
any_instance_of(Mortar::Local::Controller) do |u|
|
69
|
-
mock(u).illustrate(pigscript, nil, is_a(Mortar::PigVersion::
|
69
|
+
mock(u).illustrate(pigscript, nil, is_a(Mortar::PigVersion::Pig012Hadoop2), [], false, false).returns(nil)
|
70
70
|
end
|
71
|
-
stderr, stdout = execute("local:illustrate #{script_name} -g 0.12", p)
|
71
|
+
stderr, stdout = execute("local:illustrate #{script_name} -g 0.12-Hadoop-2", p)
|
72
72
|
stderr.should == ""
|
73
73
|
end
|
74
74
|
end
|
@@ -85,9 +85,9 @@ STDERR
|
|
85
85
|
end
|
86
86
|
mock(Mortar::Project::PigScript).new(script_name, script_path).returns(pigscript)
|
87
87
|
any_instance_of(Mortar::Local::Controller) do |u|
|
88
|
-
mock(u).illustrate(pigscript, nil, is_a(Mortar::PigVersion::
|
88
|
+
mock(u).illustrate(pigscript, nil, is_a(Mortar::PigVersion::Pig012Hadoop2), [{"name"=>"first", "value"=>1},{"name"=>"second", "value"=>2}], false, false).returns(nil)
|
89
89
|
end
|
90
|
-
stderr, stdout = execute("local:illustrate #{script_name} -g 0.12", p)
|
90
|
+
stderr, stdout = execute("local:illustrate #{script_name} -g 0.12-Hadoop-2", p)
|
91
91
|
stderr.should == ""
|
92
92
|
end
|
93
93
|
end
|
@@ -244,10 +244,10 @@ PARAMS
|
|
244
244
|
mock(u).config_parameters.returns([{"key"=>"k", "value"=>"v"}])
|
245
245
|
end
|
246
246
|
any_instance_of(Mortar::Local::Controller) do |u|
|
247
|
-
mock(u).install_and_configure(is_a(Mortar::PigVersion::
|
247
|
+
mock(u).install_and_configure(is_a(Mortar::PigVersion::Pig012Hadoop2), 'validate')
|
248
248
|
end
|
249
249
|
any_instance_of(Mortar::Local::Pig) do |u|
|
250
|
-
mock(u).run_pig_command(" -check #{pigscript.path}", is_a(Mortar::PigVersion::
|
250
|
+
mock(u).run_pig_command(" -check #{pigscript.path}", is_a(Mortar::PigVersion::Pig012Hadoop2), [{"key"=>"k", "value"=>"v"}])
|
251
251
|
end
|
252
252
|
stderr, stdout = execute("local:validate #{script_name}", p)
|
253
253
|
stderr.should == ""
|
@@ -265,10 +265,10 @@ PARAMS
|
|
265
265
|
mock(u).config_parameters.returns([])
|
266
266
|
end
|
267
267
|
any_instance_of(Mortar::Local::Controller) do |u|
|
268
|
-
mock(u).install_and_configure(is_a(Mortar::PigVersion::
|
268
|
+
mock(u).install_and_configure(is_a(Mortar::PigVersion::Pig012Hadoop2), 'validate')
|
269
269
|
end
|
270
270
|
any_instance_of(Mortar::Local::Pig) do |u|
|
271
|
-
mock(u).run_pig_command(" -check #{pigscript.path}", is_a(Mortar::PigVersion::
|
271
|
+
mock(u).run_pig_command(" -check #{pigscript.path}", is_a(Mortar::PigVersion::Pig012Hadoop2), [])
|
272
272
|
end
|
273
273
|
stderr, stdout = execute("local:validate pigscripts/#{script_name}.pig", p)
|
274
274
|
stderr.should == ""
|
@@ -316,7 +316,7 @@ STDERR
|
|
316
316
|
mock(u).run_stillson_luigi_client_cfg_expansion(luigi_script, config_parameters).returns(true)
|
317
317
|
end
|
318
318
|
any_instance_of(Mortar::Local::Controller) do |u|
|
319
|
-
mock(u).install_and_configure(is_a(Mortar::PigVersion::
|
319
|
+
mock(u).install_and_configure(is_a(Mortar::PigVersion::Pig012Hadoop2),'luigi')
|
320
320
|
end
|
321
321
|
any_instance_of(Mortar::Command::Local) do |u|
|
322
322
|
mock(u).sync_code_with_cloud().returns("some-git-ref")
|
@@ -347,7 +347,7 @@ STDERR
|
|
347
347
|
mock(u).run_luigi_script(luigi_script, %W{--myoption 2 --myotheroption 3})
|
348
348
|
end
|
349
349
|
any_instance_of(Mortar::Local::Controller) do |u|
|
350
|
-
mock(u).install_and_configure(is_a(Mortar::PigVersion::
|
350
|
+
mock(u).install_and_configure(is_a(Mortar::PigVersion::Pig012Hadoop2),'luigi')
|
351
351
|
end
|
352
352
|
any_instance_of(Mortar::Command::Local) do |u|
|
353
353
|
mock(u).sync_code_with_cloud().returns("some-git-ref")
|
@@ -73,7 +73,7 @@ STDERR
|
|
73
73
|
validate_id = "c571a8c7f76a4fd4a67c103d753e2dd5"
|
74
74
|
parameters = ["name"=>"key", "value"=>"value" ]
|
75
75
|
|
76
|
-
mock(Mortar::Auth.api).post_validate("myproject", "my_script", is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"validate_id" => validate_id})}
|
76
|
+
mock(Mortar::Auth.api).post_validate("myproject", "my_script", is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"validate_id" => validate_id})}
|
77
77
|
mock(Mortar::Auth.api).get_validate(validate_id).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Validate::STATUS_QUEUED, "status_description" => "Pending"})).ordered
|
78
78
|
mock(Mortar::Auth.api).get_validate(validate_id).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Validate::STATUS_GATEWAY_STARTING, "status_description" => "GATEWAY_STARTING"})).ordered
|
79
79
|
mock(Mortar::Auth.api).get_validate(validate_id).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Validate::STATUS_PROGRESS, "status_description" => "Starting"})).ordered
|
@@ -103,7 +103,7 @@ STDOUT
|
|
103
103
|
column_number = 32
|
104
104
|
error_type = 'PigError'
|
105
105
|
|
106
|
-
mock(Mortar::Auth.api).post_validate("myproject", "my_script", is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters => []) {Excon::Response.new(:body => {"validate_id" => validate_id})}
|
106
|
+
mock(Mortar::Auth.api).post_validate("myproject", "my_script", is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters => []) {Excon::Response.new(:body => {"validate_id" => validate_id})}
|
107
107
|
mock(Mortar::Auth.api).get_validate(validate_id).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Validate::STATUS_QUEUED, "status_description" => "Pending"})).ordered
|
108
108
|
mock(Mortar::Auth.api).get_validate(validate_id).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Validate::STATUS_FAILURE, "status_description" => "Failed",
|
109
109
|
"error_message" => error_message,
|
@@ -137,7 +137,7 @@ STDERR
|
|
137
137
|
validate_id = "c571a8c7f76a4fd4a67c103d753e2dd5"
|
138
138
|
parameters = ["name"=>"key", "value"=>"value" ]
|
139
139
|
|
140
|
-
mock(Mortar::Auth.api).post_validate("myproject", "my_script", is_a(String), :pig_version => "0.12", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"validate_id" => validate_id})}
|
140
|
+
mock(Mortar::Auth.api).post_validate("myproject", "my_script", is_a(String), :pig_version => "0.12-Hadoop-2", :project_script_path => be_a_kind_of(String), :parameters => parameters) {Excon::Response.new(:body => {"validate_id" => validate_id})}
|
141
141
|
mock(Mortar::Auth.api).get_validate(validate_id).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Validate::STATUS_QUEUED, "status_description" => "Pending"})).ordered
|
142
142
|
mock(Mortar::Auth.api).get_validate(validate_id).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Validate::STATUS_GATEWAY_STARTING, "status_description" => "GATEWAY_STARTING"})).ordered
|
143
143
|
mock(Mortar::Auth.api).get_validate(validate_id).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Validate::STATUS_PROGRESS, "status_description" => "Starting"})).ordered
|
@@ -146,7 +146,7 @@ STDERR
|
|
146
146
|
mock(@git).sync_embedded_project.with_any_args.times(1) { "somewhere_over_the_rainbow" }
|
147
147
|
|
148
148
|
write_file(File.join(p.pigscripts_path, "my_script.pig"))
|
149
|
-
stderr, stdout = execute("validate my_script --polling_interval 0.05 -p key=value -g 0.12", p, @git)
|
149
|
+
stderr, stdout = execute("validate my_script --polling_interval 0.05 -p key=value -g 0.12-Hadoop-2", p, @git)
|
150
150
|
end
|
151
151
|
end
|
152
152
|
end
|
@@ -135,7 +135,7 @@ module Mortar::Local
|
|
135
135
|
mock(j).check_install.returns(true)
|
136
136
|
end
|
137
137
|
any_instance_of(Mortar::Local::Pig) do |p|
|
138
|
-
mock(p).install_or_update(is_a(Mortar::PigVersion::
|
138
|
+
mock(p).install_or_update(is_a(Mortar::PigVersion::Pig012Hadoop2), nil)
|
139
139
|
end
|
140
140
|
any_instance_of(Mortar::Local::Python) do |p|
|
141
141
|
mock(p).check_or_install.returns(true)
|
@@ -158,13 +158,13 @@ module Mortar::Local
|
|
158
158
|
|
159
159
|
it "checks for aws keys, checks depenendency installation, runs script" do
|
160
160
|
c = Mortar::Local::Controller.new
|
161
|
-
mock(c).install_and_configure("0.12", "run")
|
161
|
+
mock(c).install_and_configure("0.12-Hadoop-2", "run")
|
162
162
|
test_script = "foobar-script"
|
163
163
|
the_parameters = []
|
164
164
|
any_instance_of(Mortar::Local::Pig) do |p|
|
165
|
-
mock(p).run_script(test_script, "0.12", the_parameters)
|
165
|
+
mock(p).run_script(test_script, "0.12-Hadoop-2", the_parameters)
|
166
166
|
end
|
167
|
-
c.run(test_script, "0.12", the_parameters)
|
167
|
+
c.run(test_script, "0.12-Hadoop-2", the_parameters)
|
168
168
|
end
|
169
169
|
|
170
170
|
end
|
@@ -172,16 +172,16 @@ module Mortar::Local
|
|
172
172
|
context("illustrate") do
|
173
173
|
it "checks for aws keys, checks depenendency installation, runs the illustrate process" do
|
174
174
|
c = Mortar::Local::Controller.new
|
175
|
-
mock(c).install_and_configure("0.12", "illustrate")
|
175
|
+
mock(c).install_and_configure("0.12-Hadoop-2", "illustrate")
|
176
176
|
test_script = "foobar-script"
|
177
177
|
script_alias = "some_alias"
|
178
178
|
prune = false
|
179
179
|
no_browser = false
|
180
180
|
the_parameters = []
|
181
181
|
any_instance_of(Mortar::Local::Pig) do |p|
|
182
|
-
mock(p).illustrate_alias(test_script, script_alias, prune, no_browser, "0.12", the_parameters)
|
182
|
+
mock(p).illustrate_alias(test_script, script_alias, prune, no_browser, "0.12-Hadoop-2", the_parameters)
|
183
183
|
end
|
184
|
-
c.illustrate(test_script, script_alias, "0.12", the_parameters, prune, no_browser)
|
184
|
+
c.illustrate(test_script, script_alias, "0.12-Hadoop-2", the_parameters, prune, no_browser)
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
@@ -35,19 +35,19 @@ module Mortar::Local
|
|
35
35
|
# chmods bin/pig, removes tgz, and notes the installation
|
36
36
|
FakeFS do
|
37
37
|
pig = Mortar::Local::Pig.new
|
38
|
-
|
39
|
-
local_pig_archive = File.join(pig.local_install_directory,
|
40
|
-
mock(pig).download_file(pig.pig_archive_url(
|
38
|
+
pig012Hadoop2 = Mortar::PigVersion::Pig012Hadoop2.new
|
39
|
+
local_pig_archive = File.join(pig.local_install_directory, pig012Hadoop2.tgz_name)
|
40
|
+
mock(pig).download_file(pig.pig_archive_url(pig012Hadoop2), local_pig_archive, nil) do
|
41
41
|
# Simulate the tgz file being downloaded, this should be deleted
|
42
42
|
# before the method finishes executing
|
43
43
|
FileUtils.touch(local_pig_archive)
|
44
44
|
end
|
45
45
|
mock(pig).extract_tgz(local_pig_archive, pig.local_install_directory)
|
46
|
-
mock(pig).note_install(
|
47
|
-
mock(pig).command(
|
46
|
+
mock(pig).note_install(pig012Hadoop2.pig_version)
|
47
|
+
mock(pig).command(pig012Hadoop2)
|
48
48
|
begin
|
49
49
|
previous_stdout, $stdout = $stdout, StringIO.new
|
50
|
-
pig.install_pig(
|
50
|
+
pig.install_pig(pig012Hadoop2)
|
51
51
|
ensure
|
52
52
|
$stdout = previous_stdout
|
53
53
|
end
|
@@ -61,17 +61,17 @@ module Mortar::Local
|
|
61
61
|
|
62
62
|
it "does nothing if existing install and no update available" do
|
63
63
|
pig = Mortar::Local::Pig.new
|
64
|
-
|
64
|
+
pig012Hadoop2 = Mortar::PigVersion::Pig012Hadoop2.new
|
65
65
|
|
66
|
-
mock(pig).should_do_pig_install?(
|
67
|
-
mock(pig).should_do_pig_update?(
|
66
|
+
mock(pig).should_do_pig_install?(pig012Hadoop2).returns(false)
|
67
|
+
mock(pig).should_do_pig_update?(pig012Hadoop2, nil).returns(false)
|
68
68
|
mock(pig).should_do_lib_install?.returns(false)
|
69
69
|
mock(pig).should_do_lib_update?.returns(false)
|
70
70
|
FakeFS do
|
71
71
|
FileUtils.mkdir_p(File.dirname(pig.local_install_directory))
|
72
72
|
FileUtils.rm_rf(pig.local_install_directory, :force => true)
|
73
|
-
pig.install_or_update(
|
74
|
-
expect(File.exists?(pig.pig_directory(
|
73
|
+
pig.install_or_update(pig012Hadoop2)
|
74
|
+
expect(File.exists?(pig.pig_directory(pig012Hadoop2))).to be_false
|
75
75
|
expect(File.exists?(pig.lib_directory)).to be_false
|
76
76
|
|
77
77
|
end
|
@@ -79,30 +79,30 @@ module Mortar::Local
|
|
79
79
|
|
80
80
|
it "does install if none has been done before" do
|
81
81
|
pig = Mortar::Local::Pig.new
|
82
|
-
|
82
|
+
pig012Hadoop2 = Mortar::PigVersion::Pig012Hadoop2.new
|
83
83
|
|
84
|
-
mock(pig).should_do_pig_install?(
|
84
|
+
mock(pig).should_do_pig_install?(pig012Hadoop2).returns(true)
|
85
85
|
mock(pig).should_do_lib_install?.returns(true)
|
86
86
|
|
87
|
-
mock(pig).install_pig(
|
87
|
+
mock(pig).install_pig(pig012Hadoop2, nil)
|
88
88
|
mock(pig).install_lib
|
89
89
|
capture_stdout do
|
90
|
-
pig.install_or_update(
|
90
|
+
pig.install_or_update(pig012Hadoop2)
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
94
|
it "does install if one was done before but there is an update" do
|
95
95
|
pig = Mortar::Local::Pig.new
|
96
|
-
|
96
|
+
pig012Hadoop2 = Mortar::PigVersion::Pig012Hadoop2.new
|
97
97
|
|
98
|
-
mock(pig).should_do_pig_install?(
|
99
|
-
mock(pig).should_do_pig_update?(
|
98
|
+
mock(pig).should_do_pig_install?(pig012Hadoop2).returns(false)
|
99
|
+
mock(pig).should_do_pig_update?(pig012Hadoop2, nil).returns(true)
|
100
100
|
mock(pig).should_do_lib_install?.returns(false)
|
101
101
|
mock(pig).should_do_lib_update?.returns(true)
|
102
|
-
mock(pig).install_pig(
|
102
|
+
mock(pig).install_pig(pig012Hadoop2)
|
103
103
|
mock(pig).install_lib
|
104
104
|
capture_stdout do
|
105
|
-
pig.install_or_update(
|
105
|
+
pig.install_or_update(pig012Hadoop2)
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
@@ -208,7 +208,7 @@ module Mortar::Local
|
|
208
208
|
mock(pig).run_pig_command.with_any_args.returns(true)
|
209
209
|
mock(pig).show_illustrate_output_browser.with_any_args
|
210
210
|
stub(pig).make_pig_param_file.returns('param.file')
|
211
|
-
pig.illustrate_alias(script, 'my_alias', false, false, "0.12", [])
|
211
|
+
pig.illustrate_alias(script, 'my_alias', false, false, "0.12-Hadoop-2", [])
|
212
212
|
end
|
213
213
|
|
214
214
|
it "displays text results if illustrate was successful with no_browser" do
|
@@ -218,7 +218,7 @@ module Mortar::Local
|
|
218
218
|
stub(pig).run_pig_command.with_any_args.returns(true)
|
219
219
|
mock(pig).display.with_any_args
|
220
220
|
stub(pig).make_pig_param_file.returns('param.file')
|
221
|
-
pig.illustrate_alias(script, 'my_alias', false, true, "0.12", [])
|
221
|
+
pig.illustrate_alias(script, 'my_alias', false, true, "0.12-Hadoop-2", [])
|
222
222
|
end
|
223
223
|
|
224
224
|
it "skips results if illustrate was unsuccessful" do
|
@@ -228,7 +228,7 @@ module Mortar::Local
|
|
228
228
|
mock(pig).run_pig_command.with_any_args.returns(false)
|
229
229
|
mock(pig).show_illustrate_output_browser.with_any_args.never
|
230
230
|
stub(pig).make_pig_param_file.returns('param.file')
|
231
|
-
pig.illustrate_alias(script, 'my_alias', false, false, "0.12", [])
|
231
|
+
pig.illustrate_alias(script, 'my_alias', false, false, "0.12-Hadoop-2", [])
|
232
232
|
end
|
233
233
|
|
234
234
|
it "does not require login credentials for illustration" do
|
@@ -238,7 +238,7 @@ module Mortar::Local
|
|
238
238
|
mock(Mortar::Auth).user_s3_safe(true).returns('notloggedin-user-org')
|
239
239
|
mock(pig).run_pig_command.with_any_args.returns(true)
|
240
240
|
mock(pig).show_illustrate_output_browser.with_any_args
|
241
|
-
pig.illustrate_alias(script, 'my_alias', false, false, "0.12", [])
|
241
|
+
pig.illustrate_alias(script, 'my_alias', false, false, "0.12-Hadoop-2", [])
|
242
242
|
end
|
243
243
|
|
244
244
|
end
|
@@ -264,13 +264,12 @@ module Mortar::Local
|
|
264
264
|
pig = Mortar::Local::Pig.new
|
265
265
|
tpc = pig.template_params_classpath
|
266
266
|
expect(tpc.include?("pig-0.12")).to be_true
|
267
|
-
expect(tpc.include?("pig-0.12-Hadoop-2")).to be_false
|
268
267
|
end
|
269
268
|
|
270
269
|
it "Works with 0.12-Hadoop-2 pig" do
|
271
270
|
pig = Mortar::Local::Pig.new
|
272
271
|
tpc = pig.template_params_classpath(Mortar::PigVersion::Pig012Hadoop2.new)
|
273
|
-
expect(tpc.include?("pig-0.12
|
272
|
+
expect(tpc.include?("pig-0.12")).to be_true
|
274
273
|
end
|
275
274
|
end
|
276
275
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mortar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mortar Data
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.8.
|
33
|
+
version: 0.8.15
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.8.
|
40
|
+
version: 0.8.15
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: netrc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -322,7 +322,6 @@ files:
|
|
322
322
|
- spec/mortar/command/pigscripts_spec.rb
|
323
323
|
- spec/mortar/command/projects_spec.rb
|
324
324
|
- spec/mortar/command/s3_spec.rb
|
325
|
-
- spec/mortar/command/spark_spec.rb
|
326
325
|
- spec/mortar/command/validate_spec.rb
|
327
326
|
- spec/mortar/command/version_spec.rb
|
328
327
|
- spec/mortar/command_spec.rb
|
@@ -1,154 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright 2014 Mortar Data Inc.
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
|
17
|
-
require 'spec_helper'
|
18
|
-
require 'fakefs/spec_helpers'
|
19
|
-
require 'mortar/command/spark'
|
20
|
-
require 'mortar/api/jobs'
|
21
|
-
|
22
|
-
module Mortar::Command
|
23
|
-
describe Spark do
|
24
|
-
|
25
|
-
before(:each) do
|
26
|
-
stub_core
|
27
|
-
@git = Mortar::Git::Git.new
|
28
|
-
end
|
29
|
-
|
30
|
-
context("index") do
|
31
|
-
it "shows help when user adds help argument" do
|
32
|
-
with_git_initialized_project do |p|
|
33
|
-
stderr_dash_h, stdout_dash_h = execute("spark -h", p, @git)
|
34
|
-
stderr_help, stdout_help = execute("spark help", p, @git)
|
35
|
-
stdout_dash_h.should == stdout_help
|
36
|
-
stderr_dash_h.should == stderr_help
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
it "runs a spark job with no arguments new cluster" do
|
41
|
-
with_git_initialized_project do |p|
|
42
|
-
# stub api requests
|
43
|
-
job_id = "c571a8c7f76a4fd4a67c103d753e2dd5"
|
44
|
-
job_url = "http://127.0.0.1:5000/jobs/spark_job_detail?job_id=c571a8c7f76a4fd4a67c103d753e2dd5"
|
45
|
-
mock(Mortar::Auth.api).post_spark_job_new_cluster("myproject", "my_script.py", is_a(String), 4,
|
46
|
-
:project_script_path => be_a_kind_of(String),
|
47
|
-
:script_arguments => "",
|
48
|
-
:cluster_type=>"persistent",
|
49
|
-
:use_spot_instances=>false
|
50
|
-
) {Excon::Response.new(:body => {"job_id" => job_id, "web_job_url" => job_url})}
|
51
|
-
|
52
|
-
write_file(File.join(p.sparkscripts_path, "my_script.py"))
|
53
|
-
stderr, stdout = execute("spark sparkscripts/my_script.py --clustersize 4", p, @git)
|
54
|
-
puts stderr
|
55
|
-
stdout.should == <<-STDOUT
|
56
|
-
Taking code snapshot... done
|
57
|
-
Sending code snapshot to Mortar... done
|
58
|
-
Requesting job execution... done
|
59
|
-
job_id: c571a8c7f76a4fd4a67c103d753e2dd5
|
60
|
-
|
61
|
-
Job status can be viewed on the web at:
|
62
|
-
|
63
|
-
http://127.0.0.1:5000/jobs/spark_job_detail?job_id=c571a8c7f76a4fd4a67c103d753e2dd5
|
64
|
-
|
65
|
-
STDOUT
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
it "runs a spark job with script_arguments existing cluster" do
|
70
|
-
with_git_initialized_project do |p|
|
71
|
-
# stub api requests
|
72
|
-
job_id = "c571a8c7f76a4fd4a67c103d753e2dd5"
|
73
|
-
cluster_id = "c571a8c7f76a4fd4a67c103d753e2dd7"
|
74
|
-
job_url = "http://127.0.0.1:5000/jobs/spark_job_detail?job_id=c571a8c7f76a4fd4a67c103d753e2dd5"
|
75
|
-
script_arguments = "arg1 arg2 arg3"
|
76
|
-
mock(Mortar::Auth.api).post_spark_job_existing_cluster("myproject", "my_script.py", is_a(String), cluster_id,
|
77
|
-
:project_script_path => be_a_kind_of(String),
|
78
|
-
:script_arguments => script_arguments
|
79
|
-
) {Excon::Response.new(:body => {"job_id" => job_id, "web_job_url" => job_url})}
|
80
|
-
|
81
|
-
write_file(File.join(p.sparkscripts_path, "my_script.py"))
|
82
|
-
stderr, stdout = execute("spark sparkscripts/my_script.py --clusterid #{cluster_id} #{script_arguments}", p, @git)
|
83
|
-
stdout.should == <<-STDOUT
|
84
|
-
Taking code snapshot... done
|
85
|
-
Sending code snapshot to Mortar... done
|
86
|
-
Requesting job execution... done
|
87
|
-
job_id: c571a8c7f76a4fd4a67c103d753e2dd5
|
88
|
-
|
89
|
-
Job status can be viewed on the web at:
|
90
|
-
|
91
|
-
http://127.0.0.1:5000/jobs/spark_job_detail?job_id=c571a8c7f76a4fd4a67c103d753e2dd5
|
92
|
-
|
93
|
-
STDOUT
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
it "runs a spark job with on free cluster" do
|
98
|
-
with_git_initialized_project do |p|
|
99
|
-
# stub api requests
|
100
|
-
job_id = "c571a8c7f76a4fd4a67c103d753e2dd5"
|
101
|
-
job_url = "http://127.0.0.1:5000/jobs/spark_job_detail?job_id=c571a8c7f76a4fd4a67c103d753e2dd5"
|
102
|
-
script_arguments = "arg1 arg2 arg3"
|
103
|
-
|
104
|
-
small_cluster_id = '510beb6b3004860820ab6538'
|
105
|
-
small_cluster_size = 2
|
106
|
-
small_cluster_status = Mortar::API::Clusters::STATUS_RUNNING
|
107
|
-
large_cluster_id = '510bf0db3004860820ab6590'
|
108
|
-
large_cluster_size = 5
|
109
|
-
large_cluster_status = Mortar::API::Clusters::STATUS_RUNNING
|
110
|
-
starting_cluster_id = '510bf0db3004860820abaaaa'
|
111
|
-
starting_cluster_size = 10
|
112
|
-
starting_cluster_status = Mortar::API::Clusters::STATUS_STARTING
|
113
|
-
huge_busy_cluster_id = '510bf0db3004860820ab6621'
|
114
|
-
huge_busy_cluster_size = 20
|
115
|
-
huge_busy_cluster_status = Mortar::API::Clusters::STATUS_RUNNING
|
116
|
-
|
117
|
-
|
118
|
-
mock(Mortar::Auth.api).get_clusters(Mortar::API::Jobs::CLUSTER_BACKEND__EMR_HADOOP_2) {
|
119
|
-
Excon::Response.new(:body => {
|
120
|
-
'clusters' => [
|
121
|
-
{ 'cluster_id' => small_cluster_id, 'size' => small_cluster_size, 'running_jobs' => [], 'status_code' => small_cluster_status },
|
122
|
-
{ 'cluster_id' => large_cluster_id, 'size' => large_cluster_size, 'running_jobs' => [], 'status_code' => large_cluster_status },
|
123
|
-
{ 'cluster_id' => starting_cluster_id, 'size' => starting_cluster_size, 'running_jobs' => [], 'status_code' => starting_cluster_status },
|
124
|
-
{ 'cluster_id' => huge_busy_cluster_id, 'size' => huge_busy_cluster_size,
|
125
|
-
'running_jobs' => [ { 'job_id' => 'c571a8c7f76a4fd4a67c103d753e2dd5',
|
126
|
-
'job_name' => "", 'start_timestamp' => ""} ], 'status_code' => huge_busy_cluster_status }
|
127
|
-
]})
|
128
|
-
}
|
129
|
-
|
130
|
-
mock(Mortar::Auth.api).post_spark_job_existing_cluster("myproject", "my_script.py", is_a(String), large_cluster_id,
|
131
|
-
:project_script_path => be_a_kind_of(String),
|
132
|
-
:script_arguments => script_arguments
|
133
|
-
) {Excon::Response.new(:body => {"job_id" => job_id, "web_job_url" => job_url})}
|
134
|
-
|
135
|
-
write_file(File.join(p.sparkscripts_path, "my_script.py"))
|
136
|
-
stderr, stdout = execute("spark sparkscripts/my_script.py #{script_arguments}", p, @git)
|
137
|
-
stdout.should == <<-STDOUT
|
138
|
-
Taking code snapshot... done
|
139
|
-
Sending code snapshot to Mortar... done
|
140
|
-
Defaulting to running job on largest existing free cluster, id = 510bf0db3004860820ab6590, size = 5
|
141
|
-
Requesting job execution... done
|
142
|
-
job_id: c571a8c7f76a4fd4a67c103d753e2dd5
|
143
|
-
|
144
|
-
Job status can be viewed on the web at:
|
145
|
-
|
146
|
-
http://127.0.0.1:5000/jobs/spark_job_detail?job_id=c571a8c7f76a4fd4a67c103d753e2dd5
|
147
|
-
|
148
|
-
STDOUT
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|