mortar 0.11.1 → 0.12.0

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.
@@ -0,0 +1,71 @@
1
+ #
2
+ # Copyright 2012 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
+ module Mortar
18
+ module PigVersion
19
+ PIG_0_9_TGZ_NAME = "pig-0.9.tar.gz"
20
+ PIG_0_9_TGZ_DEFAULT_URL_PATH = "resource/pig_0_9"
21
+ PIG_0_12_TGZ_NAME = "pig-0.12.tar.gz"
22
+ PIG_0_12_TGZ_DEFAULT_URL_PATH = "resource/pig_0_12"
23
+
24
+ def PigVersion.from_string(pig_version_str)
25
+ if pig_version_str == '0.9'
26
+ return Pig09.new
27
+ elsif pig_version_str == '0.12'
28
+ return Pig012.new
29
+ else
30
+ raise ArgumentError, "Unsupported pig version: #{pig_version_str}"
31
+ end
32
+ end
33
+
34
+ class Pig09
35
+ def tgz_name
36
+ PIG_0_9_TGZ_NAME
37
+ end
38
+
39
+ def tgz_default_url_path
40
+ PIG_0_9_TGZ_DEFAULT_URL_PATH
41
+ end
42
+
43
+ def name
44
+ "pig-#{version}"
45
+ end
46
+
47
+ def version
48
+ "0.9"
49
+ end
50
+ end
51
+
52
+ class Pig012
53
+ def tgz_name
54
+ PIG_0_12_TGZ_NAME
55
+ end
56
+
57
+ def tgz_default_url_path
58
+ PIG_0_12_TGZ_DEFAULT_URL_PATH
59
+ end
60
+
61
+ def name
62
+ "pig-#{version}"
63
+ end
64
+
65
+ def version
66
+ "0.12"
67
+ end
68
+ end
69
+
70
+ end
71
+ end
@@ -15,7 +15,7 @@ cd <%= @project_home %>/pigscripts
15
15
  source <%= @local_install_dir %>/pythonenv/bin/activate
16
16
 
17
17
  # Run Pig
18
- <%= @local_install_dir %>/pig-0.9/bin/pig -exectype local \
18
+ <%= @local_install_dir %>/<%= @pig_dir %>/bin/pig -exectype local \
19
19
  -log4jconf <%= @log4j_conf %> \
20
20
  -propertyFile <%= @local_install_dir %>/lib-common/conf/pig-hawk-global.properties \
21
21
  -propertyFile <%= @local_install_dir %>/lib-common/conf/pig-cli-local-dev.properties \
@@ -16,5 +16,5 @@
16
16
 
17
17
  module Mortar
18
18
  # see http://semver.org/
19
- VERSION = "0.11.1"
19
+ VERSION = "0.12.0"
20
20
  end
@@ -78,5 +78,121 @@ other\tgit@github.com:other.git (push)
78
78
 
79
79
  end
80
80
 
81
+ context "method_added" do
82
+ it "replaces help templates" do
83
+ lines = Base.replace_templates(["line", "start <PIG_VERSION_OPTIONS>"])
84
+ #lines.join("").should == 'linestart 0.9 (default) and 0.12 (beta)'
85
+ lines.join("").should == 'line'
86
+ end
87
+ end
88
+
89
+ context "load_defaults" do
90
+ it "no errors with no .mortar-defaults file" do
91
+ with_git_initialized_project do |p|
92
+ b = Base.new
93
+ b.options.should == {}
94
+ end
95
+ end
96
+
97
+ it "loads default only params" do
98
+ with_git_initialized_project do |p|
99
+ text = """
100
+ [DEFAULTS]
101
+ pigversion=0.12
102
+
103
+ [other]
104
+ no_browser=True
105
+ """
106
+ write_file(File.join(p.root_path, ".mortar-defaults"), text)
107
+
108
+ b = Base.new
109
+ b.options.should == {:pigversion => "0.12"}
110
+ end
111
+ end
112
+
113
+ it "loads default only params with script" do
114
+ stub_core
115
+ git = Mortar::Git::Git.new
116
+
117
+ with_git_initialized_project do |p|
118
+ text = """
119
+ [DEFAULTS]
120
+ pigversion=0.12
121
+
122
+ [other]
123
+ no_browser=True
124
+ """
125
+ write_file(File.join(p.root_path, ".mortar-defaults"), text)
126
+
127
+ describe_id = "c571a8c7f76a4fd4a67c103d753e2dd5"
128
+ describe_url = "https://api.mortardata.com/describe/#{describe_id}"
129
+
130
+ mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12", :parameters=>[]) {Excon::Response.new(:body => {"describe_id" => describe_id})}
131
+ 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
132
+ mock(Launchy).open(describe_url) {Thread.new {}}
133
+
134
+ write_file(File.join(p.pigscripts_path, "my_script.pig"))
135
+
136
+ stderr, stdout, d = execute_and_return_command("describe pigscripts/my_script.pig my_alias --polling_interval 0.05", p, git)
137
+ d.options.should == {:pigversion => "0.12", :polling_interval => "0.05"}
138
+ end
139
+ end
140
+
141
+ it "loads params for script" do
142
+ stub_core
143
+ git = Mortar::Git::Git.new
144
+
145
+ with_git_initialized_project do |p|
146
+ text = """
147
+ [DEFAULTS]
148
+ pigversion=0.12
149
+
150
+ [my_script]
151
+ no_browser=True
152
+ """
153
+ write_file(File.join(p.root_path, ".mortar-defaults"), text)
154
+
155
+ describe_id = "c571a8c7f76a4fd4a67c103d753e2dd5"
156
+ describe_url = "https://api.mortardata.com/describe/#{describe_id}"
157
+
158
+ mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.12", :parameters=>[]) {Excon::Response.new(:body => {"describe_id" => describe_id})}
159
+ 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
160
+ write_file(File.join(p.pigscripts_path, "my_script.pig"))
161
+
162
+ stderr, stdout, d = execute_and_return_command("describe pigscripts/my_script.pig my_alias --polling_interval 0.05", p, git)
163
+ d.options.should == {:pigversion => "0.12", :polling_interval => "0.05", :no_browser => "True"}
164
+ end
165
+ end
166
+
167
+ it "obeys proper overrides" do
168
+ stub_core
169
+ git = Mortar::Git::Git.new
170
+
171
+ with_git_initialized_project do |p|
172
+ text = """
173
+ [DEFAULTS]
174
+ clustersize=5
175
+ no_browser=True
176
+
177
+ [my_script]
178
+ clustersize=10
179
+ polling_interval=10
180
+ """
181
+ write_file(File.join(p.root_path, ".mortar-defaults"), text)
182
+
183
+ describe_id = "c571a8c7f76a4fd4a67c103d753e2dd5"
184
+ describe_url = "https://api.mortardata.com/describe/#{describe_id}"
185
+
186
+ mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.9", :parameters=>[]) {Excon::Response.new(:body => {"describe_id" => describe_id})}
187
+ 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
188
+ write_file(File.join(p.pigscripts_path, "my_script.pig"))
189
+
190
+ stderr, stdout, d = execute_and_return_command("describe pigscripts/my_script.pig my_alias --polling_interval 0.05", p, git)
191
+ d.options.should == {:polling_interval => "0.05", :no_browser => "True", :clustersize => "10"}
192
+ end
193
+ end
194
+
195
+ end
196
+
81
197
  end
82
198
  end
@@ -96,7 +96,7 @@ STDERR
96
96
  describe_url = "https://api.mortardata.com/describe/#{describe_id}"
97
97
  parameters = ["name"=>"key", "value"=>"value" ]
98
98
 
99
- mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :parameters => parameters) {Excon::Response.new(:body => {"describe_id" => describe_id})}
99
+ mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.9", :parameters => parameters) {Excon::Response.new(:body => {"describe_id" => describe_id})}
100
100
  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
101
101
  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
102
102
  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
@@ -127,7 +127,7 @@ STDOUT
127
127
  describe_url = "https://api.mortardata.com/describe/#{describe_id}"
128
128
  parameters = ["name"=>"key", "value"=>"value" ]
129
129
 
130
- mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :parameters => parameters) {Excon::Response.new(:body => {"describe_id" => describe_id})}
130
+ mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.9", :parameters => parameters) {Excon::Response.new(:body => {"describe_id" => describe_id})}
131
131
  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
132
132
  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
133
133
  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
@@ -161,7 +161,7 @@ STDOUT
161
161
  column_number = 32
162
162
  error_type = 'PigError'
163
163
 
164
- mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :parameters => []) {Excon::Response.new(:body => {"describe_id" => describe_id})}
164
+ mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.9", :parameters => []) {Excon::Response.new(:body => {"describe_id" => describe_id})}
165
165
  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
166
166
  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",
167
167
  "error_message" => error_message,
@@ -196,7 +196,7 @@ STDERR
196
196
  describe_url = "https://api.mortardata.com/describe/#{describe_id}"
197
197
  parameters = ["name"=>"key", "value"=>"value" ]
198
198
 
199
- mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :parameters => parameters) {Excon::Response.new(:body => {"describe_id" => describe_id})}
199
+ mock(Mortar::Auth.api).post_describe("myproject", "my_script", "my_alias", is_a(String), :pig_version => "0.9", :parameters => parameters) {Excon::Response.new(:body => {"describe_id" => describe_id})}
200
200
  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
201
201
  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
202
202
  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
@@ -72,7 +72,7 @@ STDERR
72
72
  parameters = ["name"=>"key", "value"=>"value" ]
73
73
 
74
74
  # These don't test the validity of the error message, it only tests that the CLI can handle a message returned from the server
75
- mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", false, is_a(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
75
+ mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", false, is_a(String), :pig_version => "0.9", :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
76
76
  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
77
77
  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
78
78
  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
@@ -106,7 +106,7 @@ STDOUT
106
106
  parameters = ["name"=>"key", "value"=>"value" ]
107
107
 
108
108
  # These don't test the validity of the error message, it only tests that the CLI can handle a message returned from the server
109
- mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", false, is_a(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
109
+ mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", false, is_a(String), :pig_version => "0.9", :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
110
110
  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
111
111
  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
112
112
  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
@@ -140,7 +140,7 @@ STDOUT
140
140
  parameters = ["name"=>"key", "value"=>"value" ]
141
141
 
142
142
  # These don't test the validity of the error message, it only tests that the CLI can handle a message returned from the server
143
- mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", false, is_a(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
143
+ mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", false, is_a(String), :pig_version => "0.9", :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
144
144
  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
145
145
  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
146
146
 
@@ -167,7 +167,7 @@ STDOUT
167
167
  parameters = ["name"=>"key", "value"=>"value" ]
168
168
 
169
169
  # These don't test the validity of the error message, it only tests that the CLI can handle a message returned from the server
170
- mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", true, is_a(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
170
+ mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", true, is_a(String), :pig_version => "0.9", :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
171
171
  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
172
172
  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
173
173
 
@@ -193,7 +193,7 @@ STDOUT
193
193
  parameters = ["name"=>"key", "value"=>"value" ]
194
194
 
195
195
  # These don't test the validity of the error message, it only tests that the CLI can handle a message returned from the server
196
- mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", nil, false, is_a(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
196
+ mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", nil, false, is_a(String), :pig_version => "0.9", :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
197
197
  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
198
198
  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
199
199
  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
@@ -230,7 +230,7 @@ STDOUT
230
230
  error_type = 'PigError'
231
231
 
232
232
  # These don't test the validity of the error message, it only tests that the CLI can handle a message returned from the server
233
- mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", false, is_a(String), :parameters => []) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
233
+ mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", false, is_a(String), :pig_version => "0.9", :parameters => []) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
234
234
  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
235
235
  mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_FAILURE,
236
236
  "error_message" => error_message,
@@ -266,7 +266,7 @@ STDERR
266
266
  parameters = ["name"=>"key", "value"=>"value" ]
267
267
 
268
268
  # These don't test the validity of the error message, it only tests that the CLI can handle a message returned from the server
269
- mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", nil, false, is_a(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
269
+ mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", nil, false, is_a(String), :pig_version => "0.9", :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
270
270
  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
271
271
  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
272
272
  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,6 +47,7 @@ module Mortar::Command
47
47
  cluster_size = 5
48
48
 
49
49
  mock(Mortar::Auth.api).post_job_new_cluster("myproject", "my_script", is_a(String), cluster_size,
50
+ :pig_version => "0.9",
50
51
  :parameters => match_array([{"name" => "FIRST_PARAM", "value" => "FOO"}, {"name" => "SECOND_PARAM", "value" => "BAR"}]),
51
52
  :cluster_type => Jobs::CLUSTER_TYPE__SINGLE_JOB,
52
53
  :notify_on_job_finish => true,
@@ -79,7 +80,8 @@ STDOUT
79
80
  job_url = "http://127.0.0.1:5000/jobs/job_detail?job_id=c571a8c7f76a4fd4a67c103d753e2dd5"
80
81
  cluster_size = 5
81
82
 
82
- mock(Mortar::Auth.api).post_job_new_cluster("myproject", "my_script", is_a(String), cluster_size,
83
+ mock(Mortar::Auth.api).post_job_new_cluster("myproject", "my_script", is_a(String),cluster_size,
84
+ :pig_version => "0.9",
83
85
  :parameters => match_array([{"name" => "FIRST_PARAM", "value" => "FOO"}, {"name" => "SECOND_PARAM", "value" => "BAR"}]),
84
86
  :cluster_type => Jobs::CLUSTER_TYPE__PERMANENT,
85
87
  :notify_on_job_finish => true,
@@ -136,7 +138,8 @@ STDERR
136
138
  job_url = "http://127.0.0.1:5000/jobs/job_detail?job_id=c571a8c7f76a4fd4a67c103d753e2dd5"
137
139
  cluster_size = 5
138
140
 
139
- mock(Mortar::Auth.api).post_job_new_cluster("myproject", "my_script", is_a(String), cluster_size,
141
+ mock(Mortar::Auth.api).post_job_new_cluster("myproject", "my_script", is_a(String),cluster_size,
142
+ :pig_version => "0.9",
140
143
  :parameters => match_array([{"name" => "FIRST_PARAM", "value" => "FOO"}, {"name" => "SECOND_PARAM", "value" => "BAR"}]),
141
144
  :cluster_type => Jobs::CLUSTER_TYPE__PERSISTENT,
142
145
  :notify_on_job_finish => true,
@@ -170,6 +173,7 @@ STDOUT
170
173
  cluster_id = "e2790e7e8c7d48e39157238d58191346"
171
174
 
172
175
  mock(Mortar::Auth.api).post_job_existing_cluster("myproject", "my_script", is_a(String), cluster_id,
176
+ :pig_version => "0.9",
173
177
  :parameters => [],
174
178
  :notify_on_job_finish => false,
175
179
  :is_control_script=>true) {Excon::Response.new(:body => {"job_id" => job_id, "web_job_url" => job_url})}
@@ -202,6 +206,7 @@ STDOUT
202
206
  cluster_id = "e2790e7e8c7d48e39157238d58191346"
203
207
 
204
208
  mock(Mortar::Auth.api).post_job_existing_cluster("myproject", "my_script", is_a(String), cluster_id,
209
+ :pig_version => "0.9",
205
210
  :parameters => [],
206
211
  :notify_on_job_finish => false,
207
212
  :is_control_script=>true) {Excon::Response.new(:body => {"job_id" => job_id, "web_job_url" => job_url})}
@@ -234,6 +239,7 @@ STDOUT
234
239
 
235
240
  mock(Mortar::Auth.api).get_clusters() {Excon::Response.new(:body => {'clusters' => []})}
236
241
  mock(Mortar::Auth.api).post_job_new_cluster("myproject", "my_script", is_a(String), cluster_size,
242
+ :pig_version => "0.9",
237
243
  :parameters => [],
238
244
  :cluster_type => Jobs::CLUSTER_TYPE__PERSISTENT,
239
245
  :notify_on_job_finish => true,
@@ -269,6 +275,7 @@ STDOUT
269
275
 
270
276
  mock(Mortar::Auth.api).get_clusters() {Excon::Response.new(:body => {'clusters' => []})}
271
277
  mock(Mortar::Auth.api).post_job_new_cluster("myproject", "my_script", is_a(String), cluster_size,
278
+ :pig_version => "0.9",
272
279
  :parameters => [],
273
280
  :cluster_type => Jobs::CLUSTER_TYPE__PERSISTENT,
274
281
  :notify_on_job_finish => true,
@@ -303,7 +310,7 @@ STDOUT
303
310
  job_url = "http://127.0.0.1:5000/jobs/job_detail?job_id=c571a8c7f76a4fd4a67c103d753e2dd5"
304
311
  cluster_id = "e2790e7e8c7d48e39157238d58191346"
305
312
 
306
- mock(Mortar::Auth.api).post_job_existing_cluster("myproject", "my_script", is_a(String), cluster_id, :parameters => [], :notify_on_job_finish => false, :is_control_script=>false) {Excon::Response.new(:body => {"job_id" => job_id, "web_job_url" => job_url})}
313
+ mock(Mortar::Auth.api).post_job_existing_cluster("myproject", "my_script", is_a(String), cluster_id, :pig_version => "0.9", :parameters => [], :notify_on_job_finish => false, :is_control_script=>false) {Excon::Response.new(:body => {"job_id" => job_id, "web_job_url" => job_url})}
307
314
 
308
315
  write_file(File.join(p.pigscripts_path, "my_script.pig"))
309
316
  stderr, stdout = execute("jobs:run pigscripts/my_script.pig --clusterid e2790e7e8c7d48e39157238d58191346 -d", p, @git)
@@ -356,6 +363,7 @@ STDOUT
356
363
  ]})
357
364
  }
358
365
  mock(Mortar::Auth.api).post_job_existing_cluster("myproject", "my_script", is_a(String), large_cluster_id,
366
+ :pig_version => "0.9",
359
367
  :parameters => [],
360
368
  :notify_on_job_finish => true,
361
369
  :is_control_script=>false) {Excon::Response.new(:body => {"job_id" => job_id, "web_job_url" => job_url})}
@@ -388,6 +396,7 @@ STDOUT
388
396
  cluster_size = 5
389
397
 
390
398
  mock(Mortar::Auth.api).post_job_new_cluster("myproject", "my_script", is_a(String), cluster_size,
399
+ :pig_version => "0.9",
391
400
  :parameters => match_array([{"name" => "FIRST", "value" => "FOO"}, {"name" => "SECOND", "value" => "BAR"}, {"name" => "THIRD", "value" => "BEAR"}]),
392
401
  :cluster_type => Jobs::CLUSTER_TYPE__PERSISTENT,
393
402
  :notify_on_job_finish => true,
@@ -413,6 +422,7 @@ PARAMS
413
422
  cluster_size = 5
414
423
 
415
424
  mock(Mortar::Auth.api).post_job_new_cluster("myproject", "my_script", is_a(String), cluster_size,
425
+ :pig_version => "0.9",
416
426
  :parameters => match_array([{"name" => "FIRST", "value" => "FOO"}, {"name" => "SECOND", "value" => "BAR"}, {"name" => "THIRD", "value" => "BEAR"}]),
417
427
  :cluster_type => Jobs::CLUSTER_TYPE__PERSISTENT,
418
428
  :notify_on_job_finish => true,
@@ -466,6 +476,7 @@ STDERR
466
476
  mock(@git).sync_embedded_project.with_any_args.times(1) { "somewhere_over_the_rainbow" }
467
477
 
468
478
  mock(Mortar::Auth.api).post_job_new_cluster("myproject", "my_script", is_a(String), cluster_size,
479
+ :pig_version => "0.9",
469
480
  :parameters => match_array([{"name" => "FIRST_PARAM", "value" => "FOO"}, {"name" => "SECOND_PARAM", "value" => "BAR"}]),
470
481
  :cluster_type => Jobs::CLUSTER_TYPE__PERSISTENT,
471
482
  :notify_on_job_finish => true,
@@ -44,7 +44,7 @@ STDERR
44
44
  pigscript = Mortar::Project::PigScript.new(script_name, script_path)
45
45
  mock(Mortar::Project::PigScript).new(script_name, script_path).returns(pigscript)
46
46
  any_instance_of(Mortar::Local::Controller) do |u|
47
- mock(u).illustrate(pigscript, "some_alias", [], false).returns(nil)
47
+ mock(u).illustrate(pigscript, "some_alias", is_a(Mortar::PigVersion::Pig09), [], false).returns(nil)
48
48
  end
49
49
  stderr, stdout = execute("local:illustrate #{script_name} some_alias", p)
50
50
  stderr.should == ""
@@ -59,9 +59,9 @@ STDERR
59
59
  pigscript = Mortar::Project::PigScript.new(script_name, script_path)
60
60
  mock(Mortar::Project::PigScript).new(script_name, script_path).returns(pigscript)
61
61
  any_instance_of(Mortar::Local::Controller) do |u|
62
- mock(u).illustrate(pigscript, nil, [], false).returns(nil)
62
+ mock(u).illustrate(pigscript, nil, is_a(Mortar::PigVersion::Pig012), [], false).returns(nil)
63
63
  end
64
- stderr, stdout = execute("local:illustrate #{script_name}", p)
64
+ stderr, stdout = execute("local:illustrate #{script_name} -g 0.12", p)
65
65
  stderr.should == ""
66
66
  end
67
67
  end
@@ -96,9 +96,9 @@ STDERR
96
96
  pigscript = Mortar::Project::PigScript.new(script_name, script_path)
97
97
  mock(Mortar::Project::PigScript).new(script_name, script_path).returns(pigscript)
98
98
  any_instance_of(Mortar::Local::Controller) do |u|
99
- mock(u).run(pigscript, []).returns(nil)
99
+ mock(u).run(pigscript, is_a(Mortar::PigVersion::Pig09), []).returns(nil)
100
100
  end
101
- stderr, stdout = execute("local:run pigscripts/#{script_name}.pig", p)
101
+ stderr, stdout = execute("local:run pigscripts/#{script_name}.pig -g 0.9", p)
102
102
  stderr.should == ""
103
103
  end
104
104
  end
@@ -167,7 +167,7 @@ PARAMS
167
167
  mock(j).check_install.returns(true)
168
168
  end
169
169
  any_instance_of(Mortar::Local::Pig) do |j|
170
- mock(j).install_pig.returns(true)
170
+ mock(j).install_pig.with_any_args.returns(true)
171
171
  stub(j).install_lib.returns(true)
172
172
  end
173
173
  any_instance_of(Mortar::Local::Python) do |j|
@@ -198,10 +198,10 @@ PARAMS
198
198
  pigscript = Mortar::Project::PigScript.new(script_name, script_path)
199
199
  mock(Mortar::Project::PigScript).new(script_name, script_path).returns(pigscript)
200
200
  any_instance_of(Mortar::Local::Controller) do |u|
201
- mock(u).install_and_configure
201
+ mock(u).install_and_configure(is_a(Mortar::PigVersion::Pig09))
202
202
  end
203
203
  any_instance_of(Mortar::Local::Pig) do |u|
204
- mock(u).run_pig_command(" -check #{pigscript.path}", [])
204
+ mock(u).run_pig_command(" -check #{pigscript.path}", is_a(Mortar::PigVersion::Pig09), [])
205
205
  end
206
206
  stderr, stdout = execute("local:validate #{script_name}", p)
207
207
  stderr.should == ""
@@ -216,10 +216,10 @@ PARAMS
216
216
  pigscript = Mortar::Project::PigScript.new(script_name, script_path)
217
217
  mock(Mortar::Project::PigScript).new(script_name, script_path).returns(pigscript)
218
218
  any_instance_of(Mortar::Local::Controller) do |u|
219
- mock(u).install_and_configure
219
+ mock(u).install_and_configure(is_a(Mortar::PigVersion::Pig09))
220
220
  end
221
221
  any_instance_of(Mortar::Local::Pig) do |u|
222
- mock(u).run_pig_command(" -check #{pigscript.path}", [])
222
+ mock(u).run_pig_command(" -check #{pigscript.path}", is_a(Mortar::PigVersion::Pig09), [])
223
223
  end
224
224
  stderr, stdout = execute("local:validate pigscripts/#{script_name}.pig", p)
225
225
  stderr.should == ""