neptune 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +4 -0
- data/doc/BabelHelper.html +393 -376
- data/doc/BadConfigurationException.html +121 -127
- data/doc/CommonFunctions.html +237 -265
- data/doc/ExodusHelper.html +820 -0
- data/doc/ExodusTaskInfo.html +263 -0
- data/doc/FileNotFoundException.html +121 -127
- data/doc/NeptuneHelper.html +527 -592
- data/doc/NeptuneManagerClient.html +696 -0
- data/doc/NeptuneManagerException.html +139 -0
- data/doc/Object.html +334 -236
- data/doc/TaskInfo.html +428 -0
- data/doc/created.rid +8 -5
- data/doc/images/add.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/index.html +74 -142
- data/doc/js/darkfish.js +99 -62
- data/doc/js/jquery.js +15 -29
- data/doc/js/navigation.js +142 -0
- data/doc/js/search.js +94 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/searcher.js +228 -0
- data/doc/table_of_contents.html +226 -0
- data/lib/babel.rb +116 -50
- data/lib/custom_exceptions.rb +2 -2
- data/lib/exodus.rb +311 -0
- data/lib/exodus_task_info.rb +36 -0
- data/lib/neptune.rb +52 -18
- data/lib/{app_controller_client.rb → neptune_manager_client.rb} +54 -38
- data/lib/task_info.rb +155 -0
- data/test/{unit/test_babel.rb → test_babel.rb} +161 -26
- data/test/{unit/test_common_functions.rb → test_common_functions.rb} +1 -1
- data/test/test_exodus.rb +687 -0
- data/test/{unit/test_neptune.rb → test_neptune.rb} +28 -17
- data/test/{unit/test_app_controller_client.rb → test_neptune_manager_client.rb} +15 -16
- data/test/test_task_info.rb +32 -0
- data/test/{unit/ts_all.rb → ts_all.rb} +3 -1
- metadata +30 -34
- data/doc/AppControllerClient.html +0 -702
- data/doc/AppControllerException.html +0 -145
- data/doc/bin/neptune.html +0 -56
- data/doc/js/quicksearch.js +0 -114
- data/doc/js/thickbox-compressed.js +0 -10
- data/doc/lib/app_controller_client_rb.html +0 -60
- data/doc/lib/babel_rb.html +0 -68
- data/doc/lib/common_functions_rb.html +0 -70
- data/doc/lib/custom_exceptions_rb.html +0 -54
- data/doc/lib/neptune_rb.html +0 -60
- data/test/integration/tc_c.rb +0 -57
- data/test/integration/tc_dfsp.rb +0 -37
- data/test/integration/tc_dwssa.rb +0 -38
- data/test/integration/tc_erlang.rb +0 -183
- data/test/integration/tc_mapreduce.rb +0 -282
- data/test/integration/tc_mpi.rb +0 -160
- data/test/integration/tc_storage.rb +0 -209
- data/test/integration/tc_upc.rb +0 -75
- data/test/integration/tc_x10.rb +0 -94
- data/test/integration/test_helper.rb +0 -135
- data/test/integration/ts_neptune.rb +0 -40
data/doc/NeptuneHelper.html
CHANGED
@@ -1,178 +1,173 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
5
4
|
<head>
|
6
|
-
|
7
|
-
|
8
|
-
<title>Module: NeptuneHelper</title>
|
9
|
-
|
10
|
-
<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
|
11
|
-
|
12
|
-
<script src="./js/jquery.js" type="text/javascript"
|
13
|
-
charset="utf-8"></script>
|
14
|
-
<script src="./js/thickbox-compressed.js" type="text/javascript"
|
15
|
-
charset="utf-8"></script>
|
16
|
-
<script src="./js/quicksearch.js" type="text/javascript"
|
17
|
-
charset="utf-8"></script>
|
18
|
-
<script src="./js/darkfish.js" type="text/javascript"
|
19
|
-
charset="utf-8"></script>
|
20
|
-
|
21
|
-
</head>
|
22
|
-
<body class="module">
|
23
|
-
|
24
|
-
<div id="metadata">
|
25
|
-
<div id="home-metadata">
|
26
|
-
<div id="home-section" class="section">
|
27
|
-
<h3 class="section-header">
|
28
|
-
<a href="./index.html">Home</a>
|
29
|
-
<a href="./index.html#classes">Classes</a>
|
30
|
-
<a href="./index.html#methods">Methods</a>
|
31
|
-
</h3>
|
32
|
-
</div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="file-metadata">
|
36
|
-
<div id="file-list-section" class="section">
|
37
|
-
<h3 class="section-header">In Files</h3>
|
38
|
-
<div class="section-body">
|
39
|
-
<ul>
|
40
|
-
|
41
|
-
<li><a href="./lib/neptune_rb.html?TB_iframe=true&height=550&width=785"
|
42
|
-
class="thickbox" title="lib/neptune.rb">lib/neptune.rb</a></li>
|
43
|
-
|
44
|
-
</ul>
|
45
|
-
</div>
|
46
|
-
</div>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
47
6
|
|
48
|
-
|
49
|
-
</div>
|
7
|
+
<title>module NeptuneHelper - RDoc Documentation</title>
|
50
8
|
|
51
|
-
|
9
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
52
10
|
|
53
|
-
|
54
|
-
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "./";
|
13
|
+
</script>
|
55
14
|
|
56
|
-
|
57
|
-
|
15
|
+
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
|
58
21
|
|
59
|
-
<!-- Method Quickref -->
|
60
|
-
|
61
|
-
<div id="method-list-section" class="section">
|
62
|
-
<h3 class="section-header">Methods</h3>
|
63
|
-
<ul class="link-list">
|
64
|
-
|
65
|
-
<li><a href="#method-c-compile_code">::compile_code</a></li>
|
66
|
-
|
67
|
-
<li><a href="#method-c-do_preprocessing">::do_preprocessing</a></li>
|
68
|
-
|
69
|
-
<li><a href="#method-c-get_input">::get_input</a></li>
|
70
|
-
|
71
|
-
<li><a href="#method-c-get_job_data">::get_job_data</a></li>
|
72
|
-
|
73
|
-
<li><a href="#method-c-get_std_out_and_err">::get_std_out_and_err</a></li>
|
74
|
-
|
75
|
-
<li><a href="#method-c-preprocess_babel">::preprocess_babel</a></li>
|
76
|
-
|
77
|
-
<li><a href="#method-c-preprocess_compile">::preprocess_compile</a></li>
|
78
|
-
|
79
|
-
<li><a href="#method-c-preprocess_erlang">::preprocess_erlang</a></li>
|
80
|
-
|
81
|
-
<li><a href="#method-c-preprocess_mpi">::preprocess_mpi</a></li>
|
82
|
-
|
83
|
-
<li><a href="#method-c-preprocess_ssa">::preprocess_ssa</a></li>
|
84
|
-
|
85
|
-
<li><a href="#method-c-require_file_to_exist">::require_file_to_exist</a></li>
|
86
|
-
|
87
|
-
<li><a href="#method-c-require_file_to_not_exist">::require_file_to_not_exist</a></li>
|
88
|
-
|
89
|
-
<li><a href="#method-c-require_param">::require_param</a></li>
|
90
|
-
|
91
|
-
<li><a href="#method-c-run_job">::run_job</a></li>
|
92
|
-
|
93
|
-
<li><a href="#method-c-upload_app_for_cicero">::upload_app_for_cicero</a></li>
|
94
|
-
|
95
|
-
<li><a href="#method-c-validate_storage_params">::validate_storage_params</a></li>
|
96
|
-
|
97
|
-
<li><a href="#method-c-wait_for_compilation_to_finish">::wait_for_compilation_to_finish</a></li>
|
98
|
-
|
99
|
-
</ul>
|
100
|
-
</div>
|
101
|
-
|
102
22
|
|
103
|
-
|
104
|
-
|
105
|
-
|
23
|
+
<body id="top" class="module">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="./index.html">Home</a>
|
28
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
106
32
|
|
107
|
-
<div id="project-metadata">
|
108
|
-
|
109
|
-
|
110
33
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
</fieldset>
|
122
|
-
</form>
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
123
44
|
|
124
|
-
<ul class="link-list">
|
125
|
-
|
126
|
-
<li><a href="./AppControllerClient.html">AppControllerClient</a></li>
|
127
|
-
|
128
|
-
<li><a href="./AppControllerException.html">AppControllerException</a></li>
|
129
|
-
|
130
|
-
<li><a href="./BabelHelper.html">BabelHelper</a></li>
|
131
|
-
|
132
|
-
<li><a href="./BadConfigurationException.html">BadConfigurationException</a></li>
|
133
|
-
|
134
|
-
<li><a href="./CommonFunctions.html">CommonFunctions</a></li>
|
135
|
-
|
136
|
-
<li><a href="./FileNotFoundException.html">FileNotFoundException</a></li>
|
137
|
-
|
138
|
-
<li><a href="./NeptuneHelper.html">NeptuneHelper</a></li>
|
139
|
-
|
140
|
-
<li><a href="./Object.html">Object</a></li>
|
141
|
-
|
142
|
-
</ul>
|
143
|
-
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
144
|
-
</div>
|
145
45
|
|
146
|
-
|
147
|
-
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/neptune.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
148
55
|
</div>
|
149
56
|
|
150
|
-
<div id="
|
151
|
-
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
<!-- Method Quickref -->
|
62
|
+
<nav id="method-list-section" class="section">
|
63
|
+
<h3 class="section-header">Methods</h3>
|
152
64
|
|
153
|
-
|
154
|
-
|
65
|
+
<ul class="link-list">
|
66
|
+
|
67
|
+
<li><a href="#method-c-compile_code">::compile_code</a>
|
68
|
+
|
69
|
+
<li><a href="#method-c-do_preprocessing">::do_preprocessing</a>
|
70
|
+
|
71
|
+
<li><a href="#method-c-get_input">::get_input</a>
|
72
|
+
|
73
|
+
<li><a href="#method-c-get_job_data">::get_job_data</a>
|
74
|
+
|
75
|
+
<li><a href="#method-c-get_std_out_and_err">::get_std_out_and_err</a>
|
76
|
+
|
77
|
+
<li><a href="#method-c-preprocess_babel">::preprocess_babel</a>
|
78
|
+
|
79
|
+
<li><a href="#method-c-preprocess_compile">::preprocess_compile</a>
|
80
|
+
|
81
|
+
<li><a href="#method-c-preprocess_erlang">::preprocess_erlang</a>
|
82
|
+
|
83
|
+
<li><a href="#method-c-preprocess_mpi">::preprocess_mpi</a>
|
84
|
+
|
85
|
+
<li><a href="#method-c-preprocess_ssa">::preprocess_ssa</a>
|
86
|
+
|
87
|
+
<li><a href="#method-c-require_file_to_exist">::require_file_to_exist</a>
|
88
|
+
|
89
|
+
<li><a href="#method-c-require_file_to_not_exist">::require_file_to_not_exist</a>
|
90
|
+
|
91
|
+
<li><a href="#method-c-require_param">::require_param</a>
|
92
|
+
|
93
|
+
<li><a href="#method-c-run_job">::run_job</a>
|
94
|
+
|
95
|
+
<li><a href="#method-c-upload_app_for_cicero">::upload_app_for_cicero</a>
|
96
|
+
|
97
|
+
<li><a href="#method-c-validate_storage_params">::validate_storage_params</a>
|
98
|
+
|
99
|
+
<li><a href="#method-c-wait_for_compilation_to_finish">::wait_for_compilation_to_finish</a>
|
100
|
+
|
101
|
+
</ul>
|
102
|
+
</nav>
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
<div id="project-metadata">
|
107
|
+
|
108
|
+
<nav id="classindex-section" class="section project-section">
|
109
|
+
<h3 class="section-header">Class and Module Index</h3>
|
110
|
+
|
111
|
+
<ul class="link-list">
|
112
|
+
|
113
|
+
<li><a href="./BabelHelper.html">BabelHelper</a>
|
114
|
+
|
115
|
+
<li><a href="./BadConfigurationException.html">BadConfigurationException</a>
|
116
|
+
|
117
|
+
<li><a href="./CommonFunctions.html">CommonFunctions</a>
|
118
|
+
|
119
|
+
<li><a href="./ExodusHelper.html">ExodusHelper</a>
|
120
|
+
|
121
|
+
<li><a href="./ExodusTaskInfo.html">ExodusTaskInfo</a>
|
122
|
+
|
123
|
+
<li><a href="./FileNotFoundException.html">FileNotFoundException</a>
|
124
|
+
|
125
|
+
<li><a href="./NeptuneHelper.html">NeptuneHelper</a>
|
126
|
+
|
127
|
+
<li><a href="./NeptuneManagerClient.html">NeptuneManagerClient</a>
|
128
|
+
|
129
|
+
<li><a href="./NeptuneManagerException.html">NeptuneManagerException</a>
|
130
|
+
|
131
|
+
<li><a href="./Object.html">Object</a>
|
132
|
+
|
133
|
+
<li><a href="./TaskInfo.html">TaskInfo</a>
|
134
|
+
|
135
|
+
</ul>
|
136
|
+
</nav>
|
137
|
+
|
138
|
+
</div>
|
139
|
+
</nav>
|
140
|
+
|
141
|
+
<div id="documentation">
|
142
|
+
<h1 class="module">module NeptuneHelper</h1>
|
143
|
+
|
144
|
+
<div id="description" class="description">
|
145
|
+
|
155
146
|
<p><a href="NeptuneHelper.html">NeptuneHelper</a> provides methods that are
|
156
147
|
used by neptune() and babel() to validate parameters and run the user’s
|
157
148
|
job.</p>
|
158
149
|
|
159
|
-
|
150
|
+
</div><!-- description -->
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
156
|
+
|
157
|
+
|
158
|
+
|
160
159
|
|
161
|
-
<!-- Constants -->
|
162
160
|
|
163
161
|
|
164
|
-
<!-- Attributes -->
|
165
162
|
|
166
163
|
|
167
164
|
<!-- Methods -->
|
168
165
|
|
169
|
-
|
166
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
170
167
|
<h3 class="section-header">Public Class Methods</h3>
|
171
168
|
|
172
169
|
|
173
|
-
<div id="compile_code
|
174
|
-
<a name="method-c-compile_code"></a>
|
175
|
-
|
170
|
+
<div id="method-c-compile_code" class="method-detail ">
|
176
171
|
|
177
172
|
<div class="method-heading">
|
178
173
|
<span class="method-name">compile_code</span><span
|
@@ -190,46 +185,42 @@ indicates whether or not the compilation was successful.</p>
|
|
190
185
|
|
191
186
|
|
192
187
|
|
193
|
-
<div class="method-source-code"
|
194
|
-
|
195
|
-
<
|
196
|
-
<span class="ruby-
|
197
|
-
|
198
|
-
|
199
|
-
copy_to = job_data[<span class="ruby-string">"@copy_to"</span>]
|
200
|
-
self.wait_for_compilation_to_finish(ssh_args, shadow_ip, compiled_location)
|
188
|
+
<div class="method-source-code" id="compile_code-source">
|
189
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 458</span>
|
190
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">compile_code</span>(<span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">ssh_args</span>, <span class="ruby-identifier">shadow_ip</span>)
|
191
|
+
<span class="ruby-identifier">compiled_location</span> = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">compile_code</span>(<span class="ruby-identifier">job_data</span>)
|
192
|
+
<span class="ruby-identifier">copy_to</span> = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@copy_to"</span>]
|
193
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">wait_for_compilation_to_finish</span>(<span class="ruby-identifier">ssh_args</span>, <span class="ruby-identifier">shadow_ip</span>, <span class="ruby-identifier">compiled_location</span>)
|
201
194
|
|
202
|
-
<span class="ruby-constant">FileUtils</span
|
195
|
+
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_rf</span>(<span class="ruby-identifier">copy_to</span>)
|
203
196
|
|
204
|
-
scp_command =
|
197
|
+
<span class="ruby-identifier">scp_command</span> = <span class="ruby-node">"scp -r #{ssh_args} root@#{shadow_ip}:#{compiled_location} #{copy_to} 2>&1"</span>
|
205
198
|
<span class="ruby-comment"># Kernel.puts scp_command</span>
|
206
|
-
<span class="ruby-constant">CommonFunctions</span
|
199
|
+
<span class="ruby-constant">CommonFunctions</span>.<span class="ruby-identifier">shell</span>(<span class="ruby-identifier">scp_command</span>)
|
207
200
|
|
208
|
-
code = job_data[<span class="ruby-string">"@code"</span>]
|
209
|
-
dirs = code
|
210
|
-
remote_dir = <span class="ruby-string">"/tmp/"</span>
|
201
|
+
<span class="ruby-identifier">code</span> = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@code"</span>]
|
202
|
+
<span class="ruby-identifier">dirs</span> = <span class="ruby-identifier">code</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">%r\//</span>)
|
203
|
+
<span class="ruby-identifier">remote_dir</span> = <span class="ruby-string">"/tmp/"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">dirs</span>[<span class="ruby-value">-1</span>]
|
211
204
|
|
212
|
-
[remote_dir
|
213
|
-
ssh_command =
|
205
|
+
[<span class="ruby-identifier">remote_dir</span>, <span class="ruby-identifier">compiled_location</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">remote_files</span><span class="ruby-operator">|</span>
|
206
|
+
<span class="ruby-identifier">ssh_command</span> = <span class="ruby-node">"ssh #{ssh_args} root@#{shadow_ip} 'rm -rf #{remote_files}' 2>&1"</span>
|
214
207
|
<span class="ruby-comment"># Kernel.puts ssh_command</span>
|
215
|
-
<span class="ruby-constant">CommonFunctions</span
|
208
|
+
<span class="ruby-constant">CommonFunctions</span>.<span class="ruby-identifier">shell</span>(<span class="ruby-identifier">ssh_command</span>)
|
216
209
|
}
|
217
210
|
|
218
|
-
return get_std_out_and_err(copy_to)
|
219
|
-
end</pre>
|
220
|
-
</div
|
211
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">get_std_out_and_err</span>(<span class="ruby-identifier">copy_to</span>)
|
212
|
+
<span class="ruby-keyword">end</span></pre>
|
213
|
+
</div><!-- compile_code-source -->
|
221
214
|
|
222
215
|
</div>
|
223
216
|
|
224
217
|
|
225
218
|
|
226
219
|
|
227
|
-
</div
|
220
|
+
</div><!-- compile_code-method -->
|
228
221
|
|
229
222
|
|
230
|
-
<div id="do_preprocessing
|
231
|
-
<a name="method-c-do_preprocessing"></a>
|
232
|
-
|
223
|
+
<div id="method-c-do_preprocessing" class="method-detail ">
|
233
224
|
|
234
225
|
<div class="method-heading">
|
235
226
|
<span class="method-name">do_preprocessing</span><span
|
@@ -246,34 +237,30 @@ method to use based on the type of the job that the user has asked to run.</p>
|
|
246
237
|
|
247
238
|
|
248
239
|
|
249
|
-
<div class="method-source-code"
|
250
|
-
|
251
|
-
<
|
252
|
-
<span class="ruby-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
return
|
257
|
-
end
|
240
|
+
<div class="method-source-code" id="do_preprocessing-source">
|
241
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 114</span>
|
242
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">do_preprocessing</span>(<span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">controller</span>)
|
243
|
+
<span class="ruby-identifier">job_type</span> = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@type"</span>]
|
244
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">NEED_PREPROCESSING</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">job_type</span>)
|
245
|
+
<span class="ruby-keyword">return</span>
|
246
|
+
<span class="ruby-keyword">end</span>
|
258
247
|
|
259
248
|
<span class="ruby-comment"># Don't worry about adding on the self. prefix - send will resolve</span>
|
260
249
|
<span class="ruby-comment"># it the right way</span>
|
261
|
-
preprocess =
|
262
|
-
send(preprocess
|
263
|
-
end</pre>
|
264
|
-
</div
|
250
|
+
<span class="ruby-identifier">preprocess</span> = <span class="ruby-node">"preprocess_#{job_type}"</span>.<span class="ruby-identifier">to_sym</span>
|
251
|
+
<span class="ruby-identifier">send</span>(<span class="ruby-identifier">preprocess</span>, <span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">controller</span>)
|
252
|
+
<span class="ruby-keyword">end</span></pre>
|
253
|
+
</div><!-- do_preprocessing-source -->
|
265
254
|
|
266
255
|
</div>
|
267
256
|
|
268
257
|
|
269
258
|
|
270
259
|
|
271
|
-
</div
|
260
|
+
</div><!-- do_preprocessing-method -->
|
272
261
|
|
273
262
|
|
274
|
-
<div id="get_input
|
275
|
-
<a name="method-c-get_input"></a>
|
276
|
-
|
263
|
+
<div id="method-c-get_input" class="method-detail ">
|
277
264
|
|
278
265
|
<div class="method-heading">
|
279
266
|
<span class="method-name">get_input</span><span
|
@@ -290,50 +277,46 @@ job succeeded and if it failed, the reason for it.</p>
|
|
290
277
|
|
291
278
|
|
292
279
|
|
293
|
-
<div class="method-source-code"
|
294
|
-
|
295
|
-
<
|
296
|
-
<span class="ruby-
|
297
|
-
def self.get_input(job_data, ssh_args, shadow_ip, controller)
|
298
|
-
result = {:result => :success}
|
280
|
+
<div class="method-source-code" id="get_input-source">
|
281
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 406</span>
|
282
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_input</span>(<span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">ssh_args</span>, <span class="ruby-identifier">shadow_ip</span>, <span class="ruby-identifier">controller</span>)
|
283
|
+
<span class="ruby-identifier">result</span> = {<span class="ruby-value">:result</span> =<span class="ruby-operator">></span> <span class="ruby-value">:success</span>}
|
299
284
|
|
300
|
-
self
|
285
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_param</span>(<span class="ruby-string">"@local"</span>, <span class="ruby-identifier">job_data</span>)
|
301
286
|
|
302
|
-
local_file = <span class="ruby-constant">File</span
|
303
|
-
if
|
304
|
-
reason =
|
287
|
+
<span class="ruby-identifier">local_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@local"</span>])
|
288
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">local_file</span>)
|
289
|
+
<span class="ruby-identifier">reason</span> = <span class="ruby-node">"the file you specified to copy, #{local_file}, doesn't exist."</span> <span class="ruby-operator">+</span>
|
305
290
|
<span class="ruby-string">" Please specify a file that exists and try again."</span>
|
306
|
-
return {
|
307
|
-
end
|
291
|
+
<span class="ruby-keyword">return</span> {<span class="ruby-value">:result</span> =<span class="ruby-operator">></span> <span class="ruby-value">:failure</span>, <span class="ruby-value">:reason</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">reason</span>}
|
292
|
+
<span class="ruby-keyword">end</span>
|
308
293
|
|
309
|
-
remote =
|
310
|
-
scp_cmd =
|
294
|
+
<span class="ruby-identifier">remote</span> = <span class="ruby-node">"/tmp/neptune-input-#{rand(100000)}"</span>
|
295
|
+
<span class="ruby-identifier">scp_cmd</span> = <span class="ruby-node">"scp -r #{ssh_args} #{local_file} root@#{shadow_ip}:#{remote}"</span>
|
311
296
|
<span class="ruby-comment"># Kernel.puts scp_cmd</span>
|
312
|
-
<span class="ruby-constant">CommonFunctions</span
|
297
|
+
<span class="ruby-constant">CommonFunctions</span>.<span class="ruby-identifier">shell</span>(<span class="ruby-identifier">scp_cmd</span>)
|
313
298
|
|
314
|
-
job_data[<span class="ruby-string">"@local"</span>] = remote
|
299
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@local"</span>] = <span class="ruby-identifier">remote</span>
|
315
300
|
<span class="ruby-comment"># Kernel.puts "job data = #{job_data.inspect}"</span>
|
316
|
-
response = controller
|
317
|
-
if response
|
318
|
-
return {
|
319
|
-
else
|
301
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">put_input</span>(<span class="ruby-identifier">job_data</span>)
|
302
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">response</span>
|
303
|
+
<span class="ruby-keyword">return</span> {<span class="ruby-value">:result</span> =<span class="ruby-operator">></span> <span class="ruby-value">:success</span>}
|
304
|
+
<span class="ruby-keyword">else</span>
|
320
305
|
<span class="ruby-comment"># TODO - expand this to include the reason why it failed</span>
|
321
|
-
return {
|
322
|
-
end
|
323
|
-
end</pre>
|
324
|
-
</div
|
306
|
+
<span class="ruby-keyword">return</span> {<span class="ruby-value">:result</span> =<span class="ruby-operator">></span> <span class="ruby-value">:failure</span>}
|
307
|
+
<span class="ruby-keyword">end</span>
|
308
|
+
<span class="ruby-keyword">end</span></pre>
|
309
|
+
</div><!-- get_input-source -->
|
325
310
|
|
326
311
|
</div>
|
327
312
|
|
328
313
|
|
329
314
|
|
330
315
|
|
331
|
-
</div
|
316
|
+
</div><!-- get_input-method -->
|
332
317
|
|
333
318
|
|
334
|
-
<div id="get_job_data
|
335
|
-
<a name="method-c-get_job_data"></a>
|
336
|
-
|
319
|
+
<div id="method-c-get_job_data" class="method-detail ">
|
337
320
|
|
338
321
|
<div class="method-heading">
|
339
322
|
<span class="method-name">get_job_data</span><span
|
@@ -347,74 +330,70 @@ end</pre>
|
|
347
330
|
<p>This method takes in a hash in the format that users write neptune/babel
|
348
331
|
jobs in {:a => “b”} and converts it to the legacy format that
|
349
332
|
Neptune used to use {“@a” => “b”}, and is understood by the
|
350
|
-
|
333
|
+
NeptuneManager.</p>
|
351
334
|
|
352
335
|
|
353
336
|
|
354
|
-
<div class="method-source-code"
|
355
|
-
|
356
|
-
<
|
357
|
-
<span class="ruby-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
key = "@#{k}"
|
362
|
-
job_data[key] = v
|
337
|
+
<div class="method-source-code" id="get_job_data-source">
|
338
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 313</span>
|
339
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_job_data</span>(<span class="ruby-identifier">params</span>)
|
340
|
+
<span class="ruby-identifier">job_data</span> = {}
|
341
|
+
<span class="ruby-identifier">params</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
342
|
+
<span class="ruby-identifier">key</span> = <span class="ruby-node">"@#{k}"</span>
|
343
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">v</span>
|
363
344
|
}
|
364
345
|
|
365
|
-
job_data
|
366
|
-
job_data[<span class="ruby-string">"@keyname"</span>] = params[
|
346
|
+
<span class="ruby-identifier">job_data</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-string">"@job"</span>)
|
347
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@keyname"</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-value">:keyname</span>] <span class="ruby-operator">||</span> <span class="ruby-string">"appscale"</span>
|
367
348
|
|
368
|
-
job_data[<span class="ruby-string">"@type"</span>] = job_data[<span class="ruby-string">"@type"</span>]
|
369
|
-
type = job_data[<span class="ruby-string">"@type"</span>]
|
349
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@type"</span>] = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@type"</span>].<span class="ruby-identifier">to_s</span>
|
350
|
+
<span class="ruby-identifier">type</span> = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@type"</span>]
|
370
351
|
|
371
|
-
if
|
372
|
-
raise <span class="ruby-constant">BadConfigurationException</span
|
373
|
-
end
|
352
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">ALLOWED_JOB_TYPES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>)
|
353
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">JOB_TYPE_NOT_ALLOWED</span>)
|
354
|
+
<span class="ruby-keyword">end</span>
|
374
355
|
|
375
|
-
if type
|
376
|
-
job_data[<span class="ruby-string">"@type"</span>] = <span class="ruby-string">"mpi"</span>
|
377
|
-
type = <span class="ruby-string">"mpi"</span>
|
378
|
-
end
|
356
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-string">"upc"</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-string">"x10"</span>
|
357
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@type"</span>] = <span class="ruby-string">"mpi"</span>
|
358
|
+
<span class="ruby-identifier">type</span> = <span class="ruby-string">"mpi"</span>
|
359
|
+
<span class="ruby-keyword">end</span>
|
379
360
|
|
380
361
|
<span class="ruby-comment"># kdt jobs also run as mpi jobs, but need to pass along an executable</span>
|
381
362
|
<span class="ruby-comment"># parameter to let mpiexec know to use python to exec it</span>
|
382
|
-
if type
|
383
|
-
job_data[<span class="ruby-string">"@type"</span>] = <span class="ruby-string">"mpi"</span>
|
384
|
-
type = <span class="ruby-string">"mpi"</span>
|
363
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-string">"kdt"</span>
|
364
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@type"</span>] = <span class="ruby-string">"mpi"</span>
|
365
|
+
<span class="ruby-identifier">type</span> = <span class="ruby-string">"mpi"</span>
|
385
366
|
|
386
|
-
job_data[<span class="ruby-string">"@executable"</span>] = <span class="ruby-string">"python"</span>
|
387
|
-
end
|
367
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@executable"</span>] = <span class="ruby-string">"python"</span>
|
368
|
+
<span class="ruby-keyword">end</span>
|
388
369
|
|
389
|
-
if job_data[<span class="ruby-string">"@nodes_to_use"</span>]
|
390
|
-
job_data[<span class="ruby-string">"@nodes_to_use"</span>] = job_data[<span class="ruby-string">"@nodes_to_use"</span>]
|
391
|
-
end
|
370
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@nodes_to_use"</span>].<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Hash</span>
|
371
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@nodes_to_use"</span>] = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@nodes_to_use"</span>].<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">flatten</span>
|
372
|
+
<span class="ruby-keyword">end</span>
|
392
373
|
|
393
|
-
if
|
394
|
-
if (job_data[<span class="ruby-string">"@output"</span>]
|
395
|
-
raise <span class="ruby-constant">BadConfigurationException</span
|
396
|
-
end
|
374
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">NO_OUTPUT_NEEDED</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>)
|
375
|
+
<span class="ruby-keyword">if</span> (<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@output"</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@output"</span>].<span class="ruby-identifier">empty?</span>)
|
376
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">"Job output must be specified"</span>)
|
377
|
+
<span class="ruby-keyword">end</span>
|
397
378
|
|
398
|
-
if job_data[<span class="ruby-string">"@output"</span>][0]
|
399
|
-
raise <span class="ruby-constant">BadConfigurationException</span
|
400
|
-
end
|
401
|
-
end
|
379
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@output"</span>][<span class="ruby-value">0</span>].<span class="ruby-identifier">chr</span> <span class="ruby-operator">!=</span> <span class="ruby-string">"/"</span>
|
380
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">"Job output must begin with a slash ('/')"</span>)
|
381
|
+
<span class="ruby-keyword">end</span>
|
382
|
+
<span class="ruby-keyword">end</span>
|
402
383
|
|
403
|
-
return job_data
|
404
|
-
end</pre>
|
405
|
-
</div
|
384
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">job_data</span>
|
385
|
+
<span class="ruby-keyword">end</span></pre>
|
386
|
+
</div><!-- get_job_data-source -->
|
406
387
|
|
407
388
|
</div>
|
408
389
|
|
409
390
|
|
410
391
|
|
411
392
|
|
412
|
-
</div
|
393
|
+
</div><!-- get_job_data-method -->
|
413
394
|
|
414
395
|
|
415
|
-
<div id="get_std_out_and_err
|
416
|
-
<a name="method-c-get_std_out_and_err"></a>
|
417
|
-
|
396
|
+
<div id="method-c-get_std_out_and_err" class="method-detail ">
|
418
397
|
|
419
398
|
<div class="method-heading">
|
420
399
|
<span class="method-name">get_std_out_and_err</span><span
|
@@ -431,40 +410,36 @@ not the job completed successfully (success = no errors).</p>
|
|
431
410
|
|
432
411
|
|
433
412
|
|
434
|
-
<div class="method-source-code"
|
435
|
-
|
436
|
-
<
|
437
|
-
<span class="ruby-
|
438
|
-
def self.get_std_out_and_err(location)
|
439
|
-
result = {}
|
413
|
+
<div class="method-source-code" id="get_std_out_and_err-source">
|
414
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 486</span>
|
415
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_std_out_and_err</span>(<span class="ruby-identifier">location</span>)
|
416
|
+
<span class="ruby-identifier">result</span> = {}
|
440
417
|
|
441
|
-
out = <span class="ruby-constant">File</span
|
442
|
-
result[
|
418
|
+
<span class="ruby-identifier">out</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-node">"#{location}/compile_out"</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">read</span>.<span class="ruby-identifier">chomp!</span> }
|
419
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-value">:out</span>] = <span class="ruby-identifier">out</span>
|
443
420
|
|
444
|
-
err = <span class="ruby-constant">File</span
|
445
|
-
result[
|
421
|
+
<span class="ruby-identifier">err</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-node">"#{location}/compile_err"</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">read</span>.<span class="ruby-identifier">chomp!</span> }
|
422
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-value">:err</span>] = <span class="ruby-identifier">err</span>
|
446
423
|
|
447
|
-
if result[
|
448
|
-
result[
|
449
|
-
else
|
450
|
-
result[
|
451
|
-
end
|
424
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span>[<span class="ruby-value">:err</span>]
|
425
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-value">:result</span>] = <span class="ruby-value">:failure</span>
|
426
|
+
<span class="ruby-keyword">else</span>
|
427
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-value">:result</span>] = <span class="ruby-value">:success</span>
|
428
|
+
<span class="ruby-keyword">end</span>
|
452
429
|
|
453
|
-
return result
|
454
|
-
end</pre>
|
455
|
-
</div
|
430
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
431
|
+
<span class="ruby-keyword">end</span></pre>
|
432
|
+
</div><!-- get_std_out_and_err-source -->
|
456
433
|
|
457
434
|
</div>
|
458
435
|
|
459
436
|
|
460
437
|
|
461
438
|
|
462
|
-
</div
|
439
|
+
</div><!-- get_std_out_and_err-method -->
|
463
440
|
|
464
441
|
|
465
|
-
<div id="preprocess_babel
|
466
|
-
<a name="method-c-preprocess_babel"></a>
|
467
|
-
|
442
|
+
<div id="method-c-preprocess_babel" class="method-detail ">
|
468
443
|
|
469
444
|
<div class="method-heading">
|
470
445
|
<span class="method-name">preprocess_babel</span><span
|
@@ -482,66 +457,66 @@ engines can be found by contacting an AppScale node.</p>
|
|
482
457
|
|
483
458
|
|
484
459
|
|
485
|
-
<div class="method-source-code"
|
486
|
-
|
487
|
-
<
|
488
|
-
<span class="ruby-
|
489
|
-
|
490
|
-
self
|
491
|
-
self
|
492
|
-
self
|
460
|
+
<div class="method-source-code" id="preprocess_babel-source">
|
461
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 261</span>
|
462
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">preprocess_babel</span>(<span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">controller</span>)
|
463
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_param</span>(<span class="ruby-string">"@code"</span>, <span class="ruby-identifier">job_data</span>)
|
464
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_param</span>(<span class="ruby-string">"@engine"</span>, <span class="ruby-identifier">job_data</span>)
|
465
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_param</span>(<span class="ruby-string">"@output"</span>, <span class="ruby-identifier">job_data</span>)
|
466
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_param</span>(<span class="ruby-string">"@error"</span>, <span class="ruby-identifier">job_data</span>)
|
467
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_param</span>(<span class="ruby-string">"@metadata"</span>, <span class="ruby-identifier">job_data</span>)
|
493
468
|
|
494
469
|
<span class="ruby-comment"># For most code types, the file's name given is the thing to exec.</span>
|
495
470
|
<span class="ruby-comment"># For Java, the actual file to search for is whatever the user gives</span>
|
496
471
|
<span class="ruby-comment"># us, with a .class extension.</span>
|
497
|
-
code_file_name = job_data[<span class="ruby-string">"@code"</span>]
|
498
|
-
if
|
499
|
-
code_file_name
|
500
|
-
end
|
501
|
-
|
502
|
-
self
|
503
|
-
self
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
472
|
+
<span class="ruby-identifier">code_file_name</span> = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@code"</span>]
|
473
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@executable"</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@executable"</span>] <span class="ruby-operator">==</span> <span class="ruby-string">"java"</span>
|
474
|
+
<span class="ruby-identifier">code_file_name</span> <span class="ruby-operator">+=</span> <span class="ruby-string">".class"</span>
|
475
|
+
<span class="ruby-keyword">end</span>
|
476
|
+
|
477
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_file_to_exist</span>(<span class="ruby-identifier">code_file_name</span>, <span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">controller</span>)
|
478
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_file_to_not_exist</span>(<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@output"</span>], <span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">controller</span>)
|
479
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_file_to_not_exist</span>(<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@error"</span>], <span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">controller</span>)
|
480
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_file_to_not_exist</span>(<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@metadata"</span>], <span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">controller</span>)
|
481
|
+
|
482
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@argv"</span>]
|
483
|
+
<span class="ruby-identifier">argv</span> = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@argv"</span>]
|
484
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Array</span>
|
485
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">"argv must be an array"</span>)
|
486
|
+
<span class="ruby-keyword">end</span>
|
487
|
+
|
488
|
+
<span class="ruby-identifier">argv</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
|
489
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">arg</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r\/.*\/.*/</span>
|
490
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_file_to_exist</span>(<span class="ruby-identifier">arg</span>, <span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">controller</span>)
|
491
|
+
<span class="ruby-keyword">end</span>
|
515
492
|
}
|
516
|
-
end
|
493
|
+
<span class="ruby-keyword">end</span>
|
517
494
|
|
518
|
-
if job_data[<span class="ruby-string">"@appcfg_cookies"</span>]
|
519
|
-
self
|
520
|
-
end
|
495
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@appcfg_cookies"</span>]
|
496
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_file_to_exist</span>(<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@appcfg_cookies"</span>], <span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">controller</span>)
|
497
|
+
<span class="ruby-keyword">end</span>
|
521
498
|
|
522
|
-
user_specified_engine = job_data[<span class="ruby-string">"@engine"</span>]
|
499
|
+
<span class="ruby-identifier">user_specified_engine</span> = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@engine"</span>]
|
523
500
|
|
524
501
|
<span class="ruby-comment"># validate the engine here</span>
|
525
|
-
engines = controller
|
526
|
-
if
|
527
|
-
raise <span class="ruby-constant">BadConfigurationException</span
|
528
|
-
|
529
|
-
|
530
|
-
end
|
531
|
-
end</pre>
|
532
|
-
</div
|
502
|
+
<span class="ruby-identifier">engines</span> = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">get_supported_babel_engines</span>(<span class="ruby-identifier">job_data</span>)
|
503
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">engines</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">user_specified_engine</span>)
|
504
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">"The engine you specified, "</span> <span class="ruby-operator">+</span>
|
505
|
+
<span class="ruby-node">"#{user_specified_engine}, is not a supported engine. Supported engines"</span> <span class="ruby-operator">+</span>
|
506
|
+
<span class="ruby-node">" are: #{engines.join(', ')}"</span>)
|
507
|
+
<span class="ruby-keyword">end</span>
|
508
|
+
<span class="ruby-keyword">end</span></pre>
|
509
|
+
</div><!-- preprocess_babel-source -->
|
533
510
|
|
534
511
|
</div>
|
535
512
|
|
536
513
|
|
537
514
|
|
538
515
|
|
539
|
-
</div
|
516
|
+
</div><!-- preprocess_babel-method -->
|
540
517
|
|
541
518
|
|
542
|
-
<div id="preprocess_compile
|
543
|
-
<a name="method-c-preprocess_compile"></a>
|
544
|
-
|
519
|
+
<div id="method-c-preprocess_compile" class="method-detail ">
|
545
520
|
|
546
521
|
<div class="method-heading">
|
547
522
|
<span class="method-name">preprocess_compile</span><span
|
@@ -558,42 +533,38 @@ copy over libraries as well.</p>
|
|
558
533
|
|
559
534
|
|
560
535
|
|
561
|
-
<div class="method-source-code"
|
562
|
-
|
563
|
-
<
|
564
|
-
<span class="ruby-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
raise <span class="ruby-constant">BadConfigurationException</span>.new("The source file #{code} does not exist.")
|
569
|
-
end
|
536
|
+
<div class="method-source-code" id="preprocess_compile-source">
|
537
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 130</span>
|
538
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">preprocess_compile</span>(<span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">controller</span>)
|
539
|
+
<span class="ruby-identifier">code</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@code"</span>])
|
540
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">code</span>)
|
541
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"The source file #{code} does not exist."</span>)
|
542
|
+
<span class="ruby-keyword">end</span>
|
570
543
|
|
571
|
-
suffix = code
|
572
|
-
dest =
|
573
|
-
keyname = job_data[<span class="ruby-string">"@keyname"</span>]
|
574
|
-
shadow_ip = <span class="ruby-constant">CommonFunctions</span
|
544
|
+
<span class="ruby-identifier">suffix</span> = <span class="ruby-identifier">code</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">'/'</span>)[<span class="ruby-value">-1</span>]
|
545
|
+
<span class="ruby-identifier">dest</span> = <span class="ruby-node">"/tmp/#{suffix}"</span>
|
546
|
+
<span class="ruby-identifier">keyname</span> = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@keyname"</span>]
|
547
|
+
<span class="ruby-identifier">shadow_ip</span> = <span class="ruby-constant">CommonFunctions</span>.<span class="ruby-identifier">get_from_yaml</span>(<span class="ruby-identifier">keyname</span>, <span class="ruby-value">:shadow</span>)
|
575
548
|
|
576
|
-
ssh_args =
|
577
|
-
remove_dir =
|
549
|
+
<span class="ruby-identifier">ssh_args</span> = <span class="ruby-node">"-i ~/.appscale/#{keyname}.key -o StrictHostkeyChecking=no root@#{shadow_ip}"</span>
|
550
|
+
<span class="ruby-identifier">remove_dir</span> = <span class="ruby-node">"ssh #{ssh_args} 'rm -rf #{dest}' 2>&1"</span>
|
578
551
|
<span class="ruby-comment"># Kernel.puts remove_dir</span>
|
579
|
-
<span class="ruby-constant">CommonFunctions</span
|
580
|
-
<span class="ruby-constant">CommonFunctions</span
|
552
|
+
<span class="ruby-constant">CommonFunctions</span>.<span class="ruby-identifier">shell</span>(<span class="ruby-identifier">remove_dir</span>)
|
553
|
+
<span class="ruby-constant">CommonFunctions</span>.<span class="ruby-identifier">scp_to_shadow</span>(<span class="ruby-identifier">code</span>, <span class="ruby-identifier">dest</span>, <span class="ruby-identifier">keyname</span>, <span class="ruby-identifier">is_dir</span>=<span class="ruby-keyword">true</span>)
|
581
554
|
|
582
|
-
job_data[<span class="ruby-string">"@code"</span>] = dest
|
583
|
-
end</pre>
|
584
|
-
</div
|
555
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@code"</span>] = <span class="ruby-identifier">dest</span>
|
556
|
+
<span class="ruby-keyword">end</span></pre>
|
557
|
+
</div><!-- preprocess_compile-source -->
|
585
558
|
|
586
559
|
</div>
|
587
560
|
|
588
561
|
|
589
562
|
|
590
563
|
|
591
|
-
</div
|
564
|
+
</div><!-- preprocess_compile-method -->
|
592
565
|
|
593
566
|
|
594
|
-
<div id="preprocess_erlang
|
595
|
-
<a name="method-c-preprocess_erlang"></a>
|
596
|
-
|
567
|
+
<div id="method-c-preprocess_erlang" class="method-detail ">
|
597
568
|
|
598
569
|
<div class="method-heading">
|
599
570
|
<span class="method-name">preprocess_erlang</span><span
|
@@ -609,36 +580,32 @@ and copies it over to the AppScale Shadow node.</p>
|
|
609
580
|
|
610
581
|
|
611
582
|
|
612
|
-
<div class="method-source-code"
|
613
|
-
|
614
|
-
<
|
615
|
-
<span class="ruby-
|
616
|
-
def self.preprocess_erlang(job_data, controller)
|
617
|
-
self.require_param(<span class="ruby-string">"@code"</span>, job_data)
|
583
|
+
<div class="method-source-code" id="preprocess_erlang-source">
|
584
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 153</span>
|
585
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">preprocess_erlang</span>(<span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">controller</span>)
|
586
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_param</span>(<span class="ruby-string">"@code"</span>, <span class="ruby-identifier">job_data</span>)
|
618
587
|
|
619
|
-
source_code = <span class="ruby-constant">File</span
|
620
|
-
if
|
621
|
-
raise <span class="ruby-constant">BadConfigurationException</span
|
588
|
+
<span class="ruby-identifier">source_code</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@code"</span>])
|
589
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">source_code</span>)
|
590
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"The specified code, #{job_data['@code']},"</span> <span class="ruby-operator">+</span>
|
622
591
|
<span class="ruby-string">" didn't exist. Please specify one that exists and try again"</span>)
|
623
|
-
end
|
624
|
-
dest_code = <span class="ruby-string">"/tmp/"</span>
|
592
|
+
<span class="ruby-keyword">end</span>
|
593
|
+
<span class="ruby-identifier">dest_code</span> = <span class="ruby-string">"/tmp/"</span>
|
625
594
|
|
626
|
-
keyname = job_data[<span class="ruby-string">"@keyname"</span>]
|
627
|
-
<span class="ruby-constant">CommonFunctions</span
|
628
|
-
end</pre>
|
629
|
-
</div
|
595
|
+
<span class="ruby-identifier">keyname</span> = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@keyname"</span>]
|
596
|
+
<span class="ruby-constant">CommonFunctions</span>.<span class="ruby-identifier">scp_to_shadow</span>(<span class="ruby-identifier">source_code</span>, <span class="ruby-identifier">dest_code</span>, <span class="ruby-identifier">keyname</span>)
|
597
|
+
<span class="ruby-keyword">end</span></pre>
|
598
|
+
</div><!-- preprocess_erlang-source -->
|
630
599
|
|
631
600
|
</div>
|
632
601
|
|
633
602
|
|
634
603
|
|
635
604
|
|
636
|
-
</div
|
605
|
+
</div><!-- preprocess_erlang-method -->
|
637
606
|
|
638
607
|
|
639
|
-
<div id="preprocess_mpi
|
640
|
-
<a name="method-c-preprocess_mpi"></a>
|
641
|
-
|
608
|
+
<div id="method-c-preprocess_mpi" class="method-detail ">
|
642
609
|
|
643
610
|
<div class="method-heading">
|
644
611
|
<span class="method-name">preprocess_mpi</span><span
|
@@ -656,50 +623,49 @@ also verify that this value is at least as many as the number of nodes
|
|
656
623
|
|
657
624
|
|
658
625
|
|
659
|
-
<div class="method-source-code"
|
660
|
-
|
661
|
-
<
|
662
|
-
<span class="ruby-
|
663
|
-
|
664
|
-
self
|
665
|
-
self
|
626
|
+
<div class="method-source-code" id="preprocess_mpi-source">
|
627
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 172</span>
|
628
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">preprocess_mpi</span>(<span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">controller</span>)
|
629
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_param</span>(<span class="ruby-string">"@nodes_to_use"</span>, <span class="ruby-identifier">job_data</span>)
|
630
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_param</span>(<span class="ruby-string">"@procs_to_use"</span>, <span class="ruby-identifier">job_data</span>)
|
631
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_param</span>(<span class="ruby-string">"@output"</span>, <span class="ruby-identifier">job_data</span>)
|
632
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_param</span>(<span class="ruby-string">"@error"</span>, <span class="ruby-identifier">job_data</span>)
|
633
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_param</span>(<span class="ruby-string">"@metadata"</span>, <span class="ruby-identifier">job_data</span>)
|
666
634
|
|
667
|
-
if job_data[<span class="ruby-string">"@procs_to_use"</span>]
|
668
|
-
p = job_data[<span class="ruby-string">"@procs_to_use"</span>]
|
669
|
-
n = job_data[<span class="ruby-string">"@nodes_to_use"</span>]
|
670
|
-
if p
|
671
|
-
raise <span class="ruby-constant">BadConfigurationException</span
|
635
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@procs_to_use"</span>]
|
636
|
+
<span class="ruby-identifier">p</span> = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@procs_to_use"</span>]
|
637
|
+
<span class="ruby-identifier">n</span> = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@nodes_to_use"</span>]
|
638
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">p</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">n</span>
|
639
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">":procs_to_use must be at least as "</span> <span class="ruby-operator">+</span>
|
672
640
|
<span class="ruby-string">"large as :nodes_to_use."</span>)
|
673
|
-
end
|
674
|
-
end
|
641
|
+
<span class="ruby-keyword">end</span>
|
642
|
+
<span class="ruby-keyword">end</span>
|
675
643
|
|
676
|
-
if job_data[<span class="ruby-string">"@argv"</span>]
|
677
|
-
argv = job_data[<span class="ruby-string">"@argv"</span>]
|
644
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@argv"</span>]
|
645
|
+
<span class="ruby-identifier">argv</span> = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@argv"</span>]
|
678
646
|
|
679
|
-
if argv
|
680
|
-
job_data[<span class="ruby-string">"@argv"</span>] = argv
|
681
|
-
elsif argv
|
682
|
-
job_data[<span class="ruby-string">"@argv"</span>] = argv
|
683
|
-
else
|
684
|
-
raise <span class="ruby-constant">BadConfigurationException</span
|
685
|
-
end
|
686
|
-
end
|
647
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span>
|
648
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@argv"</span>] = <span class="ruby-identifier">argv</span>
|
649
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span>
|
650
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@argv"</span>] = <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>)
|
651
|
+
<span class="ruby-keyword">else</span>
|
652
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">":argv must be either a String or Array"</span>)
|
653
|
+
<span class="ruby-keyword">end</span>
|
654
|
+
<span class="ruby-keyword">end</span>
|
687
655
|
|
688
|
-
return job_data
|
689
|
-
end</pre>
|
690
|
-
</div
|
656
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">job_data</span>
|
657
|
+
<span class="ruby-keyword">end</span></pre>
|
658
|
+
</div><!-- preprocess_mpi-source -->
|
691
659
|
|
692
660
|
</div>
|
693
661
|
|
694
662
|
|
695
663
|
|
696
664
|
|
697
|
-
</div
|
665
|
+
</div><!-- preprocess_mpi-method -->
|
698
666
|
|
699
667
|
|
700
|
-
<div id="preprocess_ssa
|
701
|
-
<a name="method-c-preprocess_ssa"></a>
|
702
|
-
|
668
|
+
<div id="method-c-preprocess_ssa" class="method-detail ">
|
703
669
|
|
704
670
|
<div class="method-heading">
|
705
671
|
<span class="method-name">preprocess_ssa</span><span
|
@@ -717,37 +683,33 @@ specify, convert it to be :trajectories.</p>
|
|
717
683
|
|
718
684
|
|
719
685
|
|
720
|
-
<div class="method-source-code"
|
721
|
-
|
722
|
-
<
|
723
|
-
<span class="ruby-
|
724
|
-
|
725
|
-
if job_data[<span class="ruby-string">"@simulations"</span>] and job_data[<span class="ruby-string">"@trajectories"</span>]
|
726
|
-
raise <span class="ruby-constant">BadConfigurationException</span>.new(<span class="ruby-string">":simulations and :trajectories "</span> +
|
686
|
+
<div class="method-source-code" id="preprocess_ssa-source">
|
687
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 208</span>
|
688
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">preprocess_ssa</span>(<span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">controller</span>)
|
689
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@simulations"</span>] <span class="ruby-keyword">and</span> <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@trajectories"</span>]
|
690
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">":simulations and :trajectories "</span> <span class="ruby-operator">+</span>
|
727
691
|
<span class="ruby-string">"not both be specified."</span>)
|
728
|
-
end
|
692
|
+
<span class="ruby-keyword">end</span>
|
729
693
|
|
730
|
-
if job_data[<span class="ruby-string">"@simulations"</span>]
|
731
|
-
job_data[<span class="ruby-string">"@trajectories"</span>] = job_data[<span class="ruby-string">"@simulations"</span>]
|
732
|
-
job_data
|
733
|
-
end
|
694
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@simulations"</span>]
|
695
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@trajectories"</span>] = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@simulations"</span>]
|
696
|
+
<span class="ruby-identifier">job_data</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-string">"@simulations"</span>)
|
697
|
+
<span class="ruby-keyword">end</span>
|
734
698
|
|
735
|
-
self
|
736
|
-
return job_data
|
737
|
-
end</pre>
|
738
|
-
</div
|
699
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_param</span>(<span class="ruby-string">"@trajectories"</span>, <span class="ruby-identifier">job_data</span>)
|
700
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">job_data</span>
|
701
|
+
<span class="ruby-keyword">end</span></pre>
|
702
|
+
</div><!-- preprocess_ssa-source -->
|
739
703
|
|
740
704
|
</div>
|
741
705
|
|
742
706
|
|
743
707
|
|
744
708
|
|
745
|
-
</div
|
709
|
+
</div><!-- preprocess_ssa-method -->
|
746
710
|
|
747
711
|
|
748
|
-
<div id="require_file_to_exist
|
749
|
-
<a name="method-c-require_file_to_exist"></a>
|
750
|
-
|
712
|
+
<div id="method-c-require_file_to_exist" class="method-detail ">
|
751
713
|
|
752
714
|
<div class="method-heading">
|
753
715
|
<span class="method-name">require_file_to_exist</span><span
|
@@ -758,35 +720,31 @@ end</pre>
|
|
758
720
|
|
759
721
|
<div class="method-description">
|
760
722
|
|
761
|
-
<p>This helper method asks the
|
723
|
+
<p>This helper method asks the NeptuneManager if the named file exists, and if
|
762
724
|
it does not, throws an exception.</p>
|
763
725
|
|
764
726
|
|
765
727
|
|
766
|
-
<div class="method-source-code"
|
767
|
-
|
768
|
-
<
|
769
|
-
<span class="ruby-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
end</pre>
|
777
|
-
</div>
|
728
|
+
<div class="method-source-code" id="require_file_to_exist-source">
|
729
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 235</span>
|
730
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_file_to_exist</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">controller</span>)
|
731
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">does_file_exist?</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">job_data</span>)
|
732
|
+
<span class="ruby-keyword">return</span>
|
733
|
+
<span class="ruby-keyword">else</span>
|
734
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">FileNotFoundException</span>
|
735
|
+
<span class="ruby-keyword">end</span>
|
736
|
+
<span class="ruby-keyword">end</span></pre>
|
737
|
+
</div><!-- require_file_to_exist-source -->
|
778
738
|
|
779
739
|
</div>
|
780
740
|
|
781
741
|
|
782
742
|
|
783
743
|
|
784
|
-
</div
|
744
|
+
</div><!-- require_file_to_exist-method -->
|
785
745
|
|
786
746
|
|
787
|
-
<div id="require_file_to_not_exist
|
788
|
-
<a name="method-c-require_file_to_not_exist"></a>
|
789
|
-
|
747
|
+
<div id="method-c-require_file_to_not_exist" class="method-detail ">
|
790
748
|
|
791
749
|
<div class="method-heading">
|
792
750
|
<span class="method-name">require_file_to_not_exist</span><span
|
@@ -798,37 +756,33 @@ end</pre>
|
|
798
756
|
<div class="method-description">
|
799
757
|
|
800
758
|
<p>This helper method performs the opposite function of <a
|
801
|
-
href="NeptuneHelper.html#method-c-require_file_to_exist"
|
759
|
+
href="NeptuneHelper.html#method-c-require_file_to_exist">::require_file_to_exist</a>,
|
802
760
|
raising an exception if the named file does exist.</p>
|
803
761
|
|
804
762
|
|
805
763
|
|
806
|
-
<div class="method-source-code"
|
807
|
-
|
808
|
-
<
|
809
|
-
<span class="ruby-
|
810
|
-
|
811
|
-
begin
|
812
|
-
self.require_file_to_exist(file, job_data, controller)
|
764
|
+
<div class="method-source-code" id="require_file_to_not_exist-source">
|
765
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 246</span>
|
766
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_file_to_not_exist</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">controller</span>)
|
767
|
+
<span class="ruby-keyword">begin</span>
|
768
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_file_to_exist</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">controller</span>)
|
813
769
|
<span class="ruby-comment"># no exception thrown previously means that the output file exists</span>
|
814
|
-
raise <span class="ruby-constant">BadConfigurationException</span
|
815
|
-
rescue <span class="ruby-constant">FileNotFoundException</span>
|
816
|
-
return
|
817
|
-
end
|
818
|
-
end</pre>
|
819
|
-
</div
|
770
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">'Output specified already exists'</span>)
|
771
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">FileNotFoundException</span>
|
772
|
+
<span class="ruby-keyword">return</span>
|
773
|
+
<span class="ruby-keyword">end</span>
|
774
|
+
<span class="ruby-keyword">end</span></pre>
|
775
|
+
</div><!-- require_file_to_not_exist-source -->
|
820
776
|
|
821
777
|
</div>
|
822
778
|
|
823
779
|
|
824
780
|
|
825
781
|
|
826
|
-
</div
|
782
|
+
</div><!-- require_file_to_not_exist-method -->
|
827
783
|
|
828
784
|
|
829
|
-
<div id="require_param
|
830
|
-
<a name="method-c-require_param"></a>
|
831
|
-
|
785
|
+
<div id="method-c-require_param" class="method-detail ">
|
832
786
|
|
833
787
|
<div class="method-heading">
|
834
788
|
<span class="method-name">require_param</span><span
|
@@ -844,28 +798,24 @@ data provided.</p>
|
|
844
798
|
|
845
799
|
|
846
800
|
|
847
|
-
<div class="method-source-code"
|
848
|
-
|
849
|
-
<
|
850
|
-
<span class="ruby-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
end</pre>
|
856
|
-
</div>
|
801
|
+
<div class="method-source-code" id="require_param-source">
|
802
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 226</span>
|
803
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_param</span>(<span class="ruby-identifier">param</span>, <span class="ruby-identifier">job_data</span>)
|
804
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">job_data</span>[<span class="ruby-identifier">param</span>]
|
805
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"#{param} must be specified"</span>)
|
806
|
+
<span class="ruby-keyword">end</span>
|
807
|
+
<span class="ruby-keyword">end</span></pre>
|
808
|
+
</div><!-- require_param-source -->
|
857
809
|
|
858
810
|
</div>
|
859
811
|
|
860
812
|
|
861
813
|
|
862
814
|
|
863
|
-
</div
|
815
|
+
</div><!-- require_param-method -->
|
864
816
|
|
865
817
|
|
866
|
-
<div id="run_job
|
867
|
-
<a name="method-c-run_job"></a>
|
868
|
-
|
818
|
+
<div id="method-c-run_job" class="method-detail ">
|
869
819
|
|
870
820
|
<div class="method-heading">
|
871
821
|
<span class="method-name">run_job</span><span
|
@@ -881,56 +831,52 @@ as well as information about the node to send the request to.</p>
|
|
881
831
|
|
882
832
|
|
883
833
|
|
884
|
-
<div class="method-source-code"
|
885
|
-
|
886
|
-
<
|
887
|
-
<span class="ruby-
|
888
|
-
def self.run_job(job_data, ssh_args, shadow_ip, secret)
|
889
|
-
controller = <span class="ruby-constant">AppControllerClient</span>.new(shadow_ip, secret)
|
834
|
+
<div class="method-source-code" id="run_job-source">
|
835
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 536</span>
|
836
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">run_job</span>(<span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">ssh_args</span>, <span class="ruby-identifier">shadow_ip</span>, <span class="ruby-identifier">secret</span>)
|
837
|
+
<span class="ruby-identifier">controller</span> = <span class="ruby-constant">NeptuneManagerClient</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">shadow_ip</span>, <span class="ruby-identifier">secret</span>)
|
890
838
|
|
891
839
|
<span class="ruby-comment"># TODO - right now the job is assumed to succeed in many cases</span>
|
892
840
|
<span class="ruby-comment"># need to investigate the various failure scenarios</span>
|
893
|
-
result = {
|
894
|
-
|
895
|
-
case job_data[<span class="ruby-string">"@type"</span>]
|
896
|
-
when <span class="ruby-string">"input"</span>
|
897
|
-
result = self
|
898
|
-
when <span class="ruby-string">"output"</span>
|
899
|
-
result[
|
900
|
-
when <span class="ruby-string">"get-acl"</span>
|
901
|
-
job_data[<span class="ruby-string">"@type"</span>] = <span class="ruby-string">"acl"</span>
|
902
|
-
result[
|
903
|
-
when <span class="ruby-string">"set-acl"</span>
|
904
|
-
job_data[<span class="ruby-string">"@type"</span>] = <span class="ruby-string">"acl"</span>
|
905
|
-
result[
|
906
|
-
when <span class="ruby-string">"compile"</span>
|
907
|
-
result = self
|
908
|
-
when <span class="ruby-string">"cicero"</span>
|
909
|
-
self
|
910
|
-
msg = controller
|
911
|
-
result[
|
912
|
-
result[
|
913
|
-
else
|
914
|
-
msg = controller
|
915
|
-
result[
|
916
|
-
result[
|
917
|
-
end
|
918
|
-
|
919
|
-
return result
|
920
|
-
end</pre>
|
921
|
-
</div
|
841
|
+
<span class="ruby-identifier">result</span> = { <span class="ruby-value">:result</span> =<span class="ruby-operator">></span> <span class="ruby-value">:success</span> }
|
842
|
+
|
843
|
+
<span class="ruby-keyword">case</span> <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@type"</span>]
|
844
|
+
<span class="ruby-keyword">when</span> <span class="ruby-string">"input"</span>
|
845
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_input</span>(<span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">ssh_args</span>, <span class="ruby-identifier">shadow_ip</span>, <span class="ruby-identifier">controller</span>)
|
846
|
+
<span class="ruby-keyword">when</span> <span class="ruby-string">"output"</span>
|
847
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-value">:output</span>] = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">get_output</span>(<span class="ruby-identifier">job_data</span>)
|
848
|
+
<span class="ruby-keyword">when</span> <span class="ruby-string">"get-acl"</span>
|
849
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@type"</span>] = <span class="ruby-string">"acl"</span>
|
850
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-value">:acl</span>] = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">get_acl</span>(<span class="ruby-identifier">job_data</span>)
|
851
|
+
<span class="ruby-keyword">when</span> <span class="ruby-string">"set-acl"</span>
|
852
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@type"</span>] = <span class="ruby-string">"acl"</span>
|
853
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-value">:acl</span>] = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">set_acl</span>(<span class="ruby-identifier">job_data</span>)
|
854
|
+
<span class="ruby-keyword">when</span> <span class="ruby-string">"compile"</span>
|
855
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">compile_code</span>(<span class="ruby-identifier">job_data</span>, <span class="ruby-identifier">ssh_args</span>, <span class="ruby-identifier">shadow_ip</span>)
|
856
|
+
<span class="ruby-keyword">when</span> <span class="ruby-string">"cicero"</span>
|
857
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">upload_app_for_cicero</span>(<span class="ruby-identifier">job_data</span>)
|
858
|
+
<span class="ruby-identifier">msg</span> = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">start_neptune_job</span>(<span class="ruby-identifier">job_data</span>)
|
859
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-value">:msg</span>] = <span class="ruby-identifier">msg</span>
|
860
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-value">:result</span>] = <span class="ruby-value">:failure</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span>[<span class="ruby-value">:msg</span>] <span class="ruby-operator">!~</span> <span class="ruby-regexp">%rjob is now running\Z/</span>
|
861
|
+
<span class="ruby-keyword">else</span>
|
862
|
+
<span class="ruby-identifier">msg</span> = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">start_neptune_job</span>(<span class="ruby-identifier">job_data</span>)
|
863
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-value">:msg</span>] = <span class="ruby-identifier">msg</span>
|
864
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-value">:result</span>] = <span class="ruby-value">:failure</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span>[<span class="ruby-value">:msg</span>] <span class="ruby-operator">!~</span> <span class="ruby-regexp">%rjob is now running\Z/</span>
|
865
|
+
<span class="ruby-keyword">end</span>
|
866
|
+
|
867
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
868
|
+
<span class="ruby-keyword">end</span></pre>
|
869
|
+
</div><!-- run_job-source -->
|
922
870
|
|
923
871
|
</div>
|
924
872
|
|
925
873
|
|
926
874
|
|
927
875
|
|
928
|
-
</div
|
876
|
+
</div><!-- run_job-method -->
|
929
877
|
|
930
878
|
|
931
|
-
<div id="upload_app_for_cicero
|
932
|
-
<a name="method-c-upload_app_for_cicero"></a>
|
933
|
-
|
879
|
+
<div id="method-c-upload_app_for_cicero" class="method-detail ">
|
934
880
|
|
935
881
|
<div class="method-heading">
|
936
882
|
<span class="method-name">upload_app_for_cicero</span><span
|
@@ -946,48 +892,44 @@ with Cicero jobs. It requires the AppScale tools to be installed.</p>
|
|
946
892
|
|
947
893
|
|
948
894
|
|
949
|
-
<div class="method-source-code"
|
950
|
-
|
951
|
-
<
|
952
|
-
<span class="ruby-
|
953
|
-
def self.upload_app_for_cicero(job_data)
|
954
|
-
if !job_data[<span class="ruby-string">"@app"</span>]
|
895
|
+
<div class="method-source-code" id="upload_app_for_cicero-source">
|
896
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 507</span>
|
897
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">upload_app_for_cicero</span>(<span class="ruby-identifier">job_data</span>)
|
898
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@app"</span>]
|
955
899
|
<span class="ruby-comment"># Kernel.puts "No app specified, not uploading..." </span>
|
956
|
-
return
|
957
|
-
end
|
900
|
+
<span class="ruby-keyword">return</span>
|
901
|
+
<span class="ruby-keyword">end</span>
|
958
902
|
|
959
|
-
app_location = <span class="ruby-constant">File</span
|
960
|
-
if
|
961
|
-
raise <span class="ruby-constant">BadConfigurationException</span
|
903
|
+
<span class="ruby-identifier">app_location</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@app"</span>])
|
904
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">app_location</span>)
|
905
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"The app you specified, #{app_location}, does not exist."</span> <span class="ruby-operator">+</span>
|
962
906
|
<span class="ruby-string">"Please specify one that does and try again."</span>)
|
963
|
-
end
|
907
|
+
<span class="ruby-keyword">end</span>
|
964
908
|
|
965
|
-
keyname = job_data[<span class="ruby-string">"@keyname"</span>]
|
966
|
-
if job_data[<span class="ruby-string">"@appscale_tools"</span>]
|
967
|
-
upload_app = <span class="ruby-constant">File</span
|
968
|
-
<span class="ruby-constant">File</span
|
969
|
-
else
|
970
|
-
upload_app = <span class="ruby-string">"appscale-upload-app"</span>
|
971
|
-
end
|
909
|
+
<span class="ruby-identifier">keyname</span> = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@keyname"</span>] <span class="ruby-operator">||</span> <span class="ruby-string">"appscale"</span>
|
910
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@appscale_tools"</span>]
|
911
|
+
<span class="ruby-identifier">upload_app</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@appscale_tools"</span>]) <span class="ruby-operator">+</span>
|
912
|
+
<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">SEPARATOR</span> <span class="ruby-operator">+</span> <span class="ruby-string">"bin"</span> <span class="ruby-operator">+</span> <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">SEPARATOR</span> <span class="ruby-operator">+</span> <span class="ruby-string">"appscale-upload-app"</span>
|
913
|
+
<span class="ruby-keyword">else</span>
|
914
|
+
<span class="ruby-identifier">upload_app</span> = <span class="ruby-string">"appscale-upload-app"</span>
|
915
|
+
<span class="ruby-keyword">end</span>
|
972
916
|
|
973
917
|
<span class="ruby-comment"># Kernel.puts "Uploading AppEngine app at #{app_location}"</span>
|
974
|
-
upload_command =
|
918
|
+
<span class="ruby-identifier">upload_command</span> = <span class="ruby-node">"#{upload_app} --file #{app_location} --test --keyname #{keyname}"</span>
|
975
919
|
<span class="ruby-comment"># Kernel.puts upload_command</span>
|
976
920
|
<span class="ruby-comment"># Kernel.puts `#{upload_command}`</span>
|
977
|
-
end</pre>
|
978
|
-
</div
|
921
|
+
<span class="ruby-keyword">end</span></pre>
|
922
|
+
</div><!-- upload_app_for_cicero-source -->
|
979
923
|
|
980
924
|
</div>
|
981
925
|
|
982
926
|
|
983
927
|
|
984
928
|
|
985
|
-
</div
|
929
|
+
</div><!-- upload_app_for_cicero-method -->
|
986
930
|
|
987
931
|
|
988
|
-
<div id="validate_storage_params
|
989
|
-
<a name="method-c-validate_storage_params"></a>
|
990
|
-
|
932
|
+
<div id="method-c-validate_storage_params" class="method-detail ">
|
991
933
|
|
992
934
|
<div class="method-heading">
|
993
935
|
<span class="method-name">validate_storage_params</span><span
|
@@ -1005,58 +947,54 @@ parameter is missing.</p>
|
|
1005
947
|
|
1006
948
|
|
1007
949
|
|
1008
|
-
<div class="method-source-code"
|
1009
|
-
|
1010
|
-
<
|
1011
|
-
<span class="ruby-
|
1012
|
-
def self.validate_storage_params(job_data)
|
1013
|
-
job_data[<span class="ruby-string">"@storage"</span>] ||= <span class="ruby-string">"appdb"</span>
|
950
|
+
<div class="method-source-code" id="validate_storage_params-source">
|
951
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 366</span>
|
952
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">validate_storage_params</span>(<span class="ruby-identifier">job_data</span>)
|
953
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@storage"</span>] <span class="ruby-operator">||=</span> <span class="ruby-string">"appdb"</span>
|
1014
954
|
|
1015
|
-
storage = job_data[<span class="ruby-string">"@storage"</span>]
|
1016
|
-
if
|
1017
|
-
raise <span class="ruby-constant">BadConfigurationException</span
|
1018
|
-
|
1019
|
-
end
|
955
|
+
<span class="ruby-identifier">storage</span> = <span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@storage"</span>]
|
956
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">ALLOWED_STORAGE_TYPES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">storage</span>)
|
957
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">"Supported storage types are "</span> <span class="ruby-operator">+</span>
|
958
|
+
<span class="ruby-node">"#{ALLOWED_STORAGE_TYPES.join(', ')} - #{storage} is not supported."</span>)
|
959
|
+
<span class="ruby-keyword">end</span>
|
1020
960
|
|
1021
961
|
<span class="ruby-comment"># Our implementation for storing / retrieving via Google Storage</span>
|
1022
962
|
<span class="ruby-comment"># and Walrus uses</span>
|
1023
963
|
<span class="ruby-comment"># the same library as we do for S3 - so just tell it that it's S3</span>
|
1024
|
-
if storage
|
1025
|
-
storage = <span class="ruby-string">"s3"</span>
|
1026
|
-
job_data[<span class="ruby-string">"@storage"</span>] = <span class="ruby-string">"s3"</span>
|
1027
|
-
end
|
1028
|
-
|
1029
|
-
if storage
|
1030
|
-
[<span class="ruby-string">"EC2_ACCESS_KEY"</span>, <span class="ruby-string">"EC2_SECRET_KEY"</span>, <span class="ruby-string">"S3_URL"</span>]
|
1031
|
-
if job_data[
|
964
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">storage</span> <span class="ruby-operator">==</span> <span class="ruby-string">"gstorage"</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">storage</span> <span class="ruby-operator">==</span> <span class="ruby-string">"walrus"</span>
|
965
|
+
<span class="ruby-identifier">storage</span> = <span class="ruby-string">"s3"</span>
|
966
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-string">"@storage"</span>] = <span class="ruby-string">"s3"</span>
|
967
|
+
<span class="ruby-keyword">end</span>
|
968
|
+
|
969
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">storage</span> <span class="ruby-operator">==</span> <span class="ruby-string">"s3"</span>
|
970
|
+
[<span class="ruby-string">"EC2_ACCESS_KEY"</span>, <span class="ruby-string">"EC2_SECRET_KEY"</span>, <span class="ruby-string">"S3_URL"</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
|
971
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">job_data</span>[<span class="ruby-node">"@#{item}"</span>]
|
1032
972
|
<span class="ruby-comment"># Kernel.puts "Using specified #{item}"</span>
|
1033
|
-
else
|
1034
|
-
if <span class="ruby-constant">ENV</span>[item]
|
973
|
+
<span class="ruby-keyword">else</span>
|
974
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">ENV</span>[<span class="ruby-identifier">item</span>]
|
1035
975
|
<span class="ruby-comment"># Kernel.puts "Using #{item} from environment"</span>
|
1036
|
-
job_data[
|
1037
|
-
else
|
1038
|
-
raise <span class="ruby-constant">BadConfigurationException</span
|
976
|
+
<span class="ruby-identifier">job_data</span>[<span class="ruby-node">"@#{item}"</span>] = <span class="ruby-constant">ENV</span>[<span class="ruby-identifier">item</span>]
|
977
|
+
<span class="ruby-keyword">else</span>
|
978
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"When storing data to S3, #{item} must be specified or be in "</span> <span class="ruby-operator">+</span>
|
1039
979
|
<span class="ruby-string">"your environment. Please do so and try again."</span>)
|
1040
|
-
end
|
1041
|
-
end
|
980
|
+
<span class="ruby-keyword">end</span>
|
981
|
+
<span class="ruby-keyword">end</span>
|
1042
982
|
}
|
1043
|
-
end
|
983
|
+
<span class="ruby-keyword">end</span>
|
1044
984
|
|
1045
|
-
return job_data
|
1046
|
-
end</pre>
|
1047
|
-
</div
|
985
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">job_data</span>
|
986
|
+
<span class="ruby-keyword">end</span></pre>
|
987
|
+
</div><!-- validate_storage_params-source -->
|
1048
988
|
|
1049
989
|
</div>
|
1050
990
|
|
1051
991
|
|
1052
992
|
|
1053
993
|
|
1054
|
-
</div
|
994
|
+
</div><!-- validate_storage_params-method -->
|
1055
995
|
|
1056
996
|
|
1057
|
-
<div id="wait_for_compilation_to_finish
|
1058
|
-
<a name="method-c-wait_for_compilation_to_finish"></a>
|
1059
|
-
|
997
|
+
<div id="method-c-wait_for_compilation_to_finish" class="method-detail ">
|
1060
998
|
|
1061
999
|
<div class="method-heading">
|
1062
1000
|
<span class="method-name">wait_for_compilation_to_finish</span><span
|
@@ -1073,46 +1011,43 @@ location.</p>
|
|
1073
1011
|
|
1074
1012
|
|
1075
1013
|
|
1076
|
-
<div class="method-source-code"
|
1077
|
-
|
1078
|
-
<
|
1079
|
-
<span class="ruby-
|
1080
|
-
|
1081
|
-
loop {
|
1082
|
-
ssh_command = "ssh #{ssh_args} root@#{shadow_ip} 'ls #{compiled_location}' 2>&1"
|
1014
|
+
<div class="method-source-code" id="wait_for_compilation_to_finish-source">
|
1015
|
+
<pre><span class="ruby-comment"># File lib/neptune.rb, line 437</span>
|
1016
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">wait_for_compilation_to_finish</span>(<span class="ruby-identifier">ssh_args</span>, <span class="ruby-identifier">shadow_ip</span>, <span class="ruby-identifier">compiled_location</span>)
|
1017
|
+
<span class="ruby-identifier">loop</span> {
|
1018
|
+
<span class="ruby-identifier">ssh_command</span> = <span class="ruby-node">"ssh #{ssh_args} root@#{shadow_ip} 'ls #{compiled_location}' 2>&1"</span>
|
1083
1019
|
<span class="ruby-comment"># Kernel.puts ssh_command</span>
|
1084
|
-
ssh_result = <span class="ruby-constant">CommonFunctions</span
|
1020
|
+
<span class="ruby-identifier">ssh_result</span> = <span class="ruby-constant">CommonFunctions</span>.<span class="ruby-identifier">shell</span>(<span class="ruby-identifier">ssh_command</span>)
|
1085
1021
|
<span class="ruby-comment"># Kernel.puts "result was [#{ssh_result}]"</span>
|
1086
|
-
if ssh_result
|
1022
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">ssh_result</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%rNo such file or directory/</span>
|
1087
1023
|
<span class="ruby-comment"># Kernel.puts "Still waiting for code to be compiled..."</span>
|
1088
|
-
else
|
1024
|
+
<span class="ruby-keyword">else</span>
|
1089
1025
|
<span class="ruby-comment"># Kernel.puts "compilation complete! Copying compiled code to #{copy_to}"</span>
|
1090
|
-
return
|
1091
|
-
end
|
1092
|
-
sleep(5)
|
1026
|
+
<span class="ruby-keyword">return</span>
|
1027
|
+
<span class="ruby-keyword">end</span>
|
1028
|
+
<span class="ruby-identifier">sleep</span>(<span class="ruby-value">5</span>)
|
1093
1029
|
}
|
1094
|
-
end</pre>
|
1095
|
-
</div
|
1030
|
+
<span class="ruby-keyword">end</span></pre>
|
1031
|
+
</div><!-- wait_for_compilation_to_finish-source -->
|
1096
1032
|
|
1097
1033
|
</div>
|
1098
1034
|
|
1099
1035
|
|
1100
1036
|
|
1101
1037
|
|
1102
|
-
</div
|
1038
|
+
</div><!-- wait_for_compilation_to_finish-method -->
|
1103
1039
|
|
1104
1040
|
|
1105
|
-
</
|
1041
|
+
</section><!-- public-class-method-details -->
|
1106
1042
|
|
1043
|
+
</section><!-- 5Buntitled-5D -->
|
1107
1044
|
|
1108
|
-
|
1045
|
+
</div><!-- documentation -->
|
1109
1046
|
|
1110
|
-
<div id="validator-badges">
|
1111
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
1112
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
1113
|
-
Rdoc Generator</a> 2</small>.</p>
|
1114
|
-
</div>
|
1115
1047
|
|
1116
|
-
|
1117
|
-
</
|
1048
|
+
<footer id="validator-badges">
|
1049
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
1050
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
1051
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
1052
|
+
</footer>
|
1118
1053
|
|