pho 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/CHANGES +6 -0
  2. data/README +9 -1
  3. data/Rakefile +1 -1
  4. data/doc/index.html +3 -1
  5. data/doc/rdoc/classes/Pho/Analyzers.html +310 -0
  6. data/doc/rdoc/classes/Pho/CommandLine.html +770 -0
  7. data/doc/rdoc/classes/Pho/DatatypeProperty.html +241 -0
  8. data/doc/rdoc/classes/Pho/Enrichment/StoreEnricher.html +410 -0
  9. data/doc/rdoc/classes/Pho/Enrichment.html +119 -0
  10. data/doc/rdoc/classes/Pho/Etags.html +310 -0
  11. data/doc/rdoc/classes/Pho/Facet/Results.html +299 -0
  12. data/doc/rdoc/classes/Pho/Facet/Term.html +177 -0
  13. data/doc/rdoc/classes/Pho/Facet.html +119 -0
  14. data/doc/rdoc/classes/Pho/FieldPredicateMap.html +695 -0
  15. data/doc/rdoc/classes/Pho/FieldWeighting.html +230 -0
  16. data/doc/rdoc/classes/Pho/FileManagement/AbstractFileManager.html +478 -0
  17. data/doc/rdoc/classes/Pho/FileManagement/FileManager.html +264 -0
  18. data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +259 -0
  19. data/doc/rdoc/classes/Pho/FileManagement.html +121 -0
  20. data/doc/rdoc/classes/Pho/Job.html +627 -0
  21. data/doc/rdoc/classes/Pho/JobUpdate.html +141 -0
  22. data/doc/rdoc/classes/Pho/Jobs.html +538 -0
  23. data/doc/rdoc/classes/Pho/Namespaces.html +164 -0
  24. data/doc/rdoc/classes/Pho/OAI/Record.html +165 -0
  25. data/doc/rdoc/classes/Pho/OAI/Records.html +331 -0
  26. data/doc/rdoc/classes/Pho/OAI.html +118 -0
  27. data/doc/rdoc/classes/Pho/QueryProfile.html +524 -0
  28. data/doc/rdoc/classes/Pho/RDF/Parser.html +279 -0
  29. data/doc/rdoc/classes/Pho/RDF.html +120 -0
  30. data/doc/rdoc/classes/Pho/RDFCollection.html +119 -0
  31. data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +325 -0
  32. data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +241 -0
  33. data/doc/rdoc/classes/Pho/ResourceHash.html +123 -0
  34. data/doc/rdoc/classes/Pho/Snapshot.html +402 -0
  35. data/doc/rdoc/classes/Pho/Sparql/SparqlClient.html +594 -0
  36. data/doc/rdoc/classes/Pho/Sparql/SparqlHelper.html +696 -0
  37. data/doc/rdoc/classes/Pho/Sparql.html +187 -0
  38. data/doc/rdoc/classes/Pho/Status.html +296 -0
  39. data/doc/rdoc/classes/Pho/Store.html +1569 -0
  40. data/doc/rdoc/classes/Pho/StoreSparqlClient.html +183 -0
  41. data/doc/rdoc/classes/Pho/Update/Changeset.html +521 -0
  42. data/doc/rdoc/classes/Pho/Update/ChangesetBuilder.html +330 -0
  43. data/doc/rdoc/classes/Pho/Update/ChangesetHelper.html +159 -0
  44. data/doc/rdoc/classes/Pho/Update/Changesets.html +205 -0
  45. data/doc/rdoc/classes/Pho/Update/LiteralStatement.html +257 -0
  46. data/doc/rdoc/classes/Pho/Update/ResourceStatement.html +237 -0
  47. data/doc/rdoc/classes/Pho/Update/Statement.html +303 -0
  48. data/doc/rdoc/classes/Pho/Update.html +128 -0
  49. data/doc/rdoc/classes/Pho.html +283 -0
  50. data/doc/rdoc/classes/String.html +146 -0
  51. data/doc/rdoc/created.rid +1 -0
  52. data/doc/rdoc/files/CHANGES.html +373 -0
  53. data/doc/rdoc/files/README.html +204 -0
  54. data/doc/rdoc/files/lib/pho/changeset_builder_rb.html +108 -0
  55. data/doc/rdoc/files/lib/pho/changeset_rb.html +108 -0
  56. data/doc/rdoc/files/lib/pho/command_line_rb.html +101 -0
  57. data/doc/rdoc/files/lib/pho/converter_rb.html +108 -0
  58. data/doc/rdoc/files/lib/pho/enrichment_rb.html +101 -0
  59. data/doc/rdoc/files/lib/pho/etags_rb.html +108 -0
  60. data/doc/rdoc/files/lib/pho/facet_rb.html +101 -0
  61. data/doc/rdoc/files/lib/pho/field_predicate_map_rb.html +101 -0
  62. data/doc/rdoc/files/lib/pho/file_management_rb.html +101 -0
  63. data/doc/rdoc/files/lib/pho/file_manager_rb.html +108 -0
  64. data/doc/rdoc/files/lib/pho/job_rb.html +101 -0
  65. data/doc/rdoc/files/lib/pho/oai_rb.html +101 -0
  66. data/doc/rdoc/files/lib/pho/query_profile_rb.html +101 -0
  67. data/doc/rdoc/files/lib/pho/rdf_collection_rb.html +101 -0
  68. data/doc/rdoc/files/lib/pho/rdf_rb.html +108 -0
  69. data/doc/rdoc/files/lib/pho/resource_hash_rb.html +101 -0
  70. data/doc/rdoc/files/lib/pho/snapshot_rb.html +109 -0
  71. data/doc/rdoc/files/lib/pho/sparql_rb.html +101 -0
  72. data/doc/rdoc/files/lib/pho/status_rb.html +101 -0
  73. data/doc/rdoc/files/lib/pho/store_rb.html +108 -0
  74. data/doc/rdoc/files/lib/pho_rb.html +133 -0
  75. data/doc/rdoc/fr_class_index.html +72 -0
  76. data/doc/rdoc/fr_file_index.html +49 -0
  77. data/doc/rdoc/fr_method_index.html +239 -0
  78. data/doc/rdoc/index.html +24 -0
  79. data/doc/rdoc/rdoc-style.css +208 -0
  80. data/lib/pho/enrichment.rb +1 -0
  81. data/lib/pho/field_predicate_map.rb +5 -0
  82. data/lib/pho/query_profile.rb +5 -0
  83. data/lib/pho/store.rb +4 -1
  84. data/tests/tc_field_predicate_map.rb +7 -1
  85. data/tests/tc_query_profile.rb +6 -0
  86. data/tests/tc_store_util.rb +7 -0
  87. metadata +134 -21
@@ -0,0 +1,538 @@
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="#M000149">build_job_request</a>&nbsp;&nbsp;
96
+ <a href="#M000143">read_from_store</a>&nbsp;&nbsp;
97
+ <a href="#M000148">submit_job</a>&nbsp;&nbsp;
98
+ <a href="#M000145">submit_reindex</a>&nbsp;&nbsp;
99
+ <a href="#M000144">submit_reset</a>&nbsp;&nbsp;
100
+ <a href="#M000147">submit_restore</a>&nbsp;&nbsp;
101
+ <a href="#M000146">submit_snapshot</a>&nbsp;&nbsp;
102
+ <a href="#M000151">wait_for</a>&nbsp;&nbsp;
103
+ <a href="#M000150">wait_for_submitted</a>&nbsp;&nbsp;
104
+ <a href="#M000152">yield_job_update</a>&nbsp;&nbsp;
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">&quot;http://schemas.talis.com/2006/bigfoot/configuration#ResetDataJob&quot;.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">&quot;http://schemas.talis.com/2006/bigfoot/configuration#SnapshotJob&quot;.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">&quot;http://schemas.talis.com/2006/bigfoot/configuration#ReindexJob&quot;.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">&quot;http://schemas.talis.com/2006/bigfoot/configuration#RestoreJob&quot;.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-M000149" class="method-detail">
155
+ <a name="M000149"></a>
156
+
157
+ <div class="method-heading">
158
+ <a href="#M000149" 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('M000149-source');return false;">[Source]</a></p>
176
+ <div class="method-source-code" id="M000149-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">&quot;%Y-%m-%dT%H:%M:%SZ&quot;</span>)
182
+ <span class="ruby-identifier">data</span> = <span class="ruby-value str">&quot;&lt;rdf:RDF xmlns:rdf=\&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#\&quot; &quot;</span>
183
+ <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; xmlns:rdfs=\&quot;http://www.w3.org/2000/01/rdf-schema#\&quot; &quot;</span>
184
+ <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; xmlns:bf=\&quot;http://schemas.talis.com/2006/bigfoot/configuration#\&quot;&gt; &quot;</span>
185
+ <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &lt;bf:JobRequest&gt;&quot;</span>
186
+ <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; &lt;rdfs:label&gt;#{label}&lt;/rdfs:label&gt;&quot;</span>
187
+ <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; &lt;bf:jobType rdf:resource=\&quot;#{type}\&quot;/&gt;&quot;</span>
188
+ <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; &lt;bf:startTime&gt;#{time}&lt;/bf:startTime&gt;&quot;</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">&lt;&lt;</span> <span class="ruby-node">&quot; &lt;bf:snapshotUri rdf:resource=\&quot;#{snapshot_uri}\&quot;/&gt;&quot;</span>
192
+ <span class="ruby-keyword kw">end</span>
193
+
194
+ <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &lt;/bf:JobRequest&gt;&quot;</span>
195
+ <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;&lt;/rdf:RDF&gt;&quot;</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-M000143" class="method-detail">
204
+ <a name="M000143"></a>
205
+
206
+ <div class="method-heading">
207
+ <a href="#M000143" 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('M000143-source');return false;">[Source]</a></p>
222
+ <div class="method-source-code" id="M000143-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">&quot;Unable to read jobs from store. Status was {resp.status}&quot;</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">&quot;//bf:job&quot;</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">&lt;&lt;</span> <span class="ruby-identifier">el</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;rdf:resource&quot;</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-M000148" class="method-detail">
245
+ <a name="M000148"></a>
246
+
247
+ <div class="method-heading">
248
+ <a href="#M000148" 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('M000148-source');return false;">[Source]</a></p>
259
+ <div class="method-source-code" id="M000148-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-M000145" class="method-detail">
271
+ <a name="M000145"></a>
272
+
273
+ <div class="method-heading">
274
+ <a href="#M000145" class="method-signature">
275
+ <span class="method-name">submit_reindex</span><span class="method-args">(store, label=&quot;Reindex my store&quot;, 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('M000145-source');return false;">[Source]</a></p>
292
+ <div class="method-source-code" id="M000145-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">&quot;Reindex my store&quot;</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-M000144" class="method-detail">
304
+ <a name="M000144"></a>
305
+
306
+ <div class="method-heading">
307
+ <a href="#M000144" class="method-signature">
308
+ <span class="method-name">submit_reset</span><span class="method-args">(store, label=&quot;Reset my store&quot;, 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('M000144-source');return false;">[Source]</a></p>
325
+ <div class="method-source-code" id="M000144-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">&quot;Reset my store&quot;</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-M000147" class="method-detail">
337
+ <a name="M000147"></a>
338
+
339
+ <div class="method-heading">
340
+ <a href="#M000147" class="method-signature">
341
+ <span class="method-name">submit_restore</span><span class="method-args">(store, snapshot_uri, label=&quot;Restore my snapshot&quot;, 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('M000147-source');return false;">[Source]</a></p>
358
+ <div class="method-source-code" id="M000147-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">&quot;Restore my snapshot&quot;</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-M000146" class="method-detail">
370
+ <a name="M000146"></a>
371
+
372
+ <div class="method-heading">
373
+ <a href="#M000146" class="method-signature">
374
+ <span class="method-name">submit_snapshot</span><span class="method-args">(store, label=&quot;Snapshot my store&quot;, 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('M000146-source');return false;">[Source]</a></p>
391
+ <div class="method-source-code" id="M000146-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">&quot;Snapshot my store&quot;</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-M000151" class="method-detail">
403
+ <a name="M000151"></a>
404
+
405
+ <div class="method-heading">
406
+ <a href="#M000151" class="method-signature">
407
+ <span class="method-name">wait_for</span><span class="method-args">(uri, store, interval=1, &amp;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('M000151-source');return false;">[Source]</a></p>
430
+ <div class="method-source-code" id="M000151-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">&amp;</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">&amp;</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">&amp;</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-M000150" class="method-detail">
450
+ <a name="M000150"></a>
451
+
452
+ <div class="method-heading">
453
+ <a href="#M000150" class="method-signature">
454
+ <span class="method-name">wait_for_submitted</span><span class="method-args">(resp, store, interval=1, &amp;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('M000150-source');return false;">[Source]</a></p>
464
+ <div class="method-source-code" id="M000150-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">&amp;</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">&quot;Unable to wait, job was not created. Status was #{resp.status}&quot;</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">&quot;Location&quot;</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">&amp;</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-M000152" class="method-detail">
482
+ <a name="M000152"></a>
483
+
484
+ <div class="method-heading">
485
+ <a href="#M000152" 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('M000152-source');return false;">[Source]</a></p>
493
+ <div class="method-source-code" id="M000152-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">&gt;</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>