pho 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +5 -0
- data/Rakefile +1 -1
- data/lib/pho/snapshot.rb +6 -1
- data/lib/pho/sparql.rb +4 -1
- data/tests/tc_snapshots.rb +14 -1
- data/tests/tc_sparql_helper.rb +23 -0
- metadata +60 -160
- data/doc/rdoc/classes/Pho/Analyzers.html +0 -310
- data/doc/rdoc/classes/Pho/CommandLine.html +0 -770
- data/doc/rdoc/classes/Pho/DatatypeProperty.html +0 -241
- data/doc/rdoc/classes/Pho/Enrichment/StoreEnricher.html +0 -410
- data/doc/rdoc/classes/Pho/Enrichment.html +0 -119
- data/doc/rdoc/classes/Pho/Etags.html +0 -310
- data/doc/rdoc/classes/Pho/Facet/Results.html +0 -299
- data/doc/rdoc/classes/Pho/Facet/Term.html +0 -177
- data/doc/rdoc/classes/Pho/Facet.html +0 -119
- data/doc/rdoc/classes/Pho/FieldPredicateMap.html +0 -668
- data/doc/rdoc/classes/Pho/FieldWeighting.html +0 -230
- data/doc/rdoc/classes/Pho/FileManagement/AbstractFileManager.html +0 -478
- data/doc/rdoc/classes/Pho/FileManagement/FileManager.html +0 -264
- data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +0 -259
- data/doc/rdoc/classes/Pho/FileManagement.html +0 -121
- data/doc/rdoc/classes/Pho/Job.html +0 -627
- data/doc/rdoc/classes/Pho/JobUpdate.html +0 -141
- data/doc/rdoc/classes/Pho/Jobs.html +0 -538
- data/doc/rdoc/classes/Pho/Namespaces.html +0 -164
- data/doc/rdoc/classes/Pho/OAI/Record.html +0 -165
- data/doc/rdoc/classes/Pho/OAI/Records.html +0 -331
- data/doc/rdoc/classes/Pho/OAI.html +0 -118
- data/doc/rdoc/classes/Pho/QueryProfile.html +0 -497
- data/doc/rdoc/classes/Pho/RDF/Parser.html +0 -279
- data/doc/rdoc/classes/Pho/RDF.html +0 -120
- data/doc/rdoc/classes/Pho/RDFCollection.html +0 -119
- data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +0 -325
- data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +0 -241
- data/doc/rdoc/classes/Pho/ResourceHash.html +0 -123
- data/doc/rdoc/classes/Pho/Snapshot.html +0 -397
- data/doc/rdoc/classes/Pho/Sparql/SparqlClient.html +0 -594
- data/doc/rdoc/classes/Pho/Sparql/SparqlHelper.html +0 -692
- data/doc/rdoc/classes/Pho/Sparql.html +0 -187
- data/doc/rdoc/classes/Pho/Status.html +0 -296
- data/doc/rdoc/classes/Pho/Store.html +0 -1560
- data/doc/rdoc/classes/Pho/StoreSparqlClient.html +0 -183
- data/doc/rdoc/classes/Pho/Update/Changeset.html +0 -521
- data/doc/rdoc/classes/Pho/Update/ChangesetBuilder.html +0 -330
- data/doc/rdoc/classes/Pho/Update/ChangesetHelper.html +0 -159
- data/doc/rdoc/classes/Pho/Update/Changesets.html +0 -205
- data/doc/rdoc/classes/Pho/Update/LiteralStatement.html +0 -257
- data/doc/rdoc/classes/Pho/Update/ResourceStatement.html +0 -237
- data/doc/rdoc/classes/Pho/Update/Statement.html +0 -303
- data/doc/rdoc/classes/Pho/Update.html +0 -128
- data/doc/rdoc/classes/Pho.html +0 -283
- data/doc/rdoc/classes/String.html +0 -146
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/CHANGES.html +0 -351
- data/doc/rdoc/files/README.html +0 -191
- data/doc/rdoc/files/lib/pho/changeset_builder_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/changeset_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/command_line_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/converter_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/enrichment_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/etags_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/facet_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/field_predicate_map_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/file_management_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/file_manager_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/job_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/oai_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/query_profile_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/rdf_collection_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/rdf_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/resource_hash_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/snapshot_rb.html +0 -109
- data/doc/rdoc/files/lib/pho/sparql_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/status_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/store_rb.html +0 -108
- data/doc/rdoc/files/lib/pho_rb.html +0 -133
- data/doc/rdoc/fr_class_index.html +0 -72
- data/doc/rdoc/fr_file_index.html +0 -49
- data/doc/rdoc/fr_method_index.html +0 -237
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
@@ -1,538 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: Pho::Jobs</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">Pho::Jobs</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/pho/job_rb.html">
|
59
|
-
lib/pho/job.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
Object
|
69
|
-
</td>
|
70
|
-
</tr>
|
71
|
-
</table>
|
72
|
-
</div>
|
73
|
-
<!-- banner header -->
|
74
|
-
|
75
|
-
<div id="bodyContent">
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<div id="contextContent">
|
80
|
-
|
81
|
-
<div id="description">
|
82
|
-
<p>
|
83
|
-
TODO job deletion
|
84
|
-
</p>
|
85
|
-
|
86
|
-
</div>
|
87
|
-
|
88
|
-
|
89
|
-
</div>
|
90
|
-
|
91
|
-
<div id="method-list">
|
92
|
-
<h3 class="section-bar">Methods</h3>
|
93
|
-
|
94
|
-
<div class="name-list">
|
95
|
-
<a href="#M000147">build_job_request</a>
|
96
|
-
<a href="#M000141">read_from_store</a>
|
97
|
-
<a href="#M000146">submit_job</a>
|
98
|
-
<a href="#M000143">submit_reindex</a>
|
99
|
-
<a href="#M000142">submit_reset</a>
|
100
|
-
<a href="#M000145">submit_restore</a>
|
101
|
-
<a href="#M000144">submit_snapshot</a>
|
102
|
-
<a href="#M000149">wait_for</a>
|
103
|
-
<a href="#M000148">wait_for_submitted</a>
|
104
|
-
<a href="#M000150">yield_job_update</a>
|
105
|
-
</div>
|
106
|
-
</div>
|
107
|
-
|
108
|
-
</div>
|
109
|
-
|
110
|
-
|
111
|
-
<!-- if includes -->
|
112
|
-
|
113
|
-
<div id="section">
|
114
|
-
|
115
|
-
|
116
|
-
<div id="constants-list">
|
117
|
-
<h3 class="section-bar">Constants</h3>
|
118
|
-
|
119
|
-
<div class="name-list">
|
120
|
-
<table summary="Constants">
|
121
|
-
<tr class="top-aligned-row context-row">
|
122
|
-
<td class="context-item-name">RESET</td>
|
123
|
-
<td>=</td>
|
124
|
-
<td class="context-item-value">"http://schemas.talis.com/2006/bigfoot/configuration#ResetDataJob".freeze</td>
|
125
|
-
</tr>
|
126
|
-
<tr class="top-aligned-row context-row">
|
127
|
-
<td class="context-item-name">SNAPSHOT</td>
|
128
|
-
<td>=</td>
|
129
|
-
<td class="context-item-value">"http://schemas.talis.com/2006/bigfoot/configuration#SnapshotJob".freeze</td>
|
130
|
-
</tr>
|
131
|
-
<tr class="top-aligned-row context-row">
|
132
|
-
<td class="context-item-name">REINDEX</td>
|
133
|
-
<td>=</td>
|
134
|
-
<td class="context-item-value">"http://schemas.talis.com/2006/bigfoot/configuration#ReindexJob".freeze</td>
|
135
|
-
</tr>
|
136
|
-
<tr class="top-aligned-row context-row">
|
137
|
-
<td class="context-item-name">RESTORE</td>
|
138
|
-
<td>=</td>
|
139
|
-
<td class="context-item-value">"http://schemas.talis.com/2006/bigfoot/configuration#RestoreJob".freeze</td>
|
140
|
-
</tr>
|
141
|
-
</table>
|
142
|
-
</div>
|
143
|
-
</div>
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
<!-- if method_list -->
|
151
|
-
<div id="methods">
|
152
|
-
<h3 class="section-bar">Public Class methods</h3>
|
153
|
-
|
154
|
-
<div id="method-M000147" class="method-detail">
|
155
|
-
<a name="M000147"></a>
|
156
|
-
|
157
|
-
<div class="method-heading">
|
158
|
-
<a href="#M000147" class="method-signature">
|
159
|
-
<span class="method-name">build_job_request</span><span class="method-args">(type, label, t=Time.now, snapshot_uri=nil)</span>
|
160
|
-
</a>
|
161
|
-
</div>
|
162
|
-
|
163
|
-
<div class="method-description">
|
164
|
-
<p>
|
165
|
-
Construct an <a href="RDF.html">RDF</a>/XML document containing a job
|
166
|
-
request for submitting to the Platform.
|
167
|
-
</p>
|
168
|
-
<table>
|
169
|
-
<tr><td valign="top">t:</td><td>a Time object, specifying the time at which the request should be carried
|
170
|
-
out
|
171
|
-
|
172
|
-
</td></tr>
|
173
|
-
</table>
|
174
|
-
<p><a class="source-toggle" href="#"
|
175
|
-
onclick="toggleCode('M000147-source');return false;">[Source]</a></p>
|
176
|
-
<div class="method-source-code" id="M000147-source">
|
177
|
-
<pre>
|
178
|
-
<span class="ruby-comment cmt"># File lib/pho/job.rb, line 79</span>
|
179
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">build_job_request</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">label</span>, <span class="ruby-identifier">t</span>=<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>, <span class="ruby-identifier">snapshot_uri</span>=<span class="ruby-keyword kw">nil</span>)
|
180
|
-
|
181
|
-
<span class="ruby-identifier">time</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">getutc</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">"%Y-%m-%dT%H:%M:%SZ"</span>)
|
182
|
-
<span class="ruby-identifier">data</span> = <span class="ruby-value str">"<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" "</span>
|
183
|
-
<span class="ruby-identifier">data</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" "</span>
|
184
|
-
<span class="ruby-identifier">data</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">" xmlns:bf=\"http://schemas.talis.com/2006/bigfoot/configuration#\"> "</span>
|
185
|
-
<span class="ruby-identifier">data</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">" <bf:JobRequest>"</span>
|
186
|
-
<span class="ruby-identifier">data</span> <span class="ruby-operator"><<</span> <span class="ruby-node">" <rdfs:label>#{label}</rdfs:label>"</span>
|
187
|
-
<span class="ruby-identifier">data</span> <span class="ruby-operator"><<</span> <span class="ruby-node">" <bf:jobType rdf:resource=\"#{type}\"/>"</span>
|
188
|
-
<span class="ruby-identifier">data</span> <span class="ruby-operator"><<</span> <span class="ruby-node">" <bf:startTime>#{time}</bf:startTime>"</span>
|
189
|
-
|
190
|
-
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">snapshot_uri</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>)
|
191
|
-
<span class="ruby-identifier">data</span> <span class="ruby-operator"><<</span> <span class="ruby-node">" <bf:snapshotUri rdf:resource=\"#{snapshot_uri}\"/>"</span>
|
192
|
-
<span class="ruby-keyword kw">end</span>
|
193
|
-
|
194
|
-
<span class="ruby-identifier">data</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">" </bf:JobRequest>"</span>
|
195
|
-
<span class="ruby-identifier">data</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"</rdf:RDF>"</span>
|
196
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">data</span>
|
197
|
-
<span class="ruby-keyword kw">end</span>
|
198
|
-
</pre>
|
199
|
-
</div>
|
200
|
-
</div>
|
201
|
-
</div>
|
202
|
-
|
203
|
-
<div id="method-M000141" class="method-detail">
|
204
|
-
<a name="M000141"></a>
|
205
|
-
|
206
|
-
<div class="method-heading">
|
207
|
-
<a href="#M000141" class="method-signature">
|
208
|
-
<span class="method-name">read_from_store</span><span class="method-args">(store)</span>
|
209
|
-
</a>
|
210
|
-
</div>
|
211
|
-
|
212
|
-
<div class="method-description">
|
213
|
-
<p>
|
214
|
-
Reads the current list of scheduled jobs from the provided store. Returns
|
215
|
-
an array of job names
|
216
|
-
</p>
|
217
|
-
<pre>
|
218
|
-
store:: store from which to read the scheduled job list
|
219
|
-
</pre>
|
220
|
-
<p><a class="source-toggle" href="#"
|
221
|
-
onclick="toggleCode('M000141-source');return false;">[Source]</a></p>
|
222
|
-
<div class="method-source-code" id="M000141-source">
|
223
|
-
<pre>
|
224
|
-
<span class="ruby-comment cmt"># File lib/pho/job.rb, line 16</span>
|
225
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">read_from_store</span>(<span class="ruby-identifier">store</span>)
|
226
|
-
<span class="ruby-identifier">resp</span> = <span class="ruby-identifier">store</span>.<span class="ruby-identifier">get_jobs</span>()
|
227
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">!=</span> <span class="ruby-value">200</span>
|
228
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"Unable to read jobs from store. Status was {resp.status}"</span>
|
229
|
-
<span class="ruby-keyword kw">end</span>
|
230
|
-
<span class="ruby-identifier">jobs</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
231
|
-
|
232
|
-
<span class="ruby-identifier">doc</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Document</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">resp</span>.<span class="ruby-identifier">content</span>)
|
233
|
-
<span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">each</span>(<span class="ruby-identifier">doc</span>.<span class="ruby-identifier">root</span>, <span class="ruby-value str">"//bf:job"</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Namespaces</span><span class="ruby-operator">::</span><span class="ruby-constant">MAPPING</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">el</span><span class="ruby-operator">|</span>
|
234
|
-
<span class="ruby-identifier">jobs</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">el</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">"rdf:resource"</span>]
|
235
|
-
<span class="ruby-keyword kw">end</span>
|
236
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">jobs</span>
|
237
|
-
|
238
|
-
<span class="ruby-keyword kw">end</span>
|
239
|
-
</pre>
|
240
|
-
</div>
|
241
|
-
</div>
|
242
|
-
</div>
|
243
|
-
|
244
|
-
<div id="method-M000146" class="method-detail">
|
245
|
-
<a name="M000146"></a>
|
246
|
-
|
247
|
-
<div class="method-heading">
|
248
|
-
<a href="#M000146" class="method-signature">
|
249
|
-
<span class="method-name">submit_job</span><span class="method-args">(store, jobtype, label, t=Time.now, snapshot_uri=nil)</span>
|
250
|
-
</a>
|
251
|
-
</div>
|
252
|
-
|
253
|
-
<div class="method-description">
|
254
|
-
<p>
|
255
|
-
Generic submit job method
|
256
|
-
</p>
|
257
|
-
<p><a class="source-toggle" href="#"
|
258
|
-
onclick="toggleCode('M000146-source');return false;">[Source]</a></p>
|
259
|
-
<div class="method-source-code" id="M000146-source">
|
260
|
-
<pre>
|
261
|
-
<span class="ruby-comment cmt"># File lib/pho/job.rb, line 72</span>
|
262
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">submit_job</span>(<span class="ruby-identifier">store</span>, <span class="ruby-identifier">jobtype</span>, <span class="ruby-identifier">label</span>, <span class="ruby-identifier">t</span>=<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>, <span class="ruby-identifier">snapshot_uri</span>=<span class="ruby-keyword kw">nil</span>)
|
263
|
-
<span class="ruby-identifier">store</span>.<span class="ruby-identifier">submit_job</span>( <span class="ruby-identifier">build_job_request</span>(<span class="ruby-identifier">jobtype</span>, <span class="ruby-identifier">label</span>, <span class="ruby-identifier">t</span>, <span class="ruby-identifier">snapshot_uri</span>) )
|
264
|
-
<span class="ruby-keyword kw">end</span>
|
265
|
-
</pre>
|
266
|
-
</div>
|
267
|
-
</div>
|
268
|
-
</div>
|
269
|
-
|
270
|
-
<div id="method-M000143" class="method-detail">
|
271
|
-
<a name="M000143"></a>
|
272
|
-
|
273
|
-
<div class="method-heading">
|
274
|
-
<a href="#M000143" class="method-signature">
|
275
|
-
<span class="method-name">submit_reindex</span><span class="method-args">(store, label="Reindex my store", t=Time.now)</span>
|
276
|
-
</a>
|
277
|
-
</div>
|
278
|
-
|
279
|
-
<div class="method-description">
|
280
|
-
<p>
|
281
|
-
Submit a reindex job to the Platform
|
282
|
-
</p>
|
283
|
-
<p>
|
284
|
-
This method submits the job, and will return an HTTP:Message indicating the
|
285
|
-
response from the Platform. Client code should check this for success. As
|
286
|
-
job processing may not be immediate, clients should determine the URI of
|
287
|
-
the newly created job and then monitor the jobs status if they need to wait
|
288
|
-
for the job to finish.
|
289
|
-
</p>
|
290
|
-
<p><a class="source-toggle" href="#"
|
291
|
-
onclick="toggleCode('M000143-source');return false;">[Source]</a></p>
|
292
|
-
<div class="method-source-code" id="M000143-source">
|
293
|
-
<pre>
|
294
|
-
<span class="ruby-comment cmt"># File lib/pho/job.rb, line 47</span>
|
295
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">submit_reindex</span>(<span class="ruby-identifier">store</span>, <span class="ruby-identifier">label</span>=<span class="ruby-value str">"Reindex my store"</span>, <span class="ruby-identifier">t</span>=<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
|
296
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">submit_job</span>(<span class="ruby-identifier">store</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Jobs</span><span class="ruby-operator">::</span><span class="ruby-constant">REINDEX</span>, <span class="ruby-identifier">label</span>, <span class="ruby-identifier">t</span>)
|
297
|
-
<span class="ruby-keyword kw">end</span>
|
298
|
-
</pre>
|
299
|
-
</div>
|
300
|
-
</div>
|
301
|
-
</div>
|
302
|
-
|
303
|
-
<div id="method-M000142" class="method-detail">
|
304
|
-
<a name="M000142"></a>
|
305
|
-
|
306
|
-
<div class="method-heading">
|
307
|
-
<a href="#M000142" class="method-signature">
|
308
|
-
<span class="method-name">submit_reset</span><span class="method-args">(store, label="Reset my store", t=Time.now)</span>
|
309
|
-
</a>
|
310
|
-
</div>
|
311
|
-
|
312
|
-
<div class="method-description">
|
313
|
-
<p>
|
314
|
-
Submit a reset job to the Platform
|
315
|
-
</p>
|
316
|
-
<p>
|
317
|
-
This method submits the job, and will return an HTTP:Message indicating the
|
318
|
-
response from the Platform. Client code should check this for success. As
|
319
|
-
job processing may not be immediate, clients should determine the URI of
|
320
|
-
the newly created job and then monitor the jobs status if they need to wait
|
321
|
-
for the job to finish.
|
322
|
-
</p>
|
323
|
-
<p><a class="source-toggle" href="#"
|
324
|
-
onclick="toggleCode('M000142-source');return false;">[Source]</a></p>
|
325
|
-
<div class="method-source-code" id="M000142-source">
|
326
|
-
<pre>
|
327
|
-
<span class="ruby-comment cmt"># File lib/pho/job.rb, line 37</span>
|
328
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">submit_reset</span>(<span class="ruby-identifier">store</span>, <span class="ruby-identifier">label</span>=<span class="ruby-value str">"Reset my store"</span>, <span class="ruby-identifier">t</span>=<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
|
329
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">submit_job</span>(<span class="ruby-identifier">store</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Jobs</span><span class="ruby-operator">::</span><span class="ruby-constant">RESET</span>, <span class="ruby-identifier">label</span>, <span class="ruby-identifier">t</span>)
|
330
|
-
<span class="ruby-keyword kw">end</span>
|
331
|
-
</pre>
|
332
|
-
</div>
|
333
|
-
</div>
|
334
|
-
</div>
|
335
|
-
|
336
|
-
<div id="method-M000145" class="method-detail">
|
337
|
-
<a name="M000145"></a>
|
338
|
-
|
339
|
-
<div class="method-heading">
|
340
|
-
<a href="#M000145" class="method-signature">
|
341
|
-
<span class="method-name">submit_restore</span><span class="method-args">(store, snapshot_uri, label="Restore my snapshot", t=Time.now)</span>
|
342
|
-
</a>
|
343
|
-
</div>
|
344
|
-
|
345
|
-
<div class="method-description">
|
346
|
-
<p>
|
347
|
-
Submit a restore job to the Platform
|
348
|
-
</p>
|
349
|
-
<p>
|
350
|
-
This method submits the job, and will return an HTTP:Message indicating the
|
351
|
-
response from the Platform. Client code should check this for success. As
|
352
|
-
job processing may not be immediate, clients should determine the URI of
|
353
|
-
the newly created job and then monitor the jobs status if they need to wait
|
354
|
-
for the job to finish.
|
355
|
-
</p>
|
356
|
-
<p><a class="source-toggle" href="#"
|
357
|
-
onclick="toggleCode('M000145-source');return false;">[Source]</a></p>
|
358
|
-
<div class="method-source-code" id="M000145-source">
|
359
|
-
<pre>
|
360
|
-
<span class="ruby-comment cmt"># File lib/pho/job.rb, line 67</span>
|
361
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">submit_restore</span>(<span class="ruby-identifier">store</span>, <span class="ruby-identifier">snapshot_uri</span>, <span class="ruby-identifier">label</span>=<span class="ruby-value str">"Restore my snapshot"</span>, <span class="ruby-identifier">t</span>=<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
|
362
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">submit_job</span>(<span class="ruby-identifier">store</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Jobs</span><span class="ruby-operator">::</span><span class="ruby-constant">RESTORE</span>, <span class="ruby-identifier">label</span>, <span class="ruby-identifier">t</span>, <span class="ruby-identifier">snapshot_uri</span>)
|
363
|
-
<span class="ruby-keyword kw">end</span>
|
364
|
-
</pre>
|
365
|
-
</div>
|
366
|
-
</div>
|
367
|
-
</div>
|
368
|
-
|
369
|
-
<div id="method-M000144" class="method-detail">
|
370
|
-
<a name="M000144"></a>
|
371
|
-
|
372
|
-
<div class="method-heading">
|
373
|
-
<a href="#M000144" class="method-signature">
|
374
|
-
<span class="method-name">submit_snapshot</span><span class="method-args">(store, label="Snapshot my store", t=Time.now)</span>
|
375
|
-
</a>
|
376
|
-
</div>
|
377
|
-
|
378
|
-
<div class="method-description">
|
379
|
-
<p>
|
380
|
-
Submit a snapshot job to the Platform
|
381
|
-
</p>
|
382
|
-
<p>
|
383
|
-
This method submits the job, and will return an HTTP:Message indicating the
|
384
|
-
response from the Platform. Client code should check this for success. As
|
385
|
-
job processing may not be immediate, clients should determine the URI of
|
386
|
-
the newly created job and then monitor the jobs status if they need to wait
|
387
|
-
for the job to finish.
|
388
|
-
</p>
|
389
|
-
<p><a class="source-toggle" href="#"
|
390
|
-
onclick="toggleCode('M000144-source');return false;">[Source]</a></p>
|
391
|
-
<div class="method-source-code" id="M000144-source">
|
392
|
-
<pre>
|
393
|
-
<span class="ruby-comment cmt"># File lib/pho/job.rb, line 57</span>
|
394
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">submit_snapshot</span>(<span class="ruby-identifier">store</span>, <span class="ruby-identifier">label</span>=<span class="ruby-value str">"Snapshot my store"</span>, <span class="ruby-identifier">t</span>=<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
|
395
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">submit_job</span>(<span class="ruby-identifier">store</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Jobs</span><span class="ruby-operator">::</span><span class="ruby-constant">SNAPSHOT</span>, <span class="ruby-identifier">label</span>, <span class="ruby-identifier">t</span>)
|
396
|
-
<span class="ruby-keyword kw">end</span>
|
397
|
-
</pre>
|
398
|
-
</div>
|
399
|
-
</div>
|
400
|
-
</div>
|
401
|
-
|
402
|
-
<div id="method-M000149" class="method-detail">
|
403
|
-
<a name="M000149"></a>
|
404
|
-
|
405
|
-
<div class="method-heading">
|
406
|
-
<a href="#M000149" class="method-signature">
|
407
|
-
<span class="method-name">wait_for</span><span class="method-args">(uri, store, interval=1, &block)</span>
|
408
|
-
</a>
|
409
|
-
</div>
|
410
|
-
|
411
|
-
<div class="method-description">
|
412
|
-
<p>
|
413
|
-
Wait for the specified job to finish
|
414
|
-
</p>
|
415
|
-
<p>
|
416
|
-
The method will repeatedly contact the Platform to determine whether the
|
417
|
-
job has finished executing. The requests are made at configurable intervals
|
418
|
-
(once a minute by default). If a block is supplied, then it is passed a
|
419
|
-
reference to the <a href="Job.html">Job</a> (containing current progress
|
420
|
-
updates) after each request. The <a href="Job.html">Job</a> object is
|
421
|
-
returned once completed.
|
422
|
-
</p>
|
423
|
-
<pre>
|
424
|
-
uri:: URI of the job to wait for
|
425
|
-
store:: the store on which the job is running
|
426
|
-
interval:: the interval at which checks will be made, in minutes. Default is 1
|
427
|
-
</pre>
|
428
|
-
<p><a class="source-toggle" href="#"
|
429
|
-
onclick="toggleCode('M000149-source');return false;">[Source]</a></p>
|
430
|
-
<div class="method-source-code" id="M000149-source">
|
431
|
-
<pre>
|
432
|
-
<span class="ruby-comment cmt"># File lib/pho/job.rb, line 118</span>
|
433
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">wait_for</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">store</span>, <span class="ruby-identifier">interval</span>=<span class="ruby-value">1</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
434
|
-
<span class="ruby-identifier">updates</span> = <span class="ruby-value">0</span>
|
435
|
-
<span class="ruby-identifier">job</span> = <span class="ruby-constant">Job</span>.<span class="ruby-identifier">read_from_store</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">store</span>)
|
436
|
-
<span class="ruby-identifier">updates</span> = <span class="ruby-identifier">yield_job_update</span>(<span class="ruby-identifier">job</span>, <span class="ruby-identifier">updates</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
437
|
-
<span class="ruby-keyword kw">while</span> <span class="ruby-operator">!</span><span class="ruby-identifier">job</span>.<span class="ruby-identifier">completed?</span>
|
438
|
-
<span class="ruby-identifier">sleep</span> <span class="ruby-identifier">interval</span><span class="ruby-operator">*</span><span class="ruby-value">60</span>
|
439
|
-
<span class="ruby-identifier">job</span> = <span class="ruby-constant">Job</span>.<span class="ruby-identifier">read_from_store</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">store</span>)
|
440
|
-
<span class="ruby-identifier">updates</span> = <span class="ruby-identifier">yield_job_update</span>(<span class="ruby-identifier">job</span>, <span class="ruby-identifier">updates</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
441
|
-
<span class="ruby-keyword kw">end</span>
|
442
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">job</span>
|
443
|
-
<span class="ruby-keyword kw">end</span>
|
444
|
-
</pre>
|
445
|
-
</div>
|
446
|
-
</div>
|
447
|
-
</div>
|
448
|
-
|
449
|
-
<div id="method-M000148" class="method-detail">
|
450
|
-
<a name="M000148"></a>
|
451
|
-
|
452
|
-
<div class="method-heading">
|
453
|
-
<a href="#M000148" class="method-signature">
|
454
|
-
<span class="method-name">wait_for_submitted</span><span class="method-args">(resp, store, interval=1, &block)</span>
|
455
|
-
</a>
|
456
|
-
</div>
|
457
|
-
|
458
|
-
<div class="method-description">
|
459
|
-
<p>
|
460
|
-
Wait for a newly submitted job to finish
|
461
|
-
</p>
|
462
|
-
<p><a class="source-toggle" href="#"
|
463
|
-
onclick="toggleCode('M000148-source');return false;">[Source]</a></p>
|
464
|
-
<div class="method-source-code" id="M000148-source">
|
465
|
-
<pre>
|
466
|
-
<span class="ruby-comment cmt"># File lib/pho/job.rb, line 100</span>
|
467
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">wait_for_submitted</span>(<span class="ruby-identifier">resp</span>, <span class="ruby-identifier">store</span>, <span class="ruby-identifier">interval</span>=<span class="ruby-value">1</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
468
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">!=</span> <span class="ruby-value">201</span>
|
469
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-node">"Unable to wait, job was not created. Status was #{resp.status}"</span>
|
470
|
-
<span class="ruby-keyword kw">end</span>
|
471
|
-
<span class="ruby-identifier">job_url</span> = <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">header</span>[<span class="ruby-value str">"Location"</span>].<span class="ruby-identifier">first</span>
|
472
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">wait_for</span>(<span class="ruby-identifier">job_url</span>, <span class="ruby-identifier">store</span>, <span class="ruby-identifier">interval</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
473
|
-
<span class="ruby-keyword kw">end</span>
|
474
|
-
</pre>
|
475
|
-
</div>
|
476
|
-
</div>
|
477
|
-
</div>
|
478
|
-
|
479
|
-
<h3 class="section-bar">Protected Class methods</h3>
|
480
|
-
|
481
|
-
<div id="method-M000150" class="method-detail">
|
482
|
-
<a name="M000150"></a>
|
483
|
-
|
484
|
-
<div class="method-heading">
|
485
|
-
<a href="#M000150" class="method-signature">
|
486
|
-
<span class="method-name">yield_job_update</span><span class="method-args">(job, updates) {|job, job.start_message, job.actual_start_time| ...}</span>
|
487
|
-
</a>
|
488
|
-
</div>
|
489
|
-
|
490
|
-
<div class="method-description">
|
491
|
-
<p><a class="source-toggle" href="#"
|
492
|
-
onclick="toggleCode('M000150-source');return false;">[Source]</a></p>
|
493
|
-
<div class="method-source-code" id="M000150-source">
|
494
|
-
<pre>
|
495
|
-
<span class="ruby-comment cmt"># File lib/pho/job.rb, line 132</span>
|
496
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">yield_job_update</span>(<span class="ruby-identifier">job</span>, <span class="ruby-identifier">updates</span>)
|
497
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
498
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">job</span>.<span class="ruby-identifier">started?</span>
|
499
|
-
|
500
|
-
<span class="ruby-comment cmt">#only yield start message if we've not seen any updates</span>
|
501
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">updates</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
502
|
-
<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">job</span>, <span class="ruby-identifier">job</span>.<span class="ruby-identifier">start_message</span>, <span class="ruby-identifier">job</span>.<span class="ruby-identifier">actual_start_time</span>
|
503
|
-
<span class="ruby-keyword kw">end</span>
|
504
|
-
|
505
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">job</span>.<span class="ruby-identifier">progress_updates</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
506
|
-
<span class="ruby-identifier">unseen</span> = <span class="ruby-identifier">job</span>.<span class="ruby-identifier">progress_updates</span>[<span class="ruby-identifier">updates</span>, <span class="ruby-identifier">job</span>.<span class="ruby-identifier">progress_updates</span>.<span class="ruby-identifier">length</span>]
|
507
|
-
<span class="ruby-identifier">unseen</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">update</span><span class="ruby-operator">|</span>
|
508
|
-
<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">job</span>, <span class="ruby-identifier">update</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">update</span>.<span class="ruby-identifier">time</span>
|
509
|
-
<span class="ruby-keyword kw">end</span>
|
510
|
-
<span class="ruby-identifier">updates</span> = <span class="ruby-identifier">job</span>.<span class="ruby-identifier">progress_updates</span>.<span class="ruby-identifier">length</span>
|
511
|
-
<span class="ruby-keyword kw">end</span>
|
512
|
-
|
513
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">job</span>.<span class="ruby-identifier">completed?</span>
|
514
|
-
<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">job</span>, <span class="ruby-identifier">job</span>.<span class="ruby-identifier">completion_message</span>, <span class="ruby-identifier">job</span>.<span class="ruby-identifier">end_time</span>
|
515
|
-
<span class="ruby-keyword kw">end</span>
|
516
|
-
|
517
|
-
<span class="ruby-keyword kw">end</span>
|
518
|
-
<span class="ruby-keyword kw">end</span>
|
519
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">updates</span>
|
520
|
-
<span class="ruby-keyword kw">end</span>
|
521
|
-
</pre>
|
522
|
-
</div>
|
523
|
-
</div>
|
524
|
-
</div>
|
525
|
-
|
526
|
-
|
527
|
-
</div>
|
528
|
-
|
529
|
-
|
530
|
-
</div>
|
531
|
-
|
532
|
-
|
533
|
-
<div id="validator-badges">
|
534
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
535
|
-
</div>
|
536
|
-
|
537
|
-
</body>
|
538
|
-
</html>
|