neptune 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +19 -3
- data/doc/AppControllerClient.html +53 -7
- data/doc/CommonFunctions.html +16 -12
- data/doc/Object.html +200 -39
- data/doc/README.html +55 -17
- data/doc/bin/neptune.html +2 -6
- data/doc/created.rid +6 -6
- data/doc/index.html +6 -2
- data/doc/lib/app_controller_client_rb.html +1 -1
- data/doc/lib/common_functions_rb.html +1 -1
- data/doc/lib/neptune_rb.html +56 -0
- data/lib/common_functions.rb +0 -1
- data/lib/neptune.rb +17 -18
- data/test/tc_c.rb +57 -0
- data/test/tc_dfsp.rb +37 -0
- data/test/tc_dwssa.rb +38 -0
- data/test/tc_erlang.rb +157 -0
- data/test/tc_mapreduce.rb +207 -0
- data/test/tc_mpi.rb +124 -0
- data/test/tc_storage.rb +45 -0
- data/test/tc_upc.rb +75 -0
- data/test/tc_x10.rb +94 -0
- data/test/test_helper.rb +137 -0
- data/test/ts_neptune.rb +41 -0
- metadata +16 -4
data/test/tc_storage.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
class TestStorage < Test::Unit::TestCase
|
3
|
+
def test_in_out
|
4
|
+
STORAGE_TYPES.each { |storage|
|
5
|
+
run_in_out(storage)
|
6
|
+
}
|
7
|
+
end
|
8
|
+
|
9
|
+
def run_in_out(storage)
|
10
|
+
contents = TestHelper.get_random_alphanumeric(1024)
|
11
|
+
suffix = "neptune-testfile-#{TestHelper.get_random_alphanumeric}"
|
12
|
+
local = "/tmp/#{suffix}"
|
13
|
+
TestHelper.write_file(local, contents)
|
14
|
+
|
15
|
+
run_input(local, suffix, storage)
|
16
|
+
run_output(contents, suffix, storage)
|
17
|
+
|
18
|
+
FileUtils.rm_rf(local)
|
19
|
+
end
|
20
|
+
|
21
|
+
def run_input(local, suffix, storage)
|
22
|
+
params = {
|
23
|
+
:type => "input",
|
24
|
+
:local => local,
|
25
|
+
:remote => TestHelper.get_output_location(suffix, storage)
|
26
|
+
}.merge(TestHelper.get_storage_params(storage))
|
27
|
+
|
28
|
+
input_result = neptune(params)
|
29
|
+
|
30
|
+
msg = "We were unable to store a file in the database. We " +
|
31
|
+
" got back this: #{msg}"
|
32
|
+
assert(input_result, msg)
|
33
|
+
end
|
34
|
+
|
35
|
+
def run_output(local, suffix, storage)
|
36
|
+
output = TestHelper.get_output_location(suffix, storage)
|
37
|
+
remote = TestHelper.get_job_output(output, storage)
|
38
|
+
|
39
|
+
msg = "We were unable to verify that the remote file matches the " +
|
40
|
+
"local version. The local copy's contents are: " +
|
41
|
+
"[#{local}], while the remote copy's contents are [#{remote}]."
|
42
|
+
assert_equal(local, remote, msg)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
data/test/tc_upc.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
|
2
|
+
class TestUPC < Test::Unit::TestCase
|
3
|
+
def test_hello_world_code
|
4
|
+
STORAGE_TYPES.each { |storage|
|
5
|
+
run_hello_world_code(storage)
|
6
|
+
}
|
7
|
+
end
|
8
|
+
|
9
|
+
def run_hello_world_code(storage)
|
10
|
+
expected_output = "Hello from thread 0"
|
11
|
+
ring_code = <<BAZ
|
12
|
+
#include <upc_relaxed.h>
|
13
|
+
#include <stdio.h>
|
14
|
+
|
15
|
+
int main() {
|
16
|
+
printf("Hello from thread %i/%i", MYTHREAD, THREADS);
|
17
|
+
upc_barrier;
|
18
|
+
return 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
BAZ
|
22
|
+
|
23
|
+
contents = TestHelper.get_random_alphanumeric(1024)
|
24
|
+
folder = "hello-world-#{TestHelper.get_random_alphanumeric}"
|
25
|
+
source = "HelloWorld.c"
|
26
|
+
|
27
|
+
tmp_folder = "/tmp/#{folder}"
|
28
|
+
FileUtils.mkdir_p(tmp_folder)
|
29
|
+
compiled = "#{tmp_folder}-compiled"
|
30
|
+
compiled_code = "#{compiled}/HelloWorld"
|
31
|
+
|
32
|
+
local = "#{tmp_folder}/#{source}"
|
33
|
+
TestHelper.write_file(local, ring_code)
|
34
|
+
|
35
|
+
output = TestHelper.get_output_location(folder, storage)
|
36
|
+
|
37
|
+
compile_upc_code(tmp_folder, source, compiled)
|
38
|
+
start_upc_code(compiled_code, output, storage)
|
39
|
+
get_upc_output(output, expected_output, storage)
|
40
|
+
|
41
|
+
FileUtils.rm_rf(tmp_folder)
|
42
|
+
FileUtils.rm_rf(compiled)
|
43
|
+
end
|
44
|
+
|
45
|
+
def compile_upc_code(location, main_file, compiled)
|
46
|
+
std_out, std_err = TestHelper.compile_code(location, main_file, compiled)
|
47
|
+
|
48
|
+
make = "/usr/local/berkeley_upc-2.12.1/upcc --network=mpi -o HelloWorld HelloWorld.c"
|
49
|
+
msg = "The UPC code did not compile as expected. It should have " +
|
50
|
+
"compiled with the command [#{make}] instead of [#{std_out}]."
|
51
|
+
assert_equal(std_out, make, msg)
|
52
|
+
|
53
|
+
msg = "The UPC code did not compile successfully. It reported " +
|
54
|
+
"the following error: #{std_err}"
|
55
|
+
assert_nil(std_err, msg)
|
56
|
+
end
|
57
|
+
|
58
|
+
def start_upc_code(code_location, output, storage)
|
59
|
+
status = TestHelper.start_job("upc", code_location, output, storage)
|
60
|
+
|
61
|
+
msg = "Your job was not started successfully. The failure message " +
|
62
|
+
"reported was #{status[:msg]}"
|
63
|
+
assert_equal(status[:result], :success, msg)
|
64
|
+
end
|
65
|
+
|
66
|
+
def get_upc_output(output, expected, storage)
|
67
|
+
result = TestHelper.get_job_output(output, storage)
|
68
|
+
|
69
|
+
msg = "The UPC job you ran did not return the expected result. " +
|
70
|
+
"We expected to see [#{expected}] but instead saw [#{result}]"
|
71
|
+
success = result.include?(expected)
|
72
|
+
assert(success, msg)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
data/test/tc_x10.rb
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
|
2
|
+
class TestX10 < Test::Unit::TestCase
|
3
|
+
def test_ring_code
|
4
|
+
STORAGE_TYPES.each { |storage|
|
5
|
+
run_ring_code(storage)
|
6
|
+
}
|
7
|
+
end
|
8
|
+
|
9
|
+
def run_ring_code(storage)
|
10
|
+
expected_output = "All done!"
|
11
|
+
ring_code = <<BAZ
|
12
|
+
import x10.lang.Math;
|
13
|
+
import x10.util.Timer;
|
14
|
+
|
15
|
+
public class Ring {
|
16
|
+
|
17
|
+
static val NUM_MESSAGES = 1;
|
18
|
+
|
19
|
+
// A global datastructure with one integer cell per place
|
20
|
+
static A = PlaceLocalHandle.make[Cell[Long]](Dist.makeUnique(), ()=>new Cell[Long](-1));
|
21
|
+
|
22
|
+
public static def send (msg:Long, depth:Int) {
|
23
|
+
A()() = msg;
|
24
|
+
if (depth==0) return;
|
25
|
+
async at (here.next()) send(msg, depth-1);
|
26
|
+
}
|
27
|
+
|
28
|
+
public static def main(args:Array[String](1)) {
|
29
|
+
|
30
|
+
val startTime = Timer.milliTime();
|
31
|
+
finish send(42L, NUM_MESSAGES * Place.MAX_PLACES);
|
32
|
+
val endTime = Timer.milliTime();
|
33
|
+
|
34
|
+
val totalTime = (endTime - startTime) / 1000.0;
|
35
|
+
|
36
|
+
Console.OUT.printf("#{expected_output}");
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
BAZ
|
41
|
+
|
42
|
+
contents = TestHelper.get_random_alphanumeric(1024)
|
43
|
+
folder = "ring-#{TestHelper.get_random_alphanumeric}"
|
44
|
+
source = "Ring.x10"
|
45
|
+
|
46
|
+
tmp_folder = "/tmp/#{folder}"
|
47
|
+
FileUtils.mkdir_p(tmp_folder)
|
48
|
+
compiled = "#{tmp_folder}-compiled"
|
49
|
+
compiled_code = "#{compiled}/Ring"
|
50
|
+
|
51
|
+
local = "#{tmp_folder}/#{source}"
|
52
|
+
TestHelper.write_file(local, ring_code)
|
53
|
+
|
54
|
+
output = TestHelper.get_output_location(folder, storage)
|
55
|
+
|
56
|
+
compile_x10_code(tmp_folder, source, compiled)
|
57
|
+
start_x10_code(compiled_code, output, storage)
|
58
|
+
get_x10_output(output, expected_output, storage)
|
59
|
+
|
60
|
+
FileUtils.rm_rf(tmp_folder)
|
61
|
+
FileUtils.rm_rf(compiled)
|
62
|
+
end
|
63
|
+
|
64
|
+
def compile_x10_code(location, main_file, compiled)
|
65
|
+
std_out, std_err = TestHelper.compile_code(location, main_file, compiled)
|
66
|
+
|
67
|
+
make = "/usr/local/x10/x10.dist/bin/x10c++ -x10rt mpi -o Ring Ring.x10"
|
68
|
+
msg = "The X10 Ring code did not compile as expected. It should have " +
|
69
|
+
"compiled with the command [#{make}] instead of [#{std_out}]."
|
70
|
+
assert_equal(std_out, make, msg)
|
71
|
+
|
72
|
+
msg = "The X10 Ring code did not compile successfully. It reported " +
|
73
|
+
"the following error: #{std_err}"
|
74
|
+
compile_success = !std_err.include?("error")
|
75
|
+
assert(compile_success, msg)
|
76
|
+
end
|
77
|
+
|
78
|
+
def start_x10_code(code_location, output, storage)
|
79
|
+
status = TestHelper.start_job("x10", code_location, output, storage)
|
80
|
+
|
81
|
+
msg = "Your job was not started successfully. The failure message " +
|
82
|
+
"reported was #{status[:msg]}"
|
83
|
+
assert_equal(status[:result], :success, msg)
|
84
|
+
end
|
85
|
+
|
86
|
+
def get_x10_output(output, expected, storage)
|
87
|
+
result = TestHelper.get_job_output(output, storage)
|
88
|
+
|
89
|
+
msg = "The X10 job you ran did not return the expected result. " +
|
90
|
+
"We expected to see [#{expected}] but instead saw [#{result}]"
|
91
|
+
assert_equal(result, expected, msg)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Programmer: Chris Bunch
|
3
|
+
|
4
|
+
module TestHelper
|
5
|
+
def self.compile_code(location, main_file, compiled_location)
|
6
|
+
result = neptune(
|
7
|
+
:type => "compile",
|
8
|
+
:code => location,
|
9
|
+
:main => main_file,
|
10
|
+
:output => "/baz",
|
11
|
+
:copy_to => compiled_location
|
12
|
+
)
|
13
|
+
|
14
|
+
puts "standard out is #{result[:out]}"
|
15
|
+
puts "standard err is #{result[:err]}"
|
16
|
+
|
17
|
+
return result[:out], result[:err]
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.start_job(type, code_location, output, storage, extras={})
|
21
|
+
params = {
|
22
|
+
:type => type,
|
23
|
+
:code => code_location,
|
24
|
+
:output => output,
|
25
|
+
:nodes_to_use => 1
|
26
|
+
}.merge(TestHelper.get_storage_params(storage)).merge(extras)
|
27
|
+
|
28
|
+
status = nil
|
29
|
+
|
30
|
+
loop {
|
31
|
+
status = neptune(params)
|
32
|
+
if status[:msg] =~ /not enough free nodes/
|
33
|
+
puts status[:msg]
|
34
|
+
else
|
35
|
+
break
|
36
|
+
end
|
37
|
+
sleep(5)
|
38
|
+
}
|
39
|
+
|
40
|
+
return status
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.get_job_output(output, storage)
|
44
|
+
result = ""
|
45
|
+
|
46
|
+
params = {
|
47
|
+
:type => "output",
|
48
|
+
:output => output
|
49
|
+
}.merge(TestHelper.get_storage_params(storage))
|
50
|
+
|
51
|
+
loop {
|
52
|
+
result = neptune(params)
|
53
|
+
|
54
|
+
break if result != "error: output does not exist"
|
55
|
+
puts "Waiting for job to complete..."
|
56
|
+
sleep(30)
|
57
|
+
}
|
58
|
+
|
59
|
+
return result
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.get_output_location(file, storage="appdb", notxt=false)
|
63
|
+
output = "/neptune"
|
64
|
+
|
65
|
+
if storage == "walrus"
|
66
|
+
output << "_"
|
67
|
+
else
|
68
|
+
output << "-"
|
69
|
+
end
|
70
|
+
|
71
|
+
output << "testbin/#{file}"
|
72
|
+
if !notxt
|
73
|
+
output << ".txt"
|
74
|
+
end
|
75
|
+
|
76
|
+
return output
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.get_storage_params(storage)
|
80
|
+
if storage == "gstorage"
|
81
|
+
return {
|
82
|
+
:storage => "gstorage",
|
83
|
+
:EC2_ACCESS_KEY => ENV['GSTORAGE_ACCESS_KEY'],
|
84
|
+
:EC2_SECRET_KEY => ENV['GSTORAGE_SECRET_KEY'],
|
85
|
+
:S3_URL => ENV['GSTORAGE_URL']
|
86
|
+
}
|
87
|
+
elsif storage == "s3"
|
88
|
+
return {
|
89
|
+
:storage => "s3",
|
90
|
+
:EC2_ACCESS_KEY => ENV['S3_ACCESS_KEY'],
|
91
|
+
:EC2_SECRET_KEY => ENV['S3_SECRET_KEY'],
|
92
|
+
:S3_URL => ENV['S3_URL']
|
93
|
+
}
|
94
|
+
elsif storage == "walrus"
|
95
|
+
return {
|
96
|
+
:storage => "s3",
|
97
|
+
:EC2_ACCESS_KEY => ENV['WALRUS_ACCESS_KEY'],
|
98
|
+
:EC2_SECRET_KEY => ENV['WALRUS_SECRET_KEY'],
|
99
|
+
:S3_URL => ENV['WALRUS_URL']
|
100
|
+
}
|
101
|
+
elsif storage == "appdb"
|
102
|
+
return {}
|
103
|
+
# nothing special to do
|
104
|
+
else
|
105
|
+
abort "Storage specified was not an acceptable value: #{storage}"
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.write_file(location, contents)
|
110
|
+
File.open(location, "w+") { |file| file.write(contents) }
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.read_file(location)
|
114
|
+
File.open(location) { |f| f.read.chomp! }
|
115
|
+
end
|
116
|
+
|
117
|
+
def self.get_random_alphanumeric(length=10)
|
118
|
+
random = ""
|
119
|
+
possible = "0123456789abcdefghijklmnopqrstuvxwyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
120
|
+
possibleLength = possible.length
|
121
|
+
|
122
|
+
length.times { |index|
|
123
|
+
random << possible[rand(possibleLength)]
|
124
|
+
}
|
125
|
+
|
126
|
+
return random
|
127
|
+
end
|
128
|
+
|
129
|
+
def self.is_appscale_running?(ip)
|
130
|
+
begin
|
131
|
+
Net::HTTP.get_response(URI.parse("http://#{ip}"))
|
132
|
+
return true
|
133
|
+
rescue Exception
|
134
|
+
return false
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
data/test/ts_neptune.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
#STORAGE_TYPES = ["gstorage"]
|
2
|
+
STORAGE_TYPES = ["appdb", "gstorage", "s3", "walrus"]
|
3
|
+
|
4
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
5
|
+
require 'neptune'
|
6
|
+
|
7
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "test")
|
8
|
+
require 'test_helper'
|
9
|
+
|
10
|
+
REQUIRED_CREDS = %w{ APPSCALE_HEAD_NODE
|
11
|
+
GSTORAGE_ACCESS_KEY GSTORAGE_SECRET_KEY GSTORAGE_URL
|
12
|
+
S3_ACCESS_KEY S3_SECRET_KEY S3_URL
|
13
|
+
WALRUS_ACCESS_KEY WALRUS_SECRET_KEY WALRUS_URL }
|
14
|
+
|
15
|
+
require 'test/unit'
|
16
|
+
|
17
|
+
REQUIRED_CREDS.each { |cred|
|
18
|
+
msg = "The environment variable #{cred} was not set. Please " +
|
19
|
+
"set it and try again."
|
20
|
+
abort(msg) if ENV[cred].nil?
|
21
|
+
}
|
22
|
+
|
23
|
+
APPSCALE_HEAD_NODE_IP = ENV['APPSCALE_HEAD_NODE']
|
24
|
+
msg = "AppScale is not currently running at " +
|
25
|
+
"#{APPSCALE_HEAD_NODE_IP}. Please start AppScale and try again."
|
26
|
+
abort(msg) unless TestHelper.is_appscale_running?(APPSCALE_HEAD_NODE_IP)
|
27
|
+
|
28
|
+
TEST_ALL_WORKING = true
|
29
|
+
|
30
|
+
if TEST_ALL_WORKING
|
31
|
+
require 'tc_c'
|
32
|
+
require 'tc_dfsp'
|
33
|
+
require 'tc_dwssa'
|
34
|
+
require 'tc_erlang'
|
35
|
+
require 'tc_mpi'
|
36
|
+
require 'tc_storage'
|
37
|
+
require 'tc_upc'
|
38
|
+
require 'tc_x10'
|
39
|
+
else
|
40
|
+
require 'tc_mapreduce'
|
41
|
+
end
|
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:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
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-
|
18
|
+
date: 2011-04-02 00:00:00 -07:00
|
19
19
|
default_executable: neptune
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -40,6 +40,7 @@ files:
|
|
40
40
|
- doc/AppControllerClient.html
|
41
41
|
- doc/LICENSE.html
|
42
42
|
- doc/lib/job_rb.html
|
43
|
+
- doc/lib/neptune_rb.html
|
43
44
|
- doc/lib/app_controller_client_rb.html
|
44
45
|
- doc/lib/common_functions_rb.html
|
45
46
|
- doc/index.html
|
@@ -105,6 +106,17 @@ files:
|
|
105
106
|
- lib/common_functions.rb
|
106
107
|
- lib/app_controller_client.rb
|
107
108
|
- lib/neptune.rb
|
109
|
+
- test/tc_c.rb
|
110
|
+
- test/tc_dfsp.rb
|
111
|
+
- test/test_helper.rb
|
112
|
+
- test/tc_mpi.rb
|
113
|
+
- test/tc_dwssa.rb
|
114
|
+
- test/tc_erlang.rb
|
115
|
+
- test/tc_storage.rb
|
116
|
+
- test/tc_x10.rb
|
117
|
+
- test/tc_upc.rb
|
118
|
+
- test/ts_neptune.rb
|
119
|
+
- test/tc_mapreduce.rb
|
108
120
|
- README
|
109
121
|
- LICENSE
|
110
122
|
has_rdoc: true
|