neptune 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README +3 -0
  2. data/bin/neptune +1 -1
  3. data/lib/neptune.rb +31 -11
  4. data/test/ts_neptune.rb +1 -0
  5. metadata +4 -4
data/README CHANGED
@@ -66,6 +66,9 @@ in for a link to that as it becomes available.
66
66
 
67
67
  Version History:
68
68
 
69
+ May 28, 2011 - 0.0.9 released, adding generic SSA support
70
+ for users wanting to use StochKit and other SSA codes.
71
+
69
72
  April 8, 2011 - 0.0.8 released, fixing MapReduce support
70
73
  for both regular Hadoop and Hadoop Streaming. Also increased
71
74
  code coverage to cover a number of failure scenarios.
data/bin/neptune CHANGED
@@ -18,6 +18,6 @@ else
18
18
  end
19
19
 
20
20
  params = Hash[*ARGV]
21
- puts neptune(params)
21
+ puts neptune(params).inspect
22
22
  end
23
23
 
data/lib/neptune.rb CHANGED
@@ -163,6 +163,8 @@ def neptune(params)
163
163
 
164
164
  job_data["@job"] = nil
165
165
  job_data["@keyname"] = keyname || "appscale"
166
+
167
+ job_data["@type"] = job_data["@type"].to_s
166
168
  type = job_data["@type"]
167
169
 
168
170
  if type == "upc" or type == "x10"
@@ -230,6 +232,10 @@ def neptune(params)
230
232
 
231
233
  ssh_args = "-i ~/.appscale/#{keyname}.key -o StrictHostkeyChecking=no "
232
234
 
235
+ # TODO - right now the job is assumed to succeed in many cases
236
+ # need to investigate the various failure scenarios
237
+ result = { :result => :success }
238
+
233
239
  if type == "input"
234
240
  # copy file to remote
235
241
  # set location
@@ -247,15 +253,15 @@ def neptune(params)
247
253
 
248
254
  job_data["@local"] = remote
249
255
  puts "job data = #{job_data.inspect}"
250
- return controller.put_input(job_data)
256
+ result[:input] = controller.put_input(job_data)
251
257
  elsif type == "output"
252
- return controller.get_output(job_data)
258
+ result[:output] = controller.get_output(job_data)
253
259
  elsif type == "get-acl"
254
260
  job_data["@type"] = "acl"
255
- return controller.get_acl(job_data)
261
+ result[:acl] = controller.get_acl(job_data)
256
262
  elsif type == "set-acl"
257
263
  job_data["@type"] = "acl"
258
- return controller.set_acl(job_data)
264
+ result[:acl] = controller.set_acl(job_data)
259
265
  elsif type == "compile"
260
266
  compiled_location = controller.compile_code(job_data)
261
267
 
@@ -283,16 +289,30 @@ def neptune(params)
283
289
  puts scp_command
284
290
  `#{scp_command}`
285
291
 
292
+ code = job_data["@code"]
293
+ dirs = code.split(/\//)
294
+ remote_dir = "/tmp/" + dirs[-1]
295
+
296
+ ssh_command = "ssh #{ssh_args} root@#{shadow_ip} 'rm -rf #{remote_dir}' 2>&1"
297
+ puts ssh_command
298
+ `#{ssh_command}`
299
+
300
+ ssh_command = "ssh #{ssh_args} root@#{shadow_ip} 'rm -rf #{compiled_location}' 2>&1"
301
+ puts ssh_command
302
+ `#{ssh_command}`
303
+
286
304
  out = File.open("#{copy_to}/compile_out") { |f| f.read.chomp! }
287
305
  err = File.open("#{copy_to}/compile_err") { |f| f.read.chomp! }
288
- return {:out => out, :err => err }
306
+ result[:out] = out
307
+ result[:err] = err
308
+
309
+ result[:result] = :failure if result[:err].any?
289
310
  else
290
- result = controller.start_neptune_job(job_data)
291
- if result =~ /job is now running\Z/
292
- return {:result => :success, :msg => result}
293
- else
294
- return {:result => :failure, :msg => result}
295
- end
311
+ msg = controller.start_neptune_job(job_data)
312
+ result[:msg] = msg
313
+ result[:result] = :failure if result[:msg] !~ /job is now running\Z/
296
314
  end
315
+
316
+ return result
297
317
  end
298
318
 
data/test/ts_neptune.rb CHANGED
@@ -12,6 +12,7 @@ S3_ACCESS_KEY S3_SECRET_KEY S3_URL
12
12
  WALRUS_ACCESS_KEY WALRUS_SECRET_KEY WALRUS_URL }
13
13
 
14
14
  require 'test/unit'
15
+ require 'rubygems'
15
16
  require 'flexmock/test_unit'
16
17
 
17
18
  REQUIRED_CREDS.each { |cred|
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neptune
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Bunch
@@ -15,7 +15,7 @@ autorequire: neptune
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-08 00:00:00 -07:00
18
+ date: 2011-05-28 00:00:00 -07:00
19
19
  default_executable: neptune
20
20
  dependencies: []
21
21