neptune 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/README +4 -0
  2. data/doc/BabelHelper.html +393 -376
  3. data/doc/BadConfigurationException.html +121 -127
  4. data/doc/CommonFunctions.html +237 -265
  5. data/doc/ExodusHelper.html +820 -0
  6. data/doc/ExodusTaskInfo.html +263 -0
  7. data/doc/FileNotFoundException.html +121 -127
  8. data/doc/NeptuneHelper.html +527 -592
  9. data/doc/NeptuneManagerClient.html +696 -0
  10. data/doc/NeptuneManagerException.html +139 -0
  11. data/doc/Object.html +334 -236
  12. data/doc/TaskInfo.html +428 -0
  13. data/doc/created.rid +8 -5
  14. data/doc/images/add.png +0 -0
  15. data/doc/images/delete.png +0 -0
  16. data/doc/images/tag_blue.png +0 -0
  17. data/doc/images/transparent.png +0 -0
  18. data/doc/index.html +74 -142
  19. data/doc/js/darkfish.js +99 -62
  20. data/doc/js/jquery.js +15 -29
  21. data/doc/js/navigation.js +142 -0
  22. data/doc/js/search.js +94 -0
  23. data/doc/js/search_index.js +1 -0
  24. data/doc/js/searcher.js +228 -0
  25. data/doc/table_of_contents.html +226 -0
  26. data/lib/babel.rb +116 -50
  27. data/lib/custom_exceptions.rb +2 -2
  28. data/lib/exodus.rb +311 -0
  29. data/lib/exodus_task_info.rb +36 -0
  30. data/lib/neptune.rb +52 -18
  31. data/lib/{app_controller_client.rb → neptune_manager_client.rb} +54 -38
  32. data/lib/task_info.rb +155 -0
  33. data/test/{unit/test_babel.rb → test_babel.rb} +161 -26
  34. data/test/{unit/test_common_functions.rb → test_common_functions.rb} +1 -1
  35. data/test/test_exodus.rb +687 -0
  36. data/test/{unit/test_neptune.rb → test_neptune.rb} +28 -17
  37. data/test/{unit/test_app_controller_client.rb → test_neptune_manager_client.rb} +15 -16
  38. data/test/test_task_info.rb +32 -0
  39. data/test/{unit/ts_all.rb → ts_all.rb} +3 -1
  40. metadata +30 -34
  41. data/doc/AppControllerClient.html +0 -702
  42. data/doc/AppControllerException.html +0 -145
  43. data/doc/bin/neptune.html +0 -56
  44. data/doc/js/quicksearch.js +0 -114
  45. data/doc/js/thickbox-compressed.js +0 -10
  46. data/doc/lib/app_controller_client_rb.html +0 -60
  47. data/doc/lib/babel_rb.html +0 -68
  48. data/doc/lib/common_functions_rb.html +0 -70
  49. data/doc/lib/custom_exceptions_rb.html +0 -54
  50. data/doc/lib/neptune_rb.html +0 -60
  51. data/test/integration/tc_c.rb +0 -57
  52. data/test/integration/tc_dfsp.rb +0 -37
  53. data/test/integration/tc_dwssa.rb +0 -38
  54. data/test/integration/tc_erlang.rb +0 -183
  55. data/test/integration/tc_mapreduce.rb +0 -282
  56. data/test/integration/tc_mpi.rb +0 -160
  57. data/test/integration/tc_storage.rb +0 -209
  58. data/test/integration/tc_upc.rb +0 -75
  59. data/test/integration/tc_x10.rb +0 -94
  60. data/test/integration/test_helper.rb +0 -135
  61. data/test/integration/ts_neptune.rb +0 -40
@@ -0,0 +1,820 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>module ExodusHelper - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
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>
21
+
22
+
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>
32
+
33
+
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>
44
+
45
+
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/exodus.rb
51
+ </ul>
52
+ </nav>
53
+
54
+
55
+ </div>
56
+
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>
64
+
65
+ <ul class="link-list">
66
+
67
+ <li><a href="#method-c-average">::average</a>
68
+
69
+ <li><a href="#method-c-convert_clouds_to_use_to_array">::convert_clouds_to_use_to_array</a>
70
+
71
+ <li><a href="#method-c-ensure_all_jobs_are_hashes">::ensure_all_jobs_are_hashes</a>
72
+
73
+ <li><a href="#method-c-ensure_all_params_are_present">::ensure_all_params_are_present</a>
74
+
75
+ <li><a href="#method-c-ensure_credentials_are_in_correct_format">::ensure_credentials_are_in_correct_format</a>
76
+
77
+ <li><a href="#method-c-find_optimal_cloud_for_task">::find_optimal_cloud_for_task</a>
78
+
79
+ <li><a href="#method-c-generate_babel_tasks">::generate_babel_tasks</a>
80
+
81
+ <li><a href="#method-c-get_clouds_to_run_task_on">::get_clouds_to_run_task_on</a>
82
+
83
+ <li><a href="#method-c-get_key_from_job_data">::get_key_from_job_data</a>
84
+
85
+ <li><a href="#method-c-get_minimum_val_in_data">::get_minimum_val_in_data</a>
86
+
87
+ <li><a href="#method-c-get_profiling_info">::get_profiling_info</a>
88
+
89
+ <li><a href="#method-c-propogate_credentials_from_environment">::propogate_credentials_from_environment</a>
90
+
91
+ <li><a href="#method-c-run_job">::run_job</a>
92
+
93
+ <li><a href="#method-c-validate_clouds_to_use">::validate_clouds_to_use</a>
94
+
95
+ <li><a href="#method-c-validate_files_argv_executable">::validate_files_argv_executable</a>
96
+
97
+ <li><a href="#method-c-validate_optimize_for_param">::validate_optimize_for_param</a>
98
+
99
+ </ul>
100
+ </nav>
101
+
102
+ </div>
103
+
104
+ <div id="project-metadata">
105
+
106
+ <nav id="classindex-section" class="section project-section">
107
+ <h3 class="section-header">Class and Module Index</h3>
108
+
109
+ <ul class="link-list">
110
+
111
+ <li><a href="./BabelHelper.html">BabelHelper</a>
112
+
113
+ <li><a href="./BadConfigurationException.html">BadConfigurationException</a>
114
+
115
+ <li><a href="./CommonFunctions.html">CommonFunctions</a>
116
+
117
+ <li><a href="./ExodusHelper.html">ExodusHelper</a>
118
+
119
+ <li><a href="./ExodusTaskInfo.html">ExodusTaskInfo</a>
120
+
121
+ <li><a href="./FileNotFoundException.html">FileNotFoundException</a>
122
+
123
+ <li><a href="./NeptuneHelper.html">NeptuneHelper</a>
124
+
125
+ <li><a href="./NeptuneManagerClient.html">NeptuneManagerClient</a>
126
+
127
+ <li><a href="./NeptuneManagerException.html">NeptuneManagerException</a>
128
+
129
+ <li><a href="./Object.html">Object</a>
130
+
131
+ <li><a href="./TaskInfo.html">TaskInfo</a>
132
+
133
+ </ul>
134
+ </nav>
135
+
136
+ </div>
137
+ </nav>
138
+
139
+ <div id="documentation">
140
+ <h1 class="module">module ExodusHelper</h1>
141
+
142
+ <div id="description" class="description">
143
+
144
+ <p>This module provides convenience functions for exodus(), to avoid
145
+ cluttering up <a href="Object.html">Object</a> or Kernel’s namespace.</p>
146
+
147
+ </div><!-- description -->
148
+
149
+
150
+
151
+
152
+ <section id="5Buntitled-5D" class="documentation-section">
153
+
154
+
155
+
156
+
157
+
158
+ <!-- Constants -->
159
+ <section id="constants-list" class="section">
160
+ <h3 class="section-header">Constants</h3>
161
+ <dl>
162
+
163
+ <dt id="CLOUD_BABEL_PARAMS">CLOUD_BABEL_PARAMS
164
+
165
+ <dd class="description">
166
+
167
+
168
+ <dt id="CLOUD_CREDENTIALS">CLOUD_CREDENTIALS
169
+
170
+ <dd class="description">
171
+
172
+
173
+ <dt id="OPTIMIZE_FOR_CHOICES">OPTIMIZE_FOR_CHOICES
174
+
175
+ <dd class="description">
176
+
177
+
178
+ <dt id="SUPPORTED_CLOUDS">SUPPORTED_CLOUDS
179
+
180
+ <dd class="description"><p>A list of clouds that users can run tasks on via Exodus.</p>
181
+
182
+
183
+ </dl>
184
+ </section>
185
+
186
+
187
+
188
+
189
+ <!-- Methods -->
190
+
191
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
192
+ <h3 class="section-header">Public Class Methods</h3>
193
+
194
+
195
+ <div id="method-c-average" class="method-detail ">
196
+
197
+ <div class="method-heading">
198
+ <span class="method-name">average</span><span
199
+ class="method-args">(vals)</span>
200
+ <span class="method-click-advice">click to toggle source</span>
201
+ </div>
202
+
203
+
204
+ <div class="method-description">
205
+
206
+ <p>Given an Array of values, calculates and returns their average.</p>
207
+
208
+
209
+
210
+ <div class="method-source-code" id="average-source">
211
+ <pre><span class="ruby-comment"># File lib/exodus.rb, line 268</span>
212
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">average</span>(<span class="ruby-identifier">vals</span>)
213
+ <span class="ruby-identifier">sum</span> = <span class="ruby-identifier">vals</span>.<span class="ruby-identifier">reduce</span>(<span class="ruby-value">0.0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">running_total</span>, <span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
214
+ <span class="ruby-identifier">running_total</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">val</span>
215
+ }
216
+
217
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">sum</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">vals</span>.<span class="ruby-identifier">length</span>
218
+ <span class="ruby-keyword">end</span></pre>
219
+ </div><!-- average-source -->
220
+
221
+ </div>
222
+
223
+
224
+
225
+
226
+ </div><!-- average-method -->
227
+
228
+
229
+ <div id="method-c-convert_clouds_to_use_to_array" class="method-detail ">
230
+
231
+ <div class="method-heading">
232
+ <span class="method-name">convert_clouds_to_use_to_array</span><span
233
+ class="method-args">(job)</span>
234
+ <span class="method-click-advice">click to toggle source</span>
235
+ </div>
236
+
237
+
238
+ <div class="method-description">
239
+
240
+ <p>Given a single Exodus job, checks to make sure it has either an Array of
241
+ Strings or a single String listing the clouds that a given task can run on.
242
+ Raises a <a
243
+ href="BadConfigurationException.html">BadConfigurationException</a> if
244
+ :clouds_to_use is not in the right format.</p>
245
+
246
+
247
+
248
+ <div class="method-source-code" id="convert_clouds_to_use_to_array-source">
249
+ <pre><span class="ruby-comment"># File lib/exodus.rb, line 123</span>
250
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">convert_clouds_to_use_to_array</span>(<span class="ruby-identifier">job</span>)
251
+ <span class="ruby-identifier">clouds_class</span> = <span class="ruby-identifier">job</span>[<span class="ruby-value">:clouds_to_use</span>].<span class="ruby-identifier">class</span>
252
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">clouds_class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Symbol</span>
253
+ <span class="ruby-identifier">job</span>[<span class="ruby-value">:clouds_to_use</span>] = [<span class="ruby-identifier">job</span>[<span class="ruby-value">:clouds_to_use</span>]]
254
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">clouds_class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span>
255
+ <span class="ruby-identifier">job</span>[<span class="ruby-value">:clouds_to_use</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">cloud</span><span class="ruby-operator">|</span>
256
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">cloud</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Symbol</span>
257
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{cloud} was not a String, &quot;</span> <span class="ruby-operator">+</span>
258
+ <span class="ruby-node">&quot;but was a #{cloud.class}&quot;</span>)
259
+ <span class="ruby-keyword">end</span>
260
+ }
261
+ <span class="ruby-keyword">else</span>
262
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{job[:clouds_to_use]} was not &quot;</span> <span class="ruby-operator">+</span>
263
+ <span class="ruby-node">&quot;a String or Array, but was a #{clouds_class}&quot;</span>)
264
+ <span class="ruby-keyword">end</span>
265
+ <span class="ruby-keyword">end</span></pre>
266
+ </div><!-- convert_clouds_to_use_to_array-source -->
267
+
268
+ </div>
269
+
270
+
271
+
272
+
273
+ </div><!-- convert_clouds_to_use_to_array-method -->
274
+
275
+
276
+ <div id="method-c-ensure_all_jobs_are_hashes" class="method-detail ">
277
+
278
+ <div class="method-heading">
279
+ <span class="method-name">ensure_all_jobs_are_hashes</span><span
280
+ class="method-args">(jobs)</span>
281
+ <span class="method-click-advice">click to toggle source</span>
282
+ </div>
283
+
284
+
285
+ <div class="method-description">
286
+
287
+ <p>Given an Array of jobs to run, ensures that they are all Hashes, the
288
+ standard format for Neptune jobs.</p>
289
+
290
+
291
+
292
+ <div class="method-source-code" id="ensure_all_jobs_are_hashes-source">
293
+ <pre><span class="ruby-comment"># File lib/exodus.rb, line 95</span>
294
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">ensure_all_jobs_are_hashes</span>(<span class="ruby-identifier">jobs</span>)
295
+ <span class="ruby-identifier">jobs</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">job</span><span class="ruby-operator">|</span>
296
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">job</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Hash</span>
297
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;A job passed to exodus() was &quot;</span> <span class="ruby-operator">+</span>
298
+ <span class="ruby-node">&quot;not a Hash, but was a #{job.class}&quot;</span>)
299
+ <span class="ruby-keyword">end</span>
300
+ }
301
+ <span class="ruby-keyword">end</span></pre>
302
+ </div><!-- ensure_all_jobs_are_hashes-source -->
303
+
304
+ </div>
305
+
306
+
307
+
308
+
309
+ </div><!-- ensure_all_jobs_are_hashes-method -->
310
+
311
+
312
+ <div id="method-c-ensure_all_params_are_present" class="method-detail ">
313
+
314
+ <div class="method-heading">
315
+ <span class="method-name">ensure_all_params_are_present</span><span
316
+ class="method-args">(job)</span>
317
+ <span class="method-click-advice">click to toggle source</span>
318
+ </div>
319
+
320
+
321
+ <div class="method-description">
322
+
323
+ <p>Given an Exodus job, validates its parameters, raising a <a
324
+ href="BadConfigurationException.html">BadConfigurationException</a> for any
325
+ missing params.</p>
326
+
327
+
328
+
329
+ <div class="method-source-code" id="ensure_all_params_are_present-source">
330
+ <pre><span class="ruby-comment"># File lib/exodus.rb, line 107</span>
331
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">ensure_all_params_are_present</span>(<span class="ruby-identifier">job</span>)
332
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">job</span>[<span class="ruby-value">:clouds_to_use</span>].<span class="ruby-identifier">nil?</span>
333
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;:clouds_to_use was not specified&quot;</span>)
334
+ <span class="ruby-keyword">else</span>
335
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">convert_clouds_to_use_to_array</span>(<span class="ruby-identifier">job</span>)
336
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">validate_clouds_to_use</span>(<span class="ruby-identifier">job</span>)
337
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">validate_optimize_for_param</span>(<span class="ruby-identifier">job</span>)
338
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">validate_files_argv_executable</span>(<span class="ruby-identifier">job</span>)
339
+ <span class="ruby-keyword">end</span>
340
+ <span class="ruby-keyword">end</span></pre>
341
+ </div><!-- ensure_all_params_are_present-source -->
342
+
343
+ </div>
344
+
345
+
346
+
347
+
348
+ </div><!-- ensure_all_params_are_present-method -->
349
+
350
+
351
+ <div id="method-c-ensure_credentials_are_in_correct_format" class="method-detail ">
352
+
353
+ <div class="method-heading">
354
+ <span class="method-name">ensure_credentials_are_in_correct_format</span><span
355
+ class="method-args">(job)</span>
356
+ <span class="method-click-advice">click to toggle source</span>
357
+ </div>
358
+
359
+
360
+ <div class="method-description">
361
+
362
+
363
+
364
+
365
+
366
+ <div class="method-source-code" id="ensure_credentials_are_in_correct_format-source">
367
+ <pre><span class="ruby-comment"># File lib/exodus.rb, line 165</span>
368
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">ensure_credentials_are_in_correct_format</span>(<span class="ruby-identifier">job</span>)
369
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">job</span>[<span class="ruby-value">:credentials</span>].<span class="ruby-identifier">nil?</span>
370
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;No credentials were specified.&quot;</span>)
371
+ <span class="ruby-keyword">end</span>
372
+
373
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">job</span>[<span class="ruby-value">:credentials</span>].<span class="ruby-identifier">class</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Hash</span>
374
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;Credentials given were not a &quot;</span> <span class="ruby-operator">+</span>
375
+ <span class="ruby-node">&quot;Hash, but were a #{job[:credentials].class}&quot;</span>)
376
+ <span class="ruby-keyword">end</span>
377
+ <span class="ruby-keyword">end</span></pre>
378
+ </div><!-- ensure_credentials_are_in_correct_format-source -->
379
+
380
+ </div>
381
+
382
+
383
+
384
+
385
+ </div><!-- ensure_credentials_are_in_correct_format-method -->
386
+
387
+
388
+ <div id="method-c-find_optimal_cloud_for_task" class="method-detail ">
389
+
390
+ <div class="method-heading">
391
+ <span class="method-name">find_optimal_cloud_for_task</span><span
392
+ class="method-args">(job, profiling_info)</span>
393
+ <span class="method-click-advice">click to toggle source</span>
394
+ </div>
395
+
396
+
397
+ <div class="method-description">
398
+
399
+
400
+
401
+
402
+
403
+ <div class="method-source-code" id="find_optimal_cloud_for_task-source">
404
+ <pre><span class="ruby-comment"># File lib/exodus.rb, line 277</span>
405
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">find_optimal_cloud_for_task</span>(<span class="ruby-identifier">job</span>, <span class="ruby-identifier">profiling_info</span>)
406
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>
407
+ <span class="ruby-keyword">end</span></pre>
408
+ </div><!-- find_optimal_cloud_for_task-source -->
409
+
410
+ </div>
411
+
412
+
413
+
414
+
415
+ </div><!-- find_optimal_cloud_for_task-method -->
416
+
417
+
418
+ <div id="method-c-generate_babel_tasks" class="method-detail ">
419
+
420
+ <div class="method-heading">
421
+ <span class="method-name">generate_babel_tasks</span><span
422
+ class="method-args">(job, clouds_to_run_task_on)</span>
423
+ <span class="method-click-advice">click to toggle source</span>
424
+ </div>
425
+
426
+
427
+ <div class="method-description">
428
+
429
+
430
+
431
+
432
+
433
+ <div class="method-source-code" id="generate_babel_tasks-source">
434
+ <pre><span class="ruby-comment"># File lib/exodus.rb, line 282</span>
435
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">generate_babel_tasks</span>(<span class="ruby-identifier">job</span>, <span class="ruby-identifier">clouds_to_run_task_on</span>)
436
+ <span class="ruby-identifier">tasks</span> = []
437
+
438
+ <span class="ruby-identifier">clouds_to_run_task_on</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">cloud</span><span class="ruby-operator">|</span>
439
+ <span class="ruby-identifier">task</span> = { <span class="ruby-value">:type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;babel&quot;</span>,
440
+ <span class="ruby-value">:code</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">job</span>[<span class="ruby-value">:code</span>],
441
+ <span class="ruby-value">:argv</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">job</span>[<span class="ruby-value">:argv</span>],
442
+ <span class="ruby-value">:executable</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">job</span>[<span class="ruby-value">:executable</span>],
443
+ <span class="ruby-value">:is_remote</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">false</span>,
444
+ <span class="ruby-value">:run_local</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">false</span>
445
+ }
446
+
447
+ <span class="ruby-constant">CLOUD_CREDENTIALS</span>[<span class="ruby-identifier">cloud</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">credential</span><span class="ruby-operator">|</span>
448
+ <span class="ruby-identifier">task</span>[<span class="ruby-identifier">credential</span>] = <span class="ruby-identifier">job</span>[<span class="ruby-value">:credentials</span>][<span class="ruby-identifier">credential</span>]
449
+ }
450
+
451
+ <span class="ruby-identifier">task</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-constant">CLOUD_BABEL_PARAMS</span>[<span class="ruby-identifier">cloud</span>])
452
+ <span class="ruby-identifier">tasks</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">task</span>
453
+ }
454
+
455
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">tasks</span>
456
+ <span class="ruby-keyword">end</span></pre>
457
+ </div><!-- generate_babel_tasks-source -->
458
+
459
+ </div>
460
+
461
+
462
+
463
+
464
+ </div><!-- generate_babel_tasks-method -->
465
+
466
+
467
+ <div id="method-c-get_clouds_to_run_task_on" class="method-detail ">
468
+
469
+ <div class="method-heading">
470
+ <span class="method-name">get_clouds_to_run_task_on</span><span
471
+ class="method-args">(job, profiling_info)</span>
472
+ <span class="method-click-advice">click to toggle source</span>
473
+ </div>
474
+
475
+
476
+ <div class="method-description">
477
+
478
+
479
+
480
+
481
+
482
+ <div class="method-source-code" id="get_clouds_to_run_task_on-source">
483
+ <pre><span class="ruby-comment"># File lib/exodus.rb, line 227</span>
484
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_clouds_to_run_task_on</span>(<span class="ruby-identifier">job</span>, <span class="ruby-identifier">profiling_info</span>)
485
+ <span class="ruby-identifier">optimize_for</span> = <span class="ruby-identifier">job</span>[<span class="ruby-value">:optimize_for</span>]
486
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">optimize_for</span> <span class="ruby-operator">==</span> <span class="ruby-value">:performance</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">optimize_for</span> <span class="ruby-operator">==</span> <span class="ruby-value">:cost</span>
487
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_minimum_val_in_data</span>(<span class="ruby-identifier">job</span>, <span class="ruby-identifier">profiling_info</span>)
488
+ <span class="ruby-keyword">else</span>
489
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">find_optimal_cloud_for_task</span>(<span class="ruby-identifier">job</span>, <span class="ruby-identifier">profiling_info</span>)
490
+ <span class="ruby-keyword">end</span>
491
+ <span class="ruby-keyword">end</span></pre>
492
+ </div><!-- get_clouds_to_run_task_on-source -->
493
+
494
+ </div>
495
+
496
+
497
+
498
+
499
+ </div><!-- get_clouds_to_run_task_on-method -->
500
+
501
+
502
+ <div id="method-c-get_key_from_job_data" class="method-detail ">
503
+
504
+ <div class="method-heading">
505
+ <span class="method-name">get_key_from_job_data</span><span
506
+ class="method-args">(job)</span>
507
+ <span class="method-click-advice">click to toggle source</span>
508
+ </div>
509
+
510
+
511
+ <div class="method-description">
512
+
513
+ <p>TODO(cgb): what is a job’s key?</p>
514
+
515
+
516
+
517
+ <div class="method-source-code" id="get_key_from_job_data-source">
518
+ <pre><span class="ruby-comment"># File lib/exodus.rb, line 222</span>
519
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_key_from_job_data</span>(<span class="ruby-identifier">job</span>)
520
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">job</span>[<span class="ruby-value">:code</span>]
521
+ <span class="ruby-keyword">end</span></pre>
522
+ </div><!-- get_key_from_job_data-source -->
523
+
524
+ </div>
525
+
526
+
527
+
528
+
529
+ </div><!-- get_key_from_job_data-method -->
530
+
531
+
532
+ <div id="method-c-get_minimum_val_in_data" class="method-detail ">
533
+
534
+ <div class="method-heading">
535
+ <span class="method-name">get_minimum_val_in_data</span><span
536
+ class="method-args">(job, profiling_info)</span>
537
+ <span class="method-click-advice">click to toggle source</span>
538
+ </div>
539
+
540
+
541
+ <div class="method-description">
542
+
543
+
544
+
545
+
546
+
547
+ <div class="method-source-code" id="get_minimum_val_in_data-source">
548
+ <pre><span class="ruby-comment"># File lib/exodus.rb, line 237</span>
549
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_minimum_val_in_data</span>(<span class="ruby-identifier">job</span>, <span class="ruby-identifier">profiling_info</span>)
550
+ <span class="ruby-identifier">min_cloud</span> = <span class="ruby-keyword">nil</span>
551
+ <span class="ruby-identifier">min_val</span> = <span class="ruby-value">1_000_000</span> <span class="ruby-comment"># infinity</span>
552
+ <span class="ruby-identifier">optimize_for</span> = <span class="ruby-identifier">job</span>[<span class="ruby-value">:optimize_for</span>].<span class="ruby-identifier">to_s</span>
553
+
554
+ <span class="ruby-identifier">clouds_to_run_on</span> = []
555
+ <span class="ruby-identifier">job</span>[<span class="ruby-value">:clouds_to_use</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">cloud</span><span class="ruby-operator">|</span>
556
+ <span class="ruby-comment"># If we have no information on this cloud, then add it to the list</span>
557
+ <span class="ruby-comment"># of clouds we should run the task on, since it could potentially be</span>
558
+ <span class="ruby-comment"># lower than the minimum in the data we've seen so far.</span>
559
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">profiling_info</span>[<span class="ruby-identifier">cloud</span>.<span class="ruby-identifier">to_s</span>].<span class="ruby-identifier">nil?</span>
560
+ <span class="ruby-identifier">clouds_to_run_on</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">cloud</span>
561
+ <span class="ruby-keyword">next</span>
562
+ <span class="ruby-keyword">end</span>
563
+
564
+ <span class="ruby-identifier">val</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">average</span>(<span class="ruby-identifier">profiling_info</span>[<span class="ruby-identifier">cloud</span>.<span class="ruby-identifier">to_s</span>][<span class="ruby-identifier">optimize_for</span>])
565
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">val</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">min_val</span>
566
+ <span class="ruby-identifier">min_cloud</span> = <span class="ruby-identifier">cloud</span>
567
+ <span class="ruby-identifier">min_val</span> = <span class="ruby-identifier">val</span>
568
+ <span class="ruby-keyword">end</span>
569
+ }
570
+
571
+ <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">min_cloud</span>.<span class="ruby-identifier">nil?</span>
572
+ <span class="ruby-identifier">clouds_to_run_on</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">min_cloud</span>
573
+ <span class="ruby-keyword">end</span>
574
+
575
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">clouds_to_run_on</span>
576
+ <span class="ruby-keyword">end</span></pre>
577
+ </div><!-- get_minimum_val_in_data-source -->
578
+
579
+ </div>
580
+
581
+
582
+
583
+
584
+ </div><!-- get_minimum_val_in_data-method -->
585
+
586
+
587
+ <div id="method-c-get_profiling_info" class="method-detail ">
588
+
589
+ <div class="method-heading">
590
+ <span class="method-name">get_profiling_info</span><span
591
+ class="method-args">(job)</span>
592
+ <span class="method-click-advice">click to toggle source</span>
593
+ </div>
594
+
595
+
596
+ <div class="method-description">
597
+
598
+
599
+
600
+
601
+
602
+ <div class="method-source-code" id="get_profiling_info-source">
603
+ <pre><span class="ruby-comment"># File lib/exodus.rb, line 214</span>
604
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_profiling_info</span>(<span class="ruby-identifier">job</span>)
605
+ <span class="ruby-identifier">key</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_key_from_job_data</span>(<span class="ruby-identifier">job</span>)
606
+ <span class="ruby-identifier">neptune_manager</span> = <span class="ruby-constant">BabelHelper</span>.<span class="ruby-identifier">get_neptune_manager_client</span>(<span class="ruby-identifier">job</span>)
607
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">neptune_manager</span>.<span class="ruby-identifier">get_profiling_info</span>(<span class="ruby-identifier">key</span>)
608
+ <span class="ruby-keyword">end</span></pre>
609
+ </div><!-- get_profiling_info-source -->
610
+
611
+ </div>
612
+
613
+
614
+
615
+
616
+ </div><!-- get_profiling_info-method -->
617
+
618
+
619
+ <div id="method-c-propogate_credentials_from_environment" class="method-detail ">
620
+
621
+ <div class="method-heading">
622
+ <span class="method-name">propogate_credentials_from_environment</span><span
623
+ class="method-args">(job)</span>
624
+ <span class="method-click-advice">click to toggle source</span>
625
+ </div>
626
+
627
+
628
+ <div class="method-description">
629
+
630
+ <p>Searches the caller’s environment variables, and adds any that could be
631
+ used in this Exodus job. Only takes in credentials from the environment if
632
+ the job does not specify it.</p>
633
+
634
+
635
+
636
+ <div class="method-source-code" id="propogate_credentials_from_environment-source">
637
+ <pre><span class="ruby-comment"># File lib/exodus.rb, line 180</span>
638
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">propogate_credentials_from_environment</span>(<span class="ruby-identifier">job</span>)
639
+ <span class="ruby-constant">CLOUD_CREDENTIALS</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">cloud_name</span>, <span class="ruby-identifier">credential_list</span><span class="ruby-operator">|</span>
640
+ <span class="ruby-identifier">credential_list</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">cred</span><span class="ruby-operator">|</span>
641
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">job</span>[<span class="ruby-value">:credentials</span>][<span class="ruby-identifier">cred</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-keyword">and</span> <span class="ruby-operator">!</span><span class="ruby-constant">ENV</span>[<span class="ruby-identifier">cred</span>.<span class="ruby-identifier">to_s</span>].<span class="ruby-identifier">nil?</span>
642
+ <span class="ruby-identifier">job</span>[<span class="ruby-value">:credentials</span>][<span class="ruby-identifier">cred</span>] = <span class="ruby-constant">ENV</span>[<span class="ruby-identifier">cred</span>.<span class="ruby-identifier">to_s</span>]
643
+ <span class="ruby-keyword">end</span>
644
+ }
645
+ }
646
+ <span class="ruby-keyword">end</span></pre>
647
+ </div><!-- propogate_credentials_from_environment-source -->
648
+
649
+ </div>
650
+
651
+
652
+
653
+
654
+ </div><!-- propogate_credentials_from_environment-method -->
655
+
656
+
657
+ <div id="method-c-run_job" class="method-detail ">
658
+
659
+ <div class="method-heading">
660
+ <span class="method-name">run_job</span><span
661
+ class="method-args">(tasks_to_run)</span>
662
+ <span class="method-click-advice">click to toggle source</span>
663
+ </div>
664
+
665
+
666
+ <div class="method-description">
667
+
668
+
669
+
670
+
671
+
672
+ <div class="method-source-code" id="run_job-source">
673
+ <pre><span class="ruby-comment"># File lib/exodus.rb, line 306</span>
674
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">run_job</span>(<span class="ruby-identifier">tasks_to_run</span>)
675
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">babel</span>(<span class="ruby-identifier">tasks_to_run</span>)
676
+ <span class="ruby-keyword">end</span></pre>
677
+ </div><!-- run_job-source -->
678
+
679
+ </div>
680
+
681
+
682
+
683
+
684
+ </div><!-- run_job-method -->
685
+
686
+
687
+ <div id="method-c-validate_clouds_to_use" class="method-detail ">
688
+
689
+ <div class="method-heading">
690
+ <span class="method-name">validate_clouds_to_use</span><span
691
+ class="method-args">(job)</span>
692
+ <span class="method-click-advice">click to toggle source</span>
693
+ </div>
694
+
695
+
696
+ <div class="method-description">
697
+
698
+ <p>Given a single Exodus job, checks to make sure that we can actually run it
699
+ in this version of Neptune, and that the user has given us all the
700
+ credentials needed to use that cloud.</p>
701
+
702
+
703
+
704
+ <div class="method-source-code" id="validate_clouds_to_use-source">
705
+ <pre><span class="ruby-comment"># File lib/exodus.rb, line 144</span>
706
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">validate_clouds_to_use</span>(<span class="ruby-identifier">job</span>)
707
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">ensure_credentials_are_in_correct_format</span>(<span class="ruby-identifier">job</span>)
708
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">propogate_credentials_from_environment</span>(<span class="ruby-identifier">job</span>)
709
+
710
+ <span class="ruby-identifier">job</span>[<span class="ruby-value">:clouds_to_use</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">cloud</span><span class="ruby-operator">|</span>
711
+ <span class="ruby-keyword">if</span> <span class="ruby-constant">SUPPORTED_CLOUDS</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">cloud</span>)
712
+ <span class="ruby-constant">CLOUD_CREDENTIALS</span>[<span class="ruby-identifier">cloud</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">required_credential</span><span class="ruby-operator">|</span>
713
+ <span class="ruby-identifier">val_for_credential</span> = <span class="ruby-identifier">job</span>[<span class="ruby-value">:credentials</span>][<span class="ruby-identifier">required_credential</span>]
714
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">val_for_credential</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">val_for_credential</span>.<span class="ruby-identifier">empty?</span>
715
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;To use #{cloud}, &quot;</span> <span class="ruby-operator">+</span>
716
+ <span class="ruby-node">&quot;#{required_credential} must be specified.&quot;</span>)
717
+ <span class="ruby-keyword">end</span>
718
+ }
719
+ <span class="ruby-keyword">else</span>
720
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{cloud} was specified as in &quot;</span> <span class="ruby-operator">+</span>
721
+ <span class="ruby-string">&quot;:clouds_to_use, which is not a supported cloud.&quot;</span>)
722
+ <span class="ruby-keyword">end</span>
723
+ }
724
+ <span class="ruby-keyword">end</span></pre>
725
+ </div><!-- validate_clouds_to_use-source -->
726
+
727
+ </div>
728
+
729
+
730
+
731
+
732
+ </div><!-- validate_clouds_to_use-method -->
733
+
734
+
735
+ <div id="method-c-validate_files_argv_executable" class="method-detail ">
736
+
737
+ <div class="method-heading">
738
+ <span class="method-name">validate_files_argv_executable</span><span
739
+ class="method-args">(job)</span>
740
+ <span class="method-click-advice">click to toggle source</span>
741
+ </div>
742
+
743
+
744
+ <div class="method-description">
745
+
746
+
747
+
748
+
749
+
750
+ <div class="method-source-code" id="validate_files_argv_executable-source">
751
+ <pre><span class="ruby-comment"># File lib/exodus.rb, line 205</span>
752
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">validate_files_argv_executable</span>(<span class="ruby-identifier">job</span>)
753
+ [<span class="ruby-value">:code</span>, <span class="ruby-value">:argv</span>, <span class="ruby-value">:executable</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">param</span><span class="ruby-operator">|</span>
754
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">job</span>[<span class="ruby-identifier">param</span>].<span class="ruby-identifier">nil?</span>
755
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{param} was not specified&quot;</span>)
756
+ <span class="ruby-keyword">end</span>
757
+ }
758
+ <span class="ruby-keyword">end</span></pre>
759
+ </div><!-- validate_files_argv_executable-source -->
760
+
761
+ </div>
762
+
763
+
764
+
765
+
766
+ </div><!-- validate_files_argv_executable-method -->
767
+
768
+
769
+ <div id="method-c-validate_optimize_for_param" class="method-detail ">
770
+
771
+ <div class="method-heading">
772
+ <span class="method-name">validate_optimize_for_param</span><span
773
+ class="method-args">(job)</span>
774
+ <span class="method-click-advice">click to toggle source</span>
775
+ </div>
776
+
777
+
778
+ <div class="method-description">
779
+
780
+
781
+
782
+
783
+
784
+ <div class="method-source-code" id="validate_optimize_for_param-source">
785
+ <pre><span class="ruby-comment"># File lib/exodus.rb, line 191</span>
786
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">validate_optimize_for_param</span>(<span class="ruby-identifier">job</span>)
787
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">job</span>[<span class="ruby-value">:optimize_for</span>].<span class="ruby-identifier">nil?</span>
788
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;:optimize_for needs to be &quot;</span> <span class="ruby-operator">+</span>
789
+ <span class="ruby-string">&quot;specified when running Exodus jobs&quot;</span>)
790
+ <span class="ruby-keyword">end</span>
791
+
792
+ <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">OPTIMIZE_FOR_CHOICES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">job</span>[<span class="ruby-value">:optimize_for</span>])
793
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadConfigurationException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;The value given for &quot;</span> <span class="ruby-operator">+</span>
794
+ <span class="ruby-string">&quot;:optimize_for was not an acceptable value. Acceptable values are: &quot;</span> <span class="ruby-operator">+</span>
795
+ <span class="ruby-node">&quot;#{OPTIMIZE_FOR_CHOICES.join(', ')}&quot;</span>)
796
+ <span class="ruby-keyword">end</span>
797
+ <span class="ruby-keyword">end</span></pre>
798
+ </div><!-- validate_optimize_for_param-source -->
799
+
800
+ </div>
801
+
802
+
803
+
804
+
805
+ </div><!-- validate_optimize_for_param-method -->
806
+
807
+
808
+ </section><!-- public-class-method-details -->
809
+
810
+ </section><!-- 5Buntitled-5D -->
811
+
812
+ </div><!-- documentation -->
813
+
814
+
815
+ <footer id="validator-badges">
816
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
817
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
818
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
819
+ </footer>
820
+