neptune 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +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
@@ -0,0 +1,142 @@
|
|
1
|
+
/*
|
2
|
+
* Navigation allows movement using the arrow keys through the search results.
|
3
|
+
*
|
4
|
+
* When using this library you will need to set scrollIntoView to the
|
5
|
+
* appropriate function for your layout. Use scrollInWindow if the container
|
6
|
+
* is not scrollable and scrollInElement if the container is a separate
|
7
|
+
* scrolling region.
|
8
|
+
*/
|
9
|
+
Navigation = new function() {
|
10
|
+
this.initNavigation = function() {
|
11
|
+
var _this = this;
|
12
|
+
|
13
|
+
$(document).keydown(function(e) {
|
14
|
+
_this.onkeydown(e);
|
15
|
+
}).keyup(function(e) {
|
16
|
+
_this.onkeyup(e);
|
17
|
+
});
|
18
|
+
|
19
|
+
this.navigationActive = true;
|
20
|
+
}
|
21
|
+
|
22
|
+
this.setNavigationActive = function(state) {
|
23
|
+
this.navigationActive = state;
|
24
|
+
this.clearMoveTimeout();
|
25
|
+
}
|
26
|
+
|
27
|
+
this.onkeyup = function(e) {
|
28
|
+
if (!this.navigationActive) return;
|
29
|
+
|
30
|
+
switch(e.keyCode) {
|
31
|
+
case 37: //Event.KEY_LEFT:
|
32
|
+
case 38: //Event.KEY_UP:
|
33
|
+
case 39: //Event.KEY_RIGHT:
|
34
|
+
case 40: //Event.KEY_DOWN:
|
35
|
+
this.clearMoveTimeout();
|
36
|
+
break;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
this.onkeydown = function(e) {
|
41
|
+
if (!this.navigationActive) return;
|
42
|
+
switch(e.keyCode) {
|
43
|
+
case 37: //Event.KEY_LEFT:
|
44
|
+
if (this.moveLeft()) e.preventDefault();
|
45
|
+
break;
|
46
|
+
case 38: //Event.KEY_UP:
|
47
|
+
if (e.keyCode == 38 || e.ctrlKey) {
|
48
|
+
if (this.moveUp()) e.preventDefault();
|
49
|
+
this.startMoveTimeout(false);
|
50
|
+
}
|
51
|
+
break;
|
52
|
+
case 39: //Event.KEY_RIGHT:
|
53
|
+
if (this.moveRight()) e.preventDefault();
|
54
|
+
break;
|
55
|
+
case 40: //Event.KEY_DOWN:
|
56
|
+
if (e.keyCode == 40 || e.ctrlKey) {
|
57
|
+
if (this.moveDown()) e.preventDefault();
|
58
|
+
this.startMoveTimeout(true);
|
59
|
+
}
|
60
|
+
break;
|
61
|
+
case 13: //Event.KEY_RETURN:
|
62
|
+
if (this.$current)
|
63
|
+
e.preventDefault();
|
64
|
+
this.select(this.$current);
|
65
|
+
break;
|
66
|
+
}
|
67
|
+
if (e.ctrlKey && e.shiftKey) this.select(this.$current);
|
68
|
+
}
|
69
|
+
|
70
|
+
this.clearMoveTimeout = function() {
|
71
|
+
clearTimeout(this.moveTimeout);
|
72
|
+
this.moveTimeout = null;
|
73
|
+
}
|
74
|
+
|
75
|
+
this.startMoveTimeout = function(isDown) {
|
76
|
+
if (!$.browser.mozilla && !$.browser.opera) return;
|
77
|
+
if (this.moveTimeout) this.clearMoveTimeout();
|
78
|
+
var _this = this;
|
79
|
+
|
80
|
+
var go = function() {
|
81
|
+
if (!_this.moveTimeout) return;
|
82
|
+
_this[isDown ? 'moveDown' : 'moveUp']();
|
83
|
+
_this.moveTimout = setTimeout(go, 100);
|
84
|
+
}
|
85
|
+
this.moveTimeout = setTimeout(go, 200);
|
86
|
+
}
|
87
|
+
|
88
|
+
this.moveRight = function() {
|
89
|
+
}
|
90
|
+
|
91
|
+
this.moveLeft = function() {
|
92
|
+
}
|
93
|
+
|
94
|
+
this.move = function(isDown) {
|
95
|
+
}
|
96
|
+
|
97
|
+
this.moveUp = function() {
|
98
|
+
return this.move(false);
|
99
|
+
}
|
100
|
+
|
101
|
+
this.moveDown = function() {
|
102
|
+
return this.move(true);
|
103
|
+
}
|
104
|
+
|
105
|
+
/*
|
106
|
+
* Scrolls to the given element in the scrollable element view.
|
107
|
+
*/
|
108
|
+
this.scrollInElement = function(element, view) {
|
109
|
+
var offset, viewHeight, viewScroll, height;
|
110
|
+
offset = element.offsetTop;
|
111
|
+
height = element.offsetHeight;
|
112
|
+
viewHeight = view.offsetHeight;
|
113
|
+
viewScroll = view.scrollTop;
|
114
|
+
|
115
|
+
if (offset - viewScroll + height > viewHeight) {
|
116
|
+
view.scrollTop = offset - viewHeight + height;
|
117
|
+
}
|
118
|
+
if (offset < viewScroll) {
|
119
|
+
view.scrollTop = offset;
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
/*
|
124
|
+
* Scrolls to the given element in the window. The second argument is
|
125
|
+
* ignored
|
126
|
+
*/
|
127
|
+
this.scrollInWindow = function(element, ignored) {
|
128
|
+
var offset, viewHeight, viewScroll, height;
|
129
|
+
offset = element.offsetTop;
|
130
|
+
height = element.offsetHeight;
|
131
|
+
viewHeight = window.innerHeight;
|
132
|
+
viewScroll = window.scrollY;
|
133
|
+
|
134
|
+
if (offset - viewScroll + height > viewHeight) {
|
135
|
+
window.scrollTo(window.scrollX, offset - viewHeight + height);
|
136
|
+
}
|
137
|
+
if (offset < viewScroll) {
|
138
|
+
window.scrollTo(window.scrollX, offset);
|
139
|
+
}
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
data/doc/js/search.js
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
Search = function(data, input, result) {
|
2
|
+
this.data = data;
|
3
|
+
this.$input = $(input);
|
4
|
+
this.$result = $(result);
|
5
|
+
|
6
|
+
this.$current = null;
|
7
|
+
this.$view = this.$result.parent();
|
8
|
+
this.searcher = new Searcher(data.index);
|
9
|
+
this.init();
|
10
|
+
}
|
11
|
+
|
12
|
+
Search.prototype = $.extend({}, Navigation, new function() {
|
13
|
+
var suid = 1;
|
14
|
+
|
15
|
+
this.init = function() {
|
16
|
+
var _this = this;
|
17
|
+
var observer = function() {
|
18
|
+
_this.search(_this.$input[0].value);
|
19
|
+
};
|
20
|
+
this.$input.keyup(observer);
|
21
|
+
this.$input.click(observer); // mac's clear field
|
22
|
+
|
23
|
+
this.searcher.ready(function(results, isLast) {
|
24
|
+
_this.addResults(results, isLast);
|
25
|
+
})
|
26
|
+
|
27
|
+
this.initNavigation();
|
28
|
+
this.setNavigationActive(false);
|
29
|
+
}
|
30
|
+
|
31
|
+
this.search = function(value, selectFirstMatch) {
|
32
|
+
value = jQuery.trim(value).toLowerCase();
|
33
|
+
if (value) {
|
34
|
+
this.setNavigationActive(true);
|
35
|
+
} else {
|
36
|
+
this.setNavigationActive(false);
|
37
|
+
}
|
38
|
+
|
39
|
+
if (value == '') {
|
40
|
+
this.lastQuery = value;
|
41
|
+
this.$result.empty();
|
42
|
+
this.setNavigationActive(false);
|
43
|
+
} else if (value != this.lastQuery) {
|
44
|
+
this.lastQuery = value;
|
45
|
+
this.firstRun = true;
|
46
|
+
this.searcher.find(value);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
this.addResults = function(results, isLast) {
|
51
|
+
var target = this.$result.get(0);
|
52
|
+
if (this.firstRun && (results.length > 0 || isLast)) {
|
53
|
+
this.$current = null;
|
54
|
+
this.$result.empty();
|
55
|
+
}
|
56
|
+
|
57
|
+
for (var i=0, l = results.length; i < l; i++) {
|
58
|
+
target.appendChild(this.renderItem.call(this, results[i]));
|
59
|
+
};
|
60
|
+
|
61
|
+
if (this.firstRun && results.length > 0) {
|
62
|
+
this.firstRun = false;
|
63
|
+
this.$current = $(target.firstChild);
|
64
|
+
this.$current.addClass('current');
|
65
|
+
}
|
66
|
+
if (jQuery.browser.msie) this.$element[0].className += '';
|
67
|
+
}
|
68
|
+
|
69
|
+
this.move = function(isDown) {
|
70
|
+
if (!this.$current) return;
|
71
|
+
var $next = this.$current[isDown ? 'next' : 'prev']();
|
72
|
+
if ($next.length) {
|
73
|
+
this.$current.removeClass('current');
|
74
|
+
$next.addClass('current');
|
75
|
+
this.scrollIntoView($next[0], this.$view[0]);
|
76
|
+
this.$current = $next;
|
77
|
+
}
|
78
|
+
return true;
|
79
|
+
}
|
80
|
+
|
81
|
+
this.hlt = function(html) {
|
82
|
+
return this.escapeHTML(html).
|
83
|
+
replace(/\u0001/g, '<em>').
|
84
|
+
replace(/\u0002/g, '</em>');
|
85
|
+
}
|
86
|
+
|
87
|
+
this.escapeHTML = function(html) {
|
88
|
+
return html.replace(/[&<>]/g, function(c) {
|
89
|
+
return '&#' + c.charCodeAt(0) + ';';
|
90
|
+
});
|
91
|
+
}
|
92
|
+
|
93
|
+
});
|
94
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
var search_data = {"index":{"searchIndex":["babelhelper","badconfigurationexception","commonfunctions","exodushelper","exodustaskinfo","filenotfoundexception","neptunehelper","neptunemanagerclient","neptunemanagerexception","object","taskinfo","average()","babel()","check_output_files()","compile_code()","compile_code()","convert_clouds_to_use_to_array()","convert_from_neptune_params()","convert_to_neptune_params()","do_preprocessing()","does_file_exist?()","ensure_all_jobs_are_hashes()","ensure_all_params_are_present()","ensure_credentials_are_in_correct_format()","ensure_output_does_not_exist()","exodus()","find_optimal_cloud_for_task()","generate_babel_tasks()","generate_output_location()","get_acl()","get_bucket_for_local_data()","get_clouds_to_run_task_on()","get_from_yaml()","get_input()","get_job_data()","get_key_from_job_data()","get_minimum_val_in_data()","get_neptune_manager_client()","get_output()","get_profiling_info()","get_profiling_info()","get_random_alphanumeric()","get_secret_key()","get_std_out_and_err()","get_supported_babel_engines()","make_call()","method_missing()","neptune()","new()","new()","new()","preprocess_babel()","preprocess_compile()","preprocess_erlang()","preprocess_mpi()","preprocess_ssa()","propogate_credentials_from_environment()","put_code()","put_file()","put_input()","put_inputs()","require_file_to_exist()","require_file_to_not_exist()","require_param()","run_job()","run_job()","run_job()","scp_file()","scp_to_shadow()","set_acl()","shell()","start_neptune_job()","stderr()","stdout()","success?()","to_json()","to_s()","to_s()","upload_app_for_cicero()","validate_clouds_to_use()","validate_files_argv_executable()","validate_inputs()","validate_optimize_for_param()","validate_storage_params()","wait_and_get_output()","wait_for_compilation_to_finish()"],"longSearchIndex":["babelhelper","badconfigurationexception","commonfunctions","exodushelper","exodustaskinfo","filenotfoundexception","neptunehelper","neptunemanagerclient","neptunemanagerexception","object","taskinfo","exodushelper::average()","object#babel()","babelhelper::check_output_files()","neptunehelper::compile_code()","neptunemanagerclient#compile_code()","exodushelper::convert_clouds_to_use_to_array()","babelhelper::convert_from_neptune_params()","babelhelper::convert_to_neptune_params()","neptunehelper::do_preprocessing()","neptunemanagerclient#does_file_exist?()","exodushelper::ensure_all_jobs_are_hashes()","exodushelper::ensure_all_params_are_present()","exodushelper::ensure_credentials_are_in_correct_format()","babelhelper::ensure_output_does_not_exist()","object#exodus()","exodushelper::find_optimal_cloud_for_task()","exodushelper::generate_babel_tasks()","babelhelper::generate_output_location()","neptunemanagerclient#get_acl()","babelhelper::get_bucket_for_local_data()","exodushelper::get_clouds_to_run_task_on()","commonfunctions::get_from_yaml()","neptunehelper::get_input()","neptunehelper::get_job_data()","exodushelper::get_key_from_job_data()","exodushelper::get_minimum_val_in_data()","babelhelper::get_neptune_manager_client()","neptunemanagerclient#get_output()","exodushelper::get_profiling_info()","neptunemanagerclient#get_profiling_info()","commonfunctions::get_random_alphanumeric()","commonfunctions::get_secret_key()","neptunehelper::get_std_out_and_err()","neptunemanagerclient#get_supported_babel_engines()","neptunemanagerclient#make_call()","exodustaskinfo#method_missing()","object#neptune()","exodustaskinfo::new()","neptunemanagerclient::new()","taskinfo::new()","neptunehelper::preprocess_babel()","neptunehelper::preprocess_compile()","neptunehelper::preprocess_erlang()","neptunehelper::preprocess_mpi()","neptunehelper::preprocess_ssa()","exodushelper::propogate_credentials_from_environment()","babelhelper::put_code()","babelhelper::put_file()","neptunemanagerclient#put_input()","babelhelper::put_inputs()","neptunehelper::require_file_to_exist()","neptunehelper::require_file_to_not_exist()","neptunehelper::require_param()","babelhelper::run_job()","exodushelper::run_job()","neptunehelper::run_job()","commonfunctions::scp_file()","commonfunctions::scp_to_shadow()","neptunemanagerclient#set_acl()","commonfunctions::shell()","neptunemanagerclient#start_neptune_job()","taskinfo#stderr()","taskinfo#stdout()","taskinfo#success?()","taskinfo#to_json()","exodustaskinfo#to_s()","taskinfo#to_s()","neptunehelper::upload_app_for_cicero()","exodushelper::validate_clouds_to_use()","exodushelper::validate_files_argv_executable()","babelhelper::validate_inputs()","exodushelper::validate_optimize_for_param()","neptunehelper::validate_storage_params()","babelhelper::wait_and_get_output()","neptunehelper::wait_for_compilation_to_finish()"],"info":[["BabelHelper","","BabelHelper.html","","<p>This module provides convenience functions for babel().\n"],["BadConfigurationException","","BadConfigurationException.html","","<p>A class of exceptions that are thrown when the user tries to run a Neptune\njob but fails to give us the …\n"],["CommonFunctions","","CommonFunctions.html","","<p>A helper module that aggregates functions that are not part of Neptune’s\ncore functionality. Specifically …\n"],["ExodusHelper","","ExodusHelper.html","","<p>This module provides convenience functions for exodus(), to avoid\ncluttering up Object or Kernel’s namespace. …\n"],["ExodusTaskInfo","","ExodusTaskInfo.html","",""],["FileNotFoundException","","FileNotFoundException.html","","<p>An exception that is thrown whenever the user specifies a file to use that\ndoes not exist.\n"],["NeptuneHelper","","NeptuneHelper.html","","<p>NeptuneHelper provides methods that are used by neptune() and babel() to \nvalidate parameters and run …\n"],["NeptuneManagerClient","","NeptuneManagerClient.html","","<p>A client that uses SOAP messages to communicate with the underlying cloud\nplatform (here, AppScale). …\n"],["NeptuneManagerException","","NeptuneManagerException.html","","<p>A special class of exceptions that are thrown whenever the NeptuneManager\nexperiences an unexpected result. …\n"],["Object","","Object.html","","<p>Since we’re monkeypatching Object to add neptune() and babel(), a short\nblurb is necessary here to make …\n"],["TaskInfo","","TaskInfo.html","","<p>TaskInfo represents the result of a babel call, an object with all the\ninformation that the user would …\n"],["average","ExodusHelper","ExodusHelper.html#method-c-average","(vals)","<p>Given an Array of values, calculates and returns their average.\n"],["babel","Object","Object.html#method-i-babel","(jobs)","<p>Babel provides a nice wrapper around Neptune jobs. Instead of making users\nwrite multiple Neptune jobs …\n"],["check_output_files","BabelHelper","BabelHelper.html#method-c-check_output_files","(job_data)","<p>babel() callers do not have to specify a location where the standard output\nand error the task produces …\n"],["compile_code","NeptuneHelper","NeptuneHelper.html#method-c-compile_code","(job_data, ssh_args, shadow_ip)","<p>This method sends out a request to compile code, waits for it to finish,\nand gets the standard out and …\n"],["compile_code","NeptuneManagerClient","NeptuneManagerClient.html#method-i-compile_code","(job_data)","<p>Instructs the NeptuneManager to fetch the code specified and compile it.\nThe result should then be placed …\n"],["convert_clouds_to_use_to_array","ExodusHelper","ExodusHelper.html#method-c-convert_clouds_to_use_to_array","(job)","<p>Given a single Exodus job, checks to make sure it has either an Array of\nStrings or a single String listing …\n"],["convert_from_neptune_params","BabelHelper","BabelHelper.html#method-c-convert_from_neptune_params","(params)","<p>Neptune internally uses job_data with keys of the form @name, but since the\nuser has given them to us …\n"],["convert_to_neptune_params","BabelHelper","BabelHelper.html#method-c-convert_to_neptune_params","(job_data)","<p>Neptune input jobs expect keys of the form :name, but since we’ve already\nconverted them to the form …\n"],["do_preprocessing","NeptuneHelper","NeptuneHelper.html#method-c-do_preprocessing","(job_data, controller)","<p>Certain types of jobs need steps to be taken before they can be started\n(e.g., copying input data or …\n"],["does_file_exist?","NeptuneManagerClient","NeptuneManagerClient.html#method-i-does_file_exist-3F","(file, job_data)","<p>Asks the NeptuneManager to see if the given file exists in the remote\ndatastore. If extra credentials …\n"],["ensure_all_jobs_are_hashes","ExodusHelper","ExodusHelper.html#method-c-ensure_all_jobs_are_hashes","(jobs)","<p>Given an Array of jobs to run, ensures that they are all Hashes, the\nstandard format for Neptune jobs. …\n"],["ensure_all_params_are_present","ExodusHelper","ExodusHelper.html#method-c-ensure_all_params_are_present","(job)","<p>Given an Exodus job, validates its parameters, raising a \nBadConfigurationException for any missing params. …\n"],["ensure_credentials_are_in_correct_format","ExodusHelper","ExodusHelper.html#method-c-ensure_credentials_are_in_correct_format","(job)",""],["ensure_output_does_not_exist","BabelHelper","BabelHelper.html#method-c-ensure_output_does_not_exist","(job_data, remote_file)","<p>To avoid accidentally overwriting outputs from previous jobs, we first\ncheck to make sure an output file …\n"],["exodus","Object","Object.html#method-i-exodus","(jobs)","<p>Exodus provides further improvements to Babel. Instead of making users tell\nus what compute, storage, …\n"],["find_optimal_cloud_for_task","ExodusHelper","ExodusHelper.html#method-c-find_optimal_cloud_for_task","(job, profiling_info)",""],["generate_babel_tasks","ExodusHelper","ExodusHelper.html#method-c-generate_babel_tasks","(job, clouds_to_run_task_on)",""],["generate_output_location","BabelHelper","BabelHelper.html#method-c-generate_output_location","(job_data)","<p>If the user fails to give us an output location, this function will\ngenerate one for them, based on either …\n"],["get_acl","NeptuneManagerClient","NeptuneManagerClient.html#method-i-get_acl","(job_data)","<p>Returns the ACL associated with the named piece of data stored in the\nunderlying cloud platform. Right …\n"],["get_bucket_for_local_data","BabelHelper","BabelHelper.html#method-c-get_bucket_for_local_data","(job_data)","<p>Provides a common way for callers to get the name of the bucket that should\nbe used for Neptune jobs …\n"],["get_clouds_to_run_task_on","ExodusHelper","ExodusHelper.html#method-c-get_clouds_to_run_task_on","(job, profiling_info)",""],["get_from_yaml","CommonFunctions","CommonFunctions.html#method-c-get_from_yaml","(keyname, tag, required=true)","<p>Given the AppScale keyname, reads the associated YAML file and returns the\ncontents of the given tag. …\n"],["get_input","NeptuneHelper","NeptuneHelper.html#method-c-get_input","(job_data, ssh_args, shadow_ip, controller)","<p>This method takes a file on the local user’s computer and stores it\nremotely via AppScale. It returns …\n"],["get_job_data","NeptuneHelper","NeptuneHelper.html#method-c-get_job_data","(params)","<p>This method takes in a hash in the format that users write neptune/babel\njobs in {:a => “b”} …\n"],["get_key_from_job_data","ExodusHelper","ExodusHelper.html#method-c-get_key_from_job_data","(job)","<p>TODO(cgb): what is a job’s key?\n"],["get_minimum_val_in_data","ExodusHelper","ExodusHelper.html#method-c-get_minimum_val_in_data","(job, profiling_info)",""],["get_neptune_manager_client","BabelHelper","BabelHelper.html#method-c-get_neptune_manager_client","(job_data)","<p>Returns an NeptuneManagerClient for the given job data.\n"],["get_output","NeptuneManagerClient","NeptuneManagerClient.html#method-i-get_output","(job_data)","<p>Retrieves the output of a Neptune job, stored in an underlying database.\nWithin AppScale, a special application …\n"],["get_profiling_info","ExodusHelper","ExodusHelper.html#method-c-get_profiling_info","(job)",""],["get_profiling_info","NeptuneManagerClient","NeptuneManagerClient.html#method-i-get_profiling_info","(key)",""],["get_random_alphanumeric","CommonFunctions","CommonFunctions.html#method-c-get_random_alphanumeric","(length=10)","<p>Returns a random string composed of alphanumeric characters, as long as the\nuser requests.\n"],["get_secret_key","CommonFunctions","CommonFunctions.html#method-c-get_secret_key","(keyname, required=true)","<p>Returns the secret key needed for communication with AppScale’s Shadow\nnode. This method is a nice frontend …\n"],["get_std_out_and_err","NeptuneHelper","NeptuneHelper.html#method-c-get_std_out_and_err","(location)","<p>This method returns a hash containing the standard out and standard error\nfrom a completed job, as well …\n"],["get_supported_babel_engines","NeptuneManagerClient","NeptuneManagerClient.html#method-i-get_supported_babel_engines","(job_data)","<p>Asks the NeptuneManager for a list of all the Babel engines (each of which\nis a queue to store jobs and …\n"],["make_call","NeptuneManagerClient","NeptuneManagerClient.html#method-i-make_call","(time, retry_on_except)","<p>A helper method to make SOAP calls for us. This method is mainly here to\nreduce code duplication: all …\n"],["method_missing","ExodusTaskInfo","ExodusTaskInfo.html#method-i-method_missing","(id, *args, &block)",""],["neptune","Object","Object.html#method-i-neptune","(jobs)","<p>This method is the heart of Neptune - here, we take blocks of code that the\nuser has written and convert …\n"],["new","ExodusTaskInfo","ExodusTaskInfo.html#method-c-new","(dispatched_babel_tasks)",""],["new","NeptuneManagerClient","NeptuneManagerClient.html#method-c-new","(ip, secret)","<p>A constructor that requires both the IP address of the machine to\ncommunicate with as well as the secret …\n"],["new","TaskInfo","TaskInfo.html#method-c-new","(job_data)","<p>Creates a new TaskInfo object, storing the parameters the user gave us to\ninvoke the job for later use. …\n"],["preprocess_babel","NeptuneHelper","NeptuneHelper.html#method-c-preprocess_babel","(job_data, controller)","<p>This preprocessing method verifies that the user specified code that should\nbe run, where the output …\n"],["preprocess_compile","NeptuneHelper","NeptuneHelper.html#method-c-preprocess_compile","(job_data, controller)","<p>This preprocessing method copies over the user’s code to the Shadow node\nso that it can be compiled there. …\n"],["preprocess_erlang","NeptuneHelper","NeptuneHelper.html#method-c-preprocess_erlang","(job_data, controller)","<p>This preprocessing method makes sure that the user’s Erlang code exists\nand copies it over to the AppScale …\n"],["preprocess_mpi","NeptuneHelper","NeptuneHelper.html#method-c-preprocess_mpi","(job_data, controller)","<p>This preprocessing method verifies that the user specified the number of\nnodes to use. If they also specified …\n"],["preprocess_ssa","NeptuneHelper","NeptuneHelper.html#method-c-preprocess_ssa","(job_data, controller)","<p>This preprocessing method verifies that the user specified the number of\ntrajectories to run, via either …\n"],["propogate_credentials_from_environment","ExodusHelper","ExodusHelper.html#method-c-propogate_credentials_from_environment","(job)","<p>Searches the caller’s environment variables, and adds any that could be\nused in this Exodus job. Only …\n"],["put_code","BabelHelper","BabelHelper.html#method-c-put_code","(job_data)","<p>Stores the user’s code (and the directory it’s in, and directories in\nthe same directory as the user’s …\n"],["put_file","BabelHelper","BabelHelper.html#method-c-put_file","(local_path, job_data)","<p>If the user gives us local code or local inputs, this function will run a\nNeptune ‘input’ job to store …\n"],["put_input","NeptuneManagerClient","NeptuneManagerClient.html#method-i-put_input","(job_data)","<p>Stores a file stored on the user’s local file system in the underlying\ndatabase. The user can specify …\n"],["put_inputs","BabelHelper","BabelHelper.html#method-c-put_inputs","(job_data)","<p>If any input files are specified, they are copied to the remote datastore\nvia Neptune ‘input’ jobs. …\n"],["require_file_to_exist","NeptuneHelper","NeptuneHelper.html#method-c-require_file_to_exist","(file, job_data, controller)","<p>This helper method asks the NeptuneManager if the named file exists, and if\nit does not, throws an exception. …\n"],["require_file_to_not_exist","NeptuneHelper","NeptuneHelper.html#method-c-require_file_to_not_exist","(file, job_data, controller)","<p>This helper method performs the opposite function of require_file_to_exist,\nraising an exception if the …\n"],["require_param","NeptuneHelper","NeptuneHelper.html#method-c-require_param","(param, job_data)","<p>This helper method aborts if the given parameter is not present in the job\ndata provided.\n"],["run_job","BabelHelper","BabelHelper.html#method-c-run_job","(job_data_list)","<p>Constructs a Neptune job to run the user’s code as a Babel job (task\nqueue) from the given parameters. …\n"],["run_job","ExodusHelper","ExodusHelper.html#method-c-run_job","(tasks_to_run)",""],["run_job","NeptuneHelper","NeptuneHelper.html#method-c-run_job","(job_data, ssh_args, shadow_ip, secret)","<p>This method actually runs the Neptune job, given information about the job\nas well as information about …\n"],["scp_file","CommonFunctions","CommonFunctions.html#method-c-scp_file","(local_file_loc, remote_file_loc, target_ip, public_key_loc, is_dir=false)","<p>Performs the actual remote copying of files: given the IP address and other\ninformation from scp_to_shadow …\n"],["scp_to_shadow","CommonFunctions","CommonFunctions.html#method-c-scp_to_shadow","(local_file_loc, remote_file_loc, keyname, is_dir=false)","<p>Copies a file to the Shadow node (head node) within AppScale. The caller\nspecifies the local file location, …\n"],["set_acl","NeptuneManagerClient","NeptuneManagerClient.html#method-i-set_acl","(job_data)","<p>Sets the ACL of a specified pieces of data stored in the underlying cloud\nplatform. As is the case with …\n"],["shell","CommonFunctions","CommonFunctions.html#method-c-shell","(cmd)","<p>Executes a command and returns the result. Is needed to get around\nFlexmock’s inability to mock out Kernel:` …\n"],["start_neptune_job","NeptuneManagerClient","NeptuneManagerClient.html#method-i-start_neptune_job","(job_data)","<p>Initiates the start of a Neptune job, whether it be a HPC job (MPI, X10, or\nMapReduce), or a scaling …\n"],["stderr","TaskInfo","TaskInfo.html#method-i-stderr","()","<p>Returns a string with the standard error produced by this Babel task. While\nall jobs should produce standard …\n"],["stdout","TaskInfo","TaskInfo.html#method-i-stdout","()","<p>Returns a string with the standard output produced by this Babel task. If\nthe task has not yet completed, …\n"],["success?","TaskInfo","TaskInfo.html#method-i-success-3F","()","<p>A common operation that users may perform is asking if the task executed\nsuccessfully, indicated by a …\n"],["to_json","TaskInfo","TaskInfo.html#method-i-to_json","()","<p>Converts this object to JSON, so that it can be written to disk or passed\nover the network. Since our …\n"],["to_s","ExodusTaskInfo","ExodusTaskInfo.html#method-i-to_s","()",""],["to_s","TaskInfo","TaskInfo.html#method-i-to_s","()","<p>An alias for stdout.\n"],["upload_app_for_cicero","NeptuneHelper","NeptuneHelper.html#method-c-upload_app_for_cicero","(job_data)","<p>This method uploads a Google App Engine application into AppScale, for use\nwith Cicero jobs. It requires …\n"],["validate_clouds_to_use","ExodusHelper","ExodusHelper.html#method-c-validate_clouds_to_use","(job)","<p>Given a single Exodus job, checks to make sure that we can actually run it\nin this version of Neptune …\n"],["validate_files_argv_executable","ExodusHelper","ExodusHelper.html#method-c-validate_files_argv_executable","(job)",""],["validate_inputs","BabelHelper","BabelHelper.html#method-c-validate_inputs","(job_data)","<p>For jobs where the code is stored remotely, this method ensures that the\ncode and any possible inputs …\n"],["validate_optimize_for_param","ExodusHelper","ExodusHelper.html#method-c-validate_optimize_for_param","(job)",""],["validate_storage_params","NeptuneHelper","NeptuneHelper.html#method-c-validate_storage_params","(job_data)","<p>This method looks through the given job data and makes sure that the\ncorrect parameters are present for …\n"],["wait_and_get_output","BabelHelper","BabelHelper.html#method-c-wait_and_get_output","(job_data, output_location)","<p>Constructs a Neptune job to get the output of a Babel job. If the job is\nnot yet finished, this function …\n"],["wait_for_compilation_to_finish","NeptuneHelper","NeptuneHelper.html#method-c-wait_for_compilation_to_finish","(ssh_args, shadow_ip, compiled_location)","<p>This method waits for AppScale to finish compiling the user’s code,\nindicated by AppScale copying the …\n"]]}}
|
data/doc/js/searcher.js
ADDED
@@ -0,0 +1,228 @@
|
|
1
|
+
Searcher = function(data) {
|
2
|
+
this.data = data;
|
3
|
+
this.handlers = [];
|
4
|
+
}
|
5
|
+
|
6
|
+
Searcher.prototype = new function() {
|
7
|
+
// search is performed in chunks of 1000 for non-blocking user input
|
8
|
+
var CHUNK_SIZE = 1000;
|
9
|
+
// do not try to find more than 100 results
|
10
|
+
var MAX_RESULTS = 100;
|
11
|
+
var huid = 1;
|
12
|
+
var suid = 1;
|
13
|
+
var runs = 0;
|
14
|
+
|
15
|
+
this.find = function(query) {
|
16
|
+
var queries = splitQuery(query);
|
17
|
+
var regexps = buildRegexps(queries);
|
18
|
+
var highlighters = buildHilighters(queries);
|
19
|
+
var state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++};
|
20
|
+
var _this = this;
|
21
|
+
|
22
|
+
this.currentSuid = state.n;
|
23
|
+
|
24
|
+
if (!query) return;
|
25
|
+
|
26
|
+
var run = function() {
|
27
|
+
// stop current search thread if new search started
|
28
|
+
if (state.n != _this.currentSuid) return;
|
29
|
+
|
30
|
+
var results =
|
31
|
+
performSearch(_this.data, regexps, queries, highlighters, state);
|
32
|
+
var hasMore = (state.limit > 0 && state.pass < 4);
|
33
|
+
|
34
|
+
triggerResults.call(_this, results, !hasMore);
|
35
|
+
if (hasMore) {
|
36
|
+
setTimeout(run, 2);
|
37
|
+
}
|
38
|
+
runs++;
|
39
|
+
};
|
40
|
+
runs = 0;
|
41
|
+
|
42
|
+
// start search thread
|
43
|
+
run();
|
44
|
+
}
|
45
|
+
|
46
|
+
/* ----- Events ------ */
|
47
|
+
this.ready = function(fn) {
|
48
|
+
fn.huid = huid;
|
49
|
+
this.handlers.push(fn);
|
50
|
+
}
|
51
|
+
|
52
|
+
/* ----- Utilities ------ */
|
53
|
+
function splitQuery(query) {
|
54
|
+
return jQuery.grep(query.split(/(\s+|::?|\(\)?)/), function(string) {
|
55
|
+
return string.match(/\S/)
|
56
|
+
});
|
57
|
+
}
|
58
|
+
|
59
|
+
function buildRegexps(queries) {
|
60
|
+
return jQuery.map(queries, function(query) {
|
61
|
+
return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i')
|
62
|
+
});
|
63
|
+
}
|
64
|
+
|
65
|
+
function buildHilighters(queries) {
|
66
|
+
return jQuery.map(queries, function(query) {
|
67
|
+
return jQuery.map(query.split(''), function(l, i) {
|
68
|
+
return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2);
|
69
|
+
}).join('');
|
70
|
+
});
|
71
|
+
}
|
72
|
+
|
73
|
+
// function longMatchRegexp(index, longIndex, regexps) {
|
74
|
+
// for (var i = regexps.length - 1; i >= 0; i--){
|
75
|
+
// if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
|
76
|
+
// };
|
77
|
+
// return true;
|
78
|
+
// }
|
79
|
+
|
80
|
+
|
81
|
+
/* ----- Mathchers ------ */
|
82
|
+
|
83
|
+
/*
|
84
|
+
* This record matches if the index starts with queries[0] and the record
|
85
|
+
* matches all of the regexps
|
86
|
+
*/
|
87
|
+
function matchPassBeginning(index, longIndex, queries, regexps) {
|
88
|
+
if (index.indexOf(queries[0]) != 0) return false;
|
89
|
+
for (var i=1, l = regexps.length; i < l; i++) {
|
90
|
+
if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
|
91
|
+
return false;
|
92
|
+
};
|
93
|
+
return true;
|
94
|
+
}
|
95
|
+
|
96
|
+
/*
|
97
|
+
* This record matches if the longIndex starts with queries[0] and the
|
98
|
+
* longIndex matches all of the regexps
|
99
|
+
*/
|
100
|
+
function matchPassLongIndex(index, longIndex, queries, regexps) {
|
101
|
+
if (longIndex.indexOf(queries[0]) != 0) return false;
|
102
|
+
for (var i=1, l = regexps.length; i < l; i++) {
|
103
|
+
if (!longIndex.match(regexps[i]))
|
104
|
+
return false;
|
105
|
+
};
|
106
|
+
return true;
|
107
|
+
}
|
108
|
+
|
109
|
+
/*
|
110
|
+
* This record matches if the index contains queries[0] and the record
|
111
|
+
* matches all of the regexps
|
112
|
+
*/
|
113
|
+
function matchPassContains(index, longIndex, queries, regexps) {
|
114
|
+
if (index.indexOf(queries[0]) == -1) return false;
|
115
|
+
for (var i=1, l = regexps.length; i < l; i++) {
|
116
|
+
if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
|
117
|
+
return false;
|
118
|
+
};
|
119
|
+
return true;
|
120
|
+
}
|
121
|
+
|
122
|
+
/*
|
123
|
+
* This record matches if regexps[0] matches the index and the record
|
124
|
+
* matches all of the regexps
|
125
|
+
*/
|
126
|
+
function matchPassRegexp(index, longIndex, queries, regexps) {
|
127
|
+
if (!index.match(regexps[0])) return false;
|
128
|
+
for (var i=1, l = regexps.length; i < l; i++) {
|
129
|
+
if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
|
130
|
+
return false;
|
131
|
+
};
|
132
|
+
return true;
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
/* ----- Highlighters ------ */
|
137
|
+
function highlightRegexp(info, queries, regexps, highlighters) {
|
138
|
+
var result = createResult(info);
|
139
|
+
for (var i=0, l = regexps.length; i < l; i++) {
|
140
|
+
result.title = result.title.replace(regexps[i], highlighters[i]);
|
141
|
+
result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
|
142
|
+
};
|
143
|
+
return result;
|
144
|
+
}
|
145
|
+
|
146
|
+
function hltSubstring(string, pos, length) {
|
147
|
+
return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length);
|
148
|
+
}
|
149
|
+
|
150
|
+
function highlightQuery(info, queries, regexps, highlighters) {
|
151
|
+
var result = createResult(info);
|
152
|
+
var pos = 0;
|
153
|
+
var lcTitle = result.title.toLowerCase();
|
154
|
+
|
155
|
+
pos = lcTitle.indexOf(queries[0]);
|
156
|
+
if (pos != -1) {
|
157
|
+
result.title = hltSubstring(result.title, pos, queries[0].length);
|
158
|
+
}
|
159
|
+
|
160
|
+
result.namespace = result.namespace.replace(regexps[0], highlighters[0]);
|
161
|
+
for (var i=1, l = regexps.length; i < l; i++) {
|
162
|
+
result.title = result.title.replace(regexps[i], highlighters[i]);
|
163
|
+
result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
|
164
|
+
};
|
165
|
+
return result;
|
166
|
+
}
|
167
|
+
|
168
|
+
function createResult(info) {
|
169
|
+
var result = {};
|
170
|
+
result.title = info[0];
|
171
|
+
result.namespace = info[1];
|
172
|
+
result.path = info[2];
|
173
|
+
result.params = info[3];
|
174
|
+
result.snippet = info[4];
|
175
|
+
return result;
|
176
|
+
}
|
177
|
+
|
178
|
+
/* ----- Searching ------ */
|
179
|
+
function performSearch(data, regexps, queries, highlighters, state) {
|
180
|
+
var searchIndex = data.searchIndex;
|
181
|
+
var longSearchIndex = data.longSearchIndex;
|
182
|
+
var info = data.info;
|
183
|
+
var result = [];
|
184
|
+
var i = state.from;
|
185
|
+
var l = searchIndex.length;
|
186
|
+
var togo = CHUNK_SIZE;
|
187
|
+
var matchFunc, hltFunc;
|
188
|
+
|
189
|
+
while (state.pass < 4 && state.limit > 0 && togo > 0) {
|
190
|
+
if (state.pass == 0) {
|
191
|
+
matchFunc = matchPassBeginning;
|
192
|
+
hltFunc = highlightQuery;
|
193
|
+
} else if (state.pass == 1) {
|
194
|
+
matchFunc = matchPassLongIndex;
|
195
|
+
hltFunc = highlightQuery;
|
196
|
+
} else if (state.pass == 2) {
|
197
|
+
matchFunc = matchPassContains;
|
198
|
+
hltFunc = highlightQuery;
|
199
|
+
} else if (state.pass == 3) {
|
200
|
+
matchFunc = matchPassRegexp;
|
201
|
+
hltFunc = highlightRegexp;
|
202
|
+
}
|
203
|
+
|
204
|
+
for (; togo > 0 && i < l && state.limit > 0; i++, togo--) {
|
205
|
+
if (info[i].n == state.n) continue;
|
206
|
+
if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) {
|
207
|
+
info[i].n = state.n;
|
208
|
+
result.push(hltFunc(info[i], queries, regexps, highlighters));
|
209
|
+
state.limit--;
|
210
|
+
}
|
211
|
+
};
|
212
|
+
if (searchIndex.length <= i) {
|
213
|
+
state.pass++;
|
214
|
+
i = state.from = 0;
|
215
|
+
} else {
|
216
|
+
state.from = i;
|
217
|
+
}
|
218
|
+
}
|
219
|
+
return result;
|
220
|
+
}
|
221
|
+
|
222
|
+
function triggerResults(results, isLast) {
|
223
|
+
jQuery.each(this.handlers, function(i, fn) {
|
224
|
+
fn.call(this, results, isLast)
|
225
|
+
})
|
226
|
+
}
|
227
|
+
}
|
228
|
+
|