neptune 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. data/README +7 -4
  2. data/doc/AppControllerClient.html +12 -4
  3. data/doc/CommonFunctions.html +55 -42
  4. data/doc/Kernel.html +187 -0
  5. data/doc/LICENSE.html +2 -0
  6. data/doc/Object.html +488 -198
  7. data/doc/README.html +26 -5
  8. data/doc/bin/neptune.html +1 -1
  9. data/doc/created.rid +6 -6
  10. data/doc/index.html +20 -2
  11. data/doc/lib/app_controller_client_rb.html +2 -2
  12. data/doc/lib/common_functions_rb.html +2 -2
  13. data/doc/lib/neptune_rb.html +3 -1
  14. data/lib/app_controller_client.rb +2 -2
  15. data/lib/common_functions.rb +50 -24
  16. data/lib/neptune.rb +224 -159
  17. data/samples/appscale/add_appserver.rb +10 -0
  18. data/samples/appscale/add_database.rb +9 -0
  19. data/samples/appscale/add_loadbalancer.rb +9 -0
  20. data/samples/appscale/add_slave.rb +9 -0
  21. data/samples/c/compile_helloworld.rb +10 -0
  22. data/samples/c/helloworld/helloworld.c +6 -0
  23. data/samples/erlang/compile_erlang_ring.rb +10 -0
  24. data/samples/erlang/get_erlang_output.rb +8 -0
  25. data/samples/erlang/ring/Makefile +3 -0
  26. data/samples/erlang/ring/ring.erl +90 -0
  27. data/samples/erlang/run_erlang_ring.rb +6 -0
  28. data/samples/go/compile_hello.rb +10 -0
  29. data/samples/go/get_hello_output.rb +6 -0
  30. data/samples/go/hello/hello.go +8 -0
  31. data/samples/go/put_input.rb +8 -0
  32. data/samples/go/run_hello.rb +9 -0
  33. data/samples/mapreduce/expected-output.txt +7078 -0
  34. data/samples/mapreduce/get_mapreduce_output.rb +4 -0
  35. data/samples/mapreduce/hadoop-0.20.0-examples.jar +0 -0
  36. data/samples/mapreduce/input-10 +64 -0
  37. data/samples/mapreduce/input-30 +64 -0
  38. data/samples/mapreduce/input-7 +4 -0
  39. data/samples/mapreduce/map.rb +48 -0
  40. data/samples/mapreduce/reduce.rb +48 -0
  41. data/samples/mapreduce/run_java_mr.rb +14 -0
  42. data/samples/mapreduce/run_mapreduce.rb +13 -0
  43. data/samples/mapreduce/the-end-of-time.txt +11256 -0
  44. data/samples/mpi/Makefile +22 -0
  45. data/samples/mpi/MpiQueen +0 -0
  46. data/samples/mpi/compile_mpi_ring.rb +10 -0
  47. data/samples/mpi/compile_x10_nqueens.rb +8 -0
  48. data/samples/mpi/cpi +0 -0
  49. data/samples/mpi/get_mpi_output.rb +5 -0
  50. data/samples/mpi/get_ring_output.rb +5 -0
  51. data/samples/mpi/hw2.c +205 -0
  52. data/samples/mpi/hw2harness.c +84 -0
  53. data/samples/mpi/hw2harness.h +45 -0
  54. data/samples/mpi/powermethod +0 -0
  55. data/samples/mpi/ring/Makefile +2 -0
  56. data/samples/mpi/ring/Ring.c +76 -0
  57. data/samples/mpi/run_mpi_cpi.rb +10 -0
  58. data/samples/mpi/run_mpi_nqueens.np +6 -0
  59. data/samples/mpi/run_mpi_powermethod.rb +8 -0
  60. data/samples/mpi/run_mpi_ring.rb +12 -0
  61. data/samples/r/compile_hello.rb +10 -0
  62. data/samples/r/get_hello_output.rb +6 -0
  63. data/samples/r/hello/hello.r +1 -0
  64. data/samples/r/put_input.rb +8 -0
  65. data/samples/r/run_hello.rb +9 -0
  66. data/samples/upc/compile_upc_helloworld.rb +10 -0
  67. data/samples/upc/compile_upc_ring.rb +11 -0
  68. data/samples/upc/get_mpi_output.rb +8 -0
  69. data/samples/upc/helloworld/HelloWorld.c +9 -0
  70. data/samples/upc/helloworld/Makefile +3 -0
  71. data/samples/upc/ring/Makefile +3 -0
  72. data/samples/upc/ring/Ring.c +116 -0
  73. data/samples/upc/run_upc_helloworld.rb +12 -0
  74. data/samples/upc/run_upc_ring.rb +12 -0
  75. data/samples/x10/MyPowerMethod +0 -0
  76. data/samples/x10/MyPowerMethod.x10 +236 -0
  77. data/samples/x10/NQueensDist +0 -0
  78. data/samples/x10/NQueensDist.x10 +112 -0
  79. data/samples/x10/compile_x10_nqueens.rb +7 -0
  80. data/samples/x10/compile_x10_ring.rb +12 -0
  81. data/samples/x10/get_x10_output.rb +8 -0
  82. data/samples/x10/ring/Makefile +3 -0
  83. data/samples/x10/ring/Ring.x10 +28 -0
  84. data/samples/x10/ring/RingOld.x10 +68 -0
  85. data/samples/x10/run_x10_nqueens.rb +6 -0
  86. data/samples/x10/run_x10_powermethod.rb +7 -0
  87. data/samples/x10/run_x10_ring.rb +6 -0
  88. data/test/{tc_c.rb → integration/tc_c.rb} +2 -2
  89. data/test/{tc_dfsp.rb → integration/tc_dfsp.rb} +0 -0
  90. data/test/{tc_dwssa.rb → integration/tc_dwssa.rb} +0 -0
  91. data/test/{tc_erlang.rb → integration/tc_erlang.rb} +0 -0
  92. data/test/{tc_mapreduce.rb → integration/tc_mapreduce.rb} +0 -0
  93. data/test/{tc_mpi.rb → integration/tc_mpi.rb} +0 -0
  94. data/test/{tc_storage.rb → integration/tc_storage.rb} +0 -0
  95. data/test/{tc_upc.rb → integration/tc_upc.rb} +0 -0
  96. data/test/{tc_x10.rb → integration/tc_x10.rb} +0 -0
  97. data/test/{test_helper.rb → integration/test_helper.rb} +0 -0
  98. data/test/{ts_neptune.rb → integration/ts_neptune.rb} +2 -2
  99. data/test/unit/test_app_controller_client.rb +106 -0
  100. data/test/unit/test_common_functions.rb +106 -0
  101. data/test/unit/test_neptune.rb +208 -0
  102. data/test/unit/ts_all.rb +6 -0
  103. metadata +91 -15
@@ -0,0 +1,208 @@
1
+ # Programmer: Chris Bunch (cgb@cs.ucsb.edu)
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), "..", "..", "lib")
4
+ require 'neptune'
5
+
6
+ require 'test/unit'
7
+
8
+ class FakeAppControllerClient
9
+ def initialize(a, b)
10
+ end
11
+
12
+ # Since all the methods we're faking take the same arguments and have
13
+ # the same semantics (return true or abort), just cover it all in one place.
14
+ def method_missing(id, *args, &block)
15
+ method_names = ["get_output", "get_acl", "put_input", "set_acl"] +
16
+ ["start_neptune_job"]
17
+ if method_names.include?(id.to_s)
18
+ return true
19
+ else
20
+ super
21
+ end
22
+ end
23
+ end
24
+
25
+ class FakeFileNeptuneTest
26
+ def self.expand_path(path)
27
+ return path
28
+ end
29
+
30
+ def self.exists?(file)
31
+ if file.include?("EXISTS")
32
+ return true
33
+ else
34
+ return false
35
+ end
36
+ end
37
+ end
38
+
39
+ module FakeKernel
40
+ def `(command)
41
+ end
42
+ end
43
+
44
+ module FakeCommonFunctions
45
+ def self.scp_to_shadow(a, b, c, d=nil)
46
+ end
47
+ end
48
+
49
+ class TestNeptune < Test::Unit::TestCase
50
+ def test_do_preprocessing
51
+ # Try a job that needs preprocessing
52
+ job_data_1 = {"@type" => "ssa", "@trajectories" => 10}
53
+ assert_nothing_raised(SystemExit) { do_preprocessing(job_data_1) }
54
+
55
+ # Now try a job that doesn't need it
56
+ job_data_2 = {"@type" => "input"}
57
+ assert_nothing_raised(SystemExit) { do_preprocessing(job_data_2) }
58
+ end
59
+
60
+ def test_preprocess_compile
61
+ end
62
+
63
+ def test_preprocess_erlang
64
+ # Try a job where we didn't specify the code
65
+ job_data_1 = {}
66
+ assert_raise(SystemExit) {
67
+ preprocess_erlang(job_data_1, FakeFileNeptuneTest, FakeCommonFunctions)
68
+ }
69
+
70
+ # Try a job where the source doesn't exist
71
+ job_data_2 = {"@code" => "NOT-EXISTANT"}
72
+ assert_raise(SystemExit) {
73
+ preprocess_erlang(job_data_2, FakeFileNeptuneTest, FakeCommonFunctions)
74
+ }
75
+
76
+ # Now try a job where the source does exist
77
+ job_data_3 = {"@code" => "EXISTS"}
78
+ assert_nothing_raised(SystemExit) {
79
+ preprocess_erlang(job_data_3, FakeFileNeptuneTest, FakeCommonFunctions)
80
+ }
81
+ end
82
+
83
+ def test_preprocess_mpi
84
+ job_data_1 = {}
85
+ assert_raise(SystemExit) { preprocess_mpi(job_data_1) }
86
+
87
+ job_data_2 = {"@nodes_to_use" => 4}
88
+ assert_raise(SystemExit) { preprocess_mpi(job_data_2) }
89
+
90
+ job_data_3 = {"@nodes_to_use" => 4, "@procs_to_use" => 4}
91
+ assert_equal(job_data_3, preprocess_mpi(job_data_3))
92
+
93
+ job_data_4 = {"@nodes_to_use" => 4, "@procs_to_use" => 1}
94
+ assert_raise(SystemExit) { preprocess_mpi(job_data_4) }
95
+ end
96
+
97
+ def test_preprocess_ssa
98
+ job_data_1 = {}
99
+ assert_raise(SystemExit) { preprocess_ssa(job_data_1) }
100
+
101
+ job_data_2 = {"@trajectories" => 10}
102
+ assert_equal(job_data_2, preprocess_ssa(job_data_2))
103
+
104
+ job_data_3 = {"@simulations" => 10}
105
+ expected_job_data_3 = {"@trajectories" => 10}
106
+ assert_equal(expected_job_data_3, preprocess_ssa(job_data_3))
107
+
108
+ job_data_4 = {"@trajectories" => 10, "@simulations" => 10}
109
+ assert_raise(SystemExit) { preprocess_ssa(job_data_4) }
110
+ end
111
+
112
+ def test_get_job_data
113
+ params_1 = {:type => :mpi}
114
+ assert_raise(SystemExit) { get_job_data(params_1) }
115
+
116
+ params_2 = {:type => :mpi, :output => "boo"}
117
+ assert_raise(SystemExit) { get_job_data(params_2) }
118
+
119
+ [:mpi, :upc, :x10].each { |type|
120
+ params_3 = {:type => type, :output => "/boo"}
121
+ expected_job_data_3 = {"@type" => "mpi", "@output" => "/boo",
122
+ "@keyname" => "appscale"}
123
+ assert_equal(expected_job_data_3, get_job_data(params_3))
124
+ }
125
+
126
+ params_4 = {:type => "input"}
127
+ expected_job_data_4 = {"@type" => "input", "@keyname" => "appscale"}
128
+ assert_equal(expected_job_data_4, get_job_data(params_4))
129
+
130
+ params_5 = {:type => "input", :keyname => "boo"}
131
+ expected_job_data_5 = {"@type" => "input", "@keyname" => "boo"}
132
+ assert_equal(expected_job_data_5, get_job_data(params_5))
133
+
134
+ params_6 = {:type => :mpi, :output => "/boo",
135
+ :nodes_to_use => {"cloud1" => 1, "cloud2" => 1}}
136
+ expected_job_data_6 = {"@type" => "mpi", "@output" => "/boo",
137
+ "@keyname" => "appscale", "@nodes_to_use" => ["cloud1", 1, "cloud2", 1]}
138
+ assert_equal(expected_job_data_6, get_job_data(params_6))
139
+ end
140
+
141
+ def test_validate_storage_params
142
+ job_data_1 = {}
143
+ expected_job_data_1 = {"@storage" => "appdb"}
144
+ assert_equal(expected_job_data_1, validate_storage_params(job_data_1))
145
+
146
+ job_data_2 = {"@storage" => "a bad value goes here"}
147
+ assert_raise(SystemExit) { validate_storage_params(job_data_2) }
148
+
149
+ job_data_3 = {"@storage" => "s3"}
150
+ assert_raise(SystemExit) { validate_storage_params(job_data_3) }
151
+
152
+ job_data_4 = {"@storage" => "s3", "@EC2_ACCESS_KEY" => "a",
153
+ "@EC2_SECRET_KEY" => "b", "@S3_URL" => "c"}
154
+ assert_equal(job_data_4, validate_storage_params(job_data_4))
155
+
156
+ ENV['EC2_ACCESS_KEY'] = "a"
157
+ ENV['EC2_SECRET_KEY'] = "b"
158
+ ENV['S3_URL'] = "c"
159
+
160
+ ["s3", "gstorage", "walrus"].each { |storage|
161
+ job_data_5 = {"@storage" => storage}
162
+ expected_job_data_5 = {"@storage" => "s3", "@EC2_ACCESS_KEY" => "a",
163
+ "@EC2_SECRET_KEY" => "b", "@S3_URL" => "c"}
164
+ assert_equal(expected_job_data_5, validate_storage_params(job_data_5))
165
+ }
166
+ end
167
+
168
+ def test_get_input
169
+ end
170
+
171
+ def test_wait_for_compilation_to_finish
172
+ end
173
+
174
+ def test_compile_code
175
+ end
176
+
177
+ def test_run_job
178
+ ssh_args = "boo!"
179
+ shadow_ip = "localhost?"
180
+ secret = "abcdefg"
181
+
182
+ job_data_1 = {"@type" => "input"}
183
+ assert_raises (SystemExit) {
184
+ run_job(job_data_1, ssh_args, shadow_ip, secret,
185
+ FakeAppControllerClient, FakeFileNeptuneTest)
186
+ }
187
+
188
+ job_data_1 = {"@type" => "input", "@local" => "NON-EXISTANT"}
189
+ actual_1 = run_job(job_data_1, ssh_args, shadow_ip, secret,
190
+ FakeAppControllerClient, FakeFileNeptuneTest)
191
+ assert_equal(:failure, actual_1[:result])
192
+
193
+ job_data_2 = {"@type" => "input", "@local" => "EXISTS"}
194
+ actual_2 = run_job(job_data_2, ssh_args, shadow_ip, secret,
195
+ FakeAppControllerClient, FakeFileNeptuneTest)
196
+ assert_equal(:success, actual_2[:result])
197
+
198
+ # try an output job
199
+
200
+ # try a get-acl job
201
+
202
+ # try a set-acl job
203
+
204
+ # try a compile job
205
+
206
+ # try a compute job
207
+ end
208
+ end
@@ -0,0 +1,6 @@
1
+ # Programmer: Chris Bunch (cgb@cs.ucsb.edu)
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__))
4
+ require 'test_app_controller_client'
5
+ require 'test_common_functions'
6
+ require 'test_neptune'
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: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
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-06-06 00:00:00 -07:00
18
+ date: 2011-11-10 00:00:00 -08:00
19
19
  default_executable: neptune
20
20
  dependencies: []
21
21
 
@@ -103,20 +103,96 @@ files:
103
103
  - doc/scripts/mpi/run_mpi_powermethod_rb.html
104
104
  - doc/scripts/mpi/run_mpi_cpi_rb.html
105
105
  - doc/created.rid
106
+ - doc/Kernel.html
106
107
  - lib/common_functions.rb
107
108
  - lib/app_controller_client.rb
108
109
  - 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
110
+ - test/integration/tc_c.rb
111
+ - test/integration/tc_dfsp.rb
112
+ - test/integration/test_helper.rb
113
+ - test/integration/tc_mpi.rb
114
+ - test/integration/tc_dwssa.rb
115
+ - test/integration/tc_erlang.rb
116
+ - test/integration/tc_storage.rb
117
+ - test/integration/tc_x10.rb
118
+ - test/integration/tc_upc.rb
119
+ - test/integration/ts_neptune.rb
120
+ - test/integration/tc_mapreduce.rb
121
+ - test/unit/test_app_controller_client.rb
122
+ - test/unit/test_neptune.rb
123
+ - test/unit/test_common_functions.rb
124
+ - test/unit/ts_all.rb
125
+ - samples/upc/run_upc_ring.rb
126
+ - samples/upc/helloworld/HelloWorld.c
127
+ - samples/upc/helloworld/Makefile
128
+ - samples/upc/ring/Ring.c
129
+ - samples/upc/ring/Makefile
130
+ - samples/upc/compile_upc_helloworld.rb
131
+ - samples/upc/run_upc_helloworld.rb
132
+ - samples/upc/compile_upc_ring.rb
133
+ - samples/upc/get_mpi_output.rb
134
+ - samples/go/run_hello.rb
135
+ - samples/go/get_hello_output.rb
136
+ - samples/go/hello/hello.go
137
+ - samples/go/compile_hello.rb
138
+ - samples/go/put_input.rb
139
+ - samples/r/run_hello.rb
140
+ - samples/r/get_hello_output.rb
141
+ - samples/r/hello/hello.r
142
+ - samples/r/compile_hello.rb
143
+ - samples/r/put_input.rb
144
+ - samples/c/compile_helloworld.rb
145
+ - samples/c/helloworld/helloworld.c
146
+ - samples/appscale/add_loadbalancer.rb
147
+ - samples/appscale/add_slave.rb
148
+ - samples/appscale/add_appserver.rb
149
+ - samples/appscale/add_database.rb
150
+ - samples/x10/compile_x10_nqueens.rb
151
+ - samples/x10/run_x10_ring.rb
152
+ - samples/x10/ring/Ring.x10
153
+ - samples/x10/ring/RingOld.x10
154
+ - samples/x10/ring/Makefile
155
+ - samples/x10/MyPowerMethod
156
+ - samples/x10/run_x10_powermethod.rb
157
+ - samples/x10/get_x10_output.rb
158
+ - samples/x10/compile_x10_ring.rb
159
+ - samples/x10/run_x10_nqueens.rb
160
+ - samples/x10/MyPowerMethod.x10
161
+ - samples/x10/NQueensDist.x10
162
+ - samples/x10/NQueensDist
163
+ - samples/mapreduce/run_java_mr.rb
164
+ - samples/mapreduce/get_mapreduce_output.rb
165
+ - samples/mapreduce/input-7
166
+ - samples/mapreduce/run_mapreduce.rb
167
+ - samples/mapreduce/reduce.rb
168
+ - samples/mapreduce/the-end-of-time.txt
169
+ - samples/mapreduce/input-10
170
+ - samples/mapreduce/map.rb
171
+ - samples/mapreduce/expected-output.txt
172
+ - samples/mapreduce/hadoop-0.20.0-examples.jar
173
+ - samples/mapreduce/input-30
174
+ - samples/erlang/run_erlang_ring.rb
175
+ - samples/erlang/compile_erlang_ring.rb
176
+ - samples/erlang/get_erlang_output.rb
177
+ - samples/erlang/ring/ring.erl
178
+ - samples/erlang/ring/Makefile
179
+ - samples/mpi/compile_x10_nqueens.rb
180
+ - samples/mpi/run_mpi_powermethod.rb
181
+ - samples/mpi/compile_mpi_ring.rb
182
+ - samples/mpi/ring/Ring.c
183
+ - samples/mpi/ring/Makefile
184
+ - samples/mpi/hw2harness.h
185
+ - samples/mpi/run_mpi_nqueens.np
186
+ - samples/mpi/powermethod
187
+ - samples/mpi/MpiQueen
188
+ - samples/mpi/get_ring_output.rb
189
+ - samples/mpi/cpi
190
+ - samples/mpi/hw2harness.c
191
+ - samples/mpi/hw2.c
192
+ - samples/mpi/run_mpi_cpi.rb
193
+ - samples/mpi/run_mpi_ring.rb
194
+ - samples/mpi/Makefile
195
+ - samples/mpi/get_mpi_output.rb
120
196
  - README
121
197
  - LICENSE
122
198
  has_rdoc: true