Update version according to OSCI-883
[packages/precise/mcollective.git] / doc / MCollective / Aggregate.html
1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5 <head>
6         <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
8         <title>Class: MCollective::Aggregate</title>
9
10         <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
12         <script src="../js/jquery.js" type="text/javascript"
13                 charset="utf-8"></script>
14         <script src="../js/thickbox-compressed.js" type="text/javascript"
15                 charset="utf-8"></script>
16         <script src="../js/quicksearch.js" type="text/javascript"
17                 charset="utf-8"></script>
18         <script src="../js/darkfish.js" type="text/javascript"
19                 charset="utf-8"></script>
20
21 </head>
22 <body class="class">
23
24         <div id="metadata">
25                 <div id="file-metadata">
26                         <div id="file-list-section" class="section">
27                                 <h3 class="section-header">In Files</h3>
28                                 <div class="section-body">
29                                         <ul>
30                                         
31                                                 <li><a href="../lib/mcollective/aggregate_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
32                                                         class="thickbox" title="lib/mcollective/aggregate.rb">lib/mcollective/aggregate.rb</a></li>
33                                         
34                                                 <li><a href="../lib/mcollective/aggregate/base_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
35                                                         class="thickbox" title="lib/mcollective/aggregate/base.rb">lib/mcollective/aggregate/base.rb</a></li>
36                                         
37                                                 <li><a href="../lib/mcollective/aggregate/result/base_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38                                                         class="thickbox" title="lib/mcollective/aggregate/result/base.rb">lib/mcollective/aggregate/result/base.rb</a></li>
39                                         
40                                                 <li><a href="../lib/mcollective/aggregate/result/collection_result_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
41                                                         class="thickbox" title="lib/mcollective/aggregate/result/collection_result.rb">lib/mcollective/aggregate/result/collection_result.rb</a></li>
42                                         
43                                                 <li><a href="../lib/mcollective/aggregate/result/numeric_result_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
44                                                         class="thickbox" title="lib/mcollective/aggregate/result/numeric_result.rb">lib/mcollective/aggregate/result/numeric_result.rb</a></li>
45                                         
46                                                 <li><a href="../lib/mcollective/aggregate/result_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
47                                                         class="thickbox" title="lib/mcollective/aggregate/result.rb">lib/mcollective/aggregate/result.rb</a></li>
48                                         
49                                         </ul>
50                                 </div>
51                         </div>
52
53                         
54                 </div>
55
56                 <div id="class-metadata">
57
58                         <!-- Parent Class -->
59                         
60                         <div id="parent-class-section" class="section">
61                                 <h3 class="section-header">Parent</h3>
62                                 
63                                 <p class="link"><a href="../Object.html">Object</a></p>
64                                 
65                         </div>
66                         
67
68                         <!-- Namespace Contents -->
69                         
70                         <div id="namespace-list-section" class="section">
71                                 <h3 class="section-header">Namespace</h3>
72                                 <ul class="link-list">
73                                         
74                                         <li><span class="type">MODULE</span> <a href="Aggregate/Result.html">MCollective::Aggregate::Result</a></li>
75                                         
76                                         <li><span class="type">CLASS</span> <a href="Aggregate/Base.html">MCollective::Aggregate::Base</a></li>
77                                         
78                                 </ul>
79                         </div>
80                         
81
82                         <!-- Method Quickref -->
83                         
84                         <div id="method-list-section" class="section">
85                                 <h3 class="section-header">Methods</h3>
86                                 <ul class="link-list">
87                                         
88                                         <li><a href="#M000135">::new</a></li>
89                                         
90                                         <li><a href="#M000138">#call_functions</a></li>
91                                         
92                                         <li><a href="#M000137">#contains_output?</a></li>
93                                         
94                                         <li><a href="#M000136">#create_functions</a></li>
95                                         
96                                         <li><a href="#M000140">#load_function</a></li>
97                                         
98                                         <li><a href="#M000139">#summarize</a></li>
99                                         
100                                 </ul>
101                         </div>
102                         
103
104                         <!-- Included Modules -->
105                         
106                 </div>
107
108                 <div id="project-metadata">
109                         
110                         
111                         <div id="fileindex-section" class="section project-section">
112                                 <h3 class="section-header">Files</h3>
113                                 <ul>
114                                 
115                                         <li class="file"><a href="../COPYING.html">COPYING</a></li>
116                                 
117                                         <li class="file"><a href="../Gemfile.html">Gemfile</a></li>
118                                 
119                                         <li class="file"><a href="../README.html">README</a></li>
120                                 
121                                         <li class="file"><a href="../Rakefile.html">Rakefile</a></li>
122                                 
123                                         <li class="file"><a href="../etc/client_cfg_dist.html">client.cfg.dist</a></li>
124                                 
125                                         <li class="file"><a href="../etc/data-help_erb.html">data-help.erb</a></li>
126                                 
127                                         <li class="file"><a href="../etc/discovery-help_erb.html">discovery-help.erb</a></li>
128                                 
129                                         <li class="file"><a href="../etc/facts_yaml_dist.html">facts.yaml.dist</a></li>
130                                 
131                                         <li class="file"><a href="../etc/metadata-help_erb.html">metadata-help.erb</a></li>
132                                 
133                                         <li class="file"><a href="../etc/msg-help_erb.html">msg-help.erb</a></li>
134                                 
135                                         <li class="file"><a href="../etc/rpc-help_erb.html">rpc-help.erb</a></li>
136                                 
137                                         <li class="file"><a href="../etc/server_cfg_dist.html">server.cfg.dist</a></li>
138                                 
139                                         <li class="file"><a href="../etc/ssl/PLACEHOLDER.html">PLACEHOLDER</a></li>
140                                 
141                                         <li class="file"><a href="../etc/ssl/clients/PLACEHOLDER.html">PLACEHOLDER</a></li>
142                                 
143                                         <li class="file"><a href="../lib/mcollective/generators/templates/action_snippet_erb.html">action_snippet.erb</a></li>
144                                 
145                                         <li class="file"><a href="../lib/mcollective/generators/templates/data_input_snippet_erb.html">data_input_snippet.erb</a></li>
146                                 
147                                         <li class="file"><a href="../lib/mcollective/generators/templates/ddl_erb.html">ddl.erb</a></li>
148                                 
149                                         <li class="file"><a href="../lib/mcollective/generators/templates/plugin_erb.html">plugin.erb</a></li>
150                                 
151                                         <li class="file"><a href="../lib/mcollective/locales/en_yml.html">en.yml</a></li>
152                                 
153                                         <li class="file"><a href="../mcollective_init.html">mcollective.init</a></li>
154                                 
155                                 </ul>
156                         </div>
157                         
158
159                         <div id="classindex-section" class="section project-section">
160                                 <h3 class="section-header">Class Index
161                                         <span class="search-toggle"><img src="../images/find.png"
162                                                 height="16" width="16" alt="[+]"
163                                                 title="show/hide quicksearch" /></span></h3>
164                                 <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
165                                 <fieldset>
166                                         <legend>Quicksearch</legend>
167                                         <input type="text" name="quicksearch" value=""
168                                                 class="quicksearch-field" />
169                                 </fieldset>
170                                 </form>
171
172                                 <ul class="link-list">
173                                 
174                                         <li><a href="../MCollective.html">MCollective</a></li>
175                                 
176                                         <li><a href="../MCollective/Agent.html">MCollective::Agent</a></li>
177                                 
178                                         <li><a href="../MCollective/Agents.html">MCollective::Agents</a></li>
179                                 
180                                         <li><a href="../MCollective/Aggregate.html">MCollective::Aggregate</a></li>
181                                 
182                                         <li><a href="../MCollective/Aggregate/Base.html">MCollective::Aggregate::Base</a></li>
183                                 
184                                         <li><a href="../MCollective/Aggregate/Result.html">MCollective::Aggregate::Result</a></li>
185                                 
186                                         <li><a href="../MCollective/Aggregate/Result/Base.html">MCollective::Aggregate::Result::Base</a></li>
187                                 
188                                         <li><a href="../MCollective/Aggregate/Result/CollectionResult.html">MCollective::Aggregate::Result::CollectionResult</a></li>
189                                 
190                                         <li><a href="../MCollective/Aggregate/Result/NumericResult.html">MCollective::Aggregate::Result::NumericResult</a></li>
191                                 
192                                         <li><a href="../MCollective/Application.html">MCollective::Application</a></li>
193                                 
194                                         <li><a href="../MCollective/Applications.html">MCollective::Applications</a></li>
195                                 
196                                         <li><a href="../MCollective/Cache.html">MCollective::Cache</a></li>
197                                 
198                                         <li><a href="../MCollective/Client.html">MCollective::Client</a></li>
199                                 
200                                         <li><a href="../MCollective/CodedError.html">MCollective::CodedError</a></li>
201                                 
202                                         <li><a href="../MCollective/Config.html">MCollective::Config</a></li>
203                                 
204                                         <li><a href="../MCollective/Connector.html">MCollective::Connector</a></li>
205                                 
206                                         <li><a href="../MCollective/Connector/Base.html">MCollective::Connector::Base</a></li>
207                                 
208                                         <li><a href="../MCollective/DDL.html">MCollective::DDL</a></li>
209                                 
210                                         <li><a href="../MCollective/DDL/AgentDDL.html">MCollective::DDL::AgentDDL</a></li>
211                                 
212                                         <li><a href="../MCollective/DDL/Base.html">MCollective::DDL::Base</a></li>
213                                 
214                                         <li><a href="../MCollective/DDL/DataDDL.html">MCollective::DDL::DataDDL</a></li>
215                                 
216                                         <li><a href="../MCollective/DDL/DiscoveryDDL.html">MCollective::DDL::DiscoveryDDL</a></li>
217                                 
218                                         <li><a href="../MCollective/DDL/ValidatorDDL.html">MCollective::DDL::ValidatorDDL</a></li>
219                                 
220                                         <li><a href="../MCollective/DDLValidationError.html">MCollective::DDLValidationError</a></li>
221                                 
222                                         <li><a href="../MCollective/Data.html">MCollective::Data</a></li>
223                                 
224                                         <li><a href="../MCollective/Data/Base.html">MCollective::Data::Base</a></li>
225                                 
226                                         <li><a href="../MCollective/Data/Result.html">MCollective::Data::Result</a></li>
227                                 
228                                         <li><a href="../MCollective/Discovery.html">MCollective::Discovery</a></li>
229                                 
230                                         <li><a href="../MCollective/Facts.html">MCollective::Facts</a></li>
231                                 
232                                         <li><a href="../MCollective/Facts/Base.html">MCollective::Facts::Base</a></li>
233                                 
234                                         <li><a href="../MCollective/Generators.html">MCollective::Generators</a></li>
235                                 
236                                         <li><a href="../MCollective/Generators/AgentGenerator.html">MCollective::Generators::AgentGenerator</a></li>
237                                 
238                                         <li><a href="../MCollective/Generators/Base.html">MCollective::Generators::Base</a></li>
239                                 
240                                         <li><a href="../MCollective/Generators/DataGenerator.html">MCollective::Generators::DataGenerator</a></li>
241                                 
242                                         <li><a href="../MCollective/InvalidRPCData.html">MCollective::InvalidRPCData</a></li>
243                                 
244                                         <li><a href="../MCollective/Log.html">MCollective::Log</a></li>
245                                 
246                                         <li><a href="../MCollective/Logger.html">MCollective::Logger</a></li>
247                                 
248                                         <li><a href="../MCollective/Logger/Base.html">MCollective::Logger::Base</a></li>
249                                 
250                                         <li><a href="../MCollective/Logger/Console_logger.html">MCollective::Logger::Console_logger</a></li>
251                                 
252                                         <li><a href="../MCollective/Logger/File_logger.html">MCollective::Logger::File_logger</a></li>
253                                 
254                                         <li><a href="../MCollective/Logger/Syslog_logger.html">MCollective::Logger::Syslog_logger</a></li>
255                                 
256                                         <li><a href="../MCollective/Matcher.html">MCollective::Matcher</a></li>
257                                 
258                                         <li><a href="../MCollective/Matcher/Parser.html">MCollective::Matcher::Parser</a></li>
259                                 
260                                         <li><a href="../MCollective/Matcher/Scanner.html">MCollective::Matcher::Scanner</a></li>
261                                 
262                                         <li><a href="../MCollective/Message.html">MCollective::Message</a></li>
263                                 
264                                         <li><a href="../MCollective/MissingRPCData.html">MCollective::MissingRPCData</a></li>
265                                 
266                                         <li><a href="../MCollective/MsgDoesNotMatchRequestID.html">MCollective::MsgDoesNotMatchRequestID</a></li>
267                                 
268                                         <li><a href="../MCollective/MsgTTLExpired.html">MCollective::MsgTTLExpired</a></li>
269                                 
270                                         <li><a href="../MCollective/NotTargettedAtUs.html">MCollective::NotTargettedAtUs</a></li>
271                                 
272                                         <li><a href="../MCollective/Optionparser.html">MCollective::Optionparser</a></li>
273                                 
274                                         <li><a href="../MCollective/PluginManager.html">MCollective::PluginManager</a></li>
275                                 
276                                         <li><a href="../MCollective/PluginPackager.html">MCollective::PluginPackager</a></li>
277                                 
278                                         <li><a href="../MCollective/PluginPackager/AgentDefinition.html">MCollective::PluginPackager::AgentDefinition</a></li>
279                                 
280                                         <li><a href="../MCollective/PluginPackager/StandardDefinition.html">MCollective::PluginPackager::StandardDefinition</a></li>
281                                 
282                                         <li><a href="../MCollective/RPC.html">MCollective::RPC</a></li>
283                                 
284                                         <li><a href="../MCollective/RPC/ActionRunner.html">MCollective::RPC::ActionRunner</a></li>
285                                 
286                                         <li><a href="../MCollective/RPC/Agent.html">MCollective::RPC::Agent</a></li>
287                                 
288                                         <li><a href="../MCollective/RPC/Audit.html">MCollective::RPC::Audit</a></li>
289                                 
290                                         <li><a href="../MCollective/RPC/Client.html">MCollective::RPC::Client</a></li>
291                                 
292                                         <li><a href="../MCollective/RPC/Helpers.html">MCollective::RPC::Helpers</a></li>
293                                 
294                                         <li><a href="../MCollective/RPC/Progress.html">MCollective::RPC::Progress</a></li>
295                                 
296                                         <li><a href="../MCollective/RPC/Reply.html">MCollective::RPC::Reply</a></li>
297                                 
298                                         <li><a href="../MCollective/RPC/Request.html">MCollective::RPC::Request</a></li>
299                                 
300                                         <li><a href="../MCollective/RPC/Result.html">MCollective::RPC::Result</a></li>
301                                 
302                                         <li><a href="../MCollective/RPC/Stats.html">MCollective::RPC::Stats</a></li>
303                                 
304                                         <li><a href="../MCollective/RPCAborted.html">MCollective::RPCAborted</a></li>
305                                 
306                                         <li><a href="../MCollective/RPCError.html">MCollective::RPCError</a></li>
307                                 
308                                         <li><a href="../MCollective/Registration.html">MCollective::Registration</a></li>
309                                 
310                                         <li><a href="../MCollective/Registration/Base.html">MCollective::Registration::Base</a></li>
311                                 
312                                         <li><a href="../MCollective/Runner.html">MCollective::Runner</a></li>
313                                 
314                                         <li><a href="../MCollective/RunnerStats.html">MCollective::RunnerStats</a></li>
315                                 
316                                         <li><a href="../MCollective/SSL.html">MCollective::SSL</a></li>
317                                 
318                                         <li><a href="../MCollective/Security.html">MCollective::Security</a></li>
319                                 
320                                         <li><a href="../MCollective/Security/Base.html">MCollective::Security::Base</a></li>
321                                 
322                                         <li><a href="../MCollective/SecurityValidationFailed.html">MCollective::SecurityValidationFailed</a></li>
323                                 
324                                         <li><a href="../MCollective/Shell.html">MCollective::Shell</a></li>
325                                 
326                                         <li><a href="../MCollective/Translatable.html">MCollective::Translatable</a></li>
327                                 
328                                         <li><a href="../MCollective/UnixDaemon.html">MCollective::UnixDaemon</a></li>
329                                 
330                                         <li><a href="../MCollective/UnknownRPCAction.html">MCollective::UnknownRPCAction</a></li>
331                                 
332                                         <li><a href="../MCollective/UnknownRPCError.html">MCollective::UnknownRPCError</a></li>
333                                 
334                                         <li><a href="../MCollective/Util.html">MCollective::Util</a></li>
335                                 
336                                         <li><a href="../MCollective/Validator.html">MCollective::Validator</a></li>
337                                 
338                                         <li><a href="../MCollective/ValidatorError.html">MCollective::ValidatorError</a></li>
339                                 
340                                         <li><a href="../MCollective/WindowsDaemon.html">MCollective::WindowsDaemon</a></li>
341                                 
342                                         <li><a href="../Array.html">Array</a></li>
343                                 
344                                         <li><a href="../Dir.html">Dir</a></li>
345                                 
346                                         <li><a href="../Object.html">Object</a></li>
347                                 
348                                         <li><a href="../String.html">String</a></li>
349                                 
350                                         <li><a href="../Symbol.html">Symbol</a></li>
351                                 
352                                 </ul>
353                                 <div id="no-class-search-results" style="display: none;">No matching classes.</div>
354                         </div>
355
356                         
357                 </div>
358         </div>
359
360         <div id="documentation">
361                 <h1 class="class">MCollective::Aggregate</h1>
362
363                 <div id="description">
364                         
365                 </div>
366
367                 <!-- Constants -->
368                 
369
370                 <!-- Attributes -->
371                 
372                 <div id="attribute-method-details" class="method-section section">
373                         <h3 class="section-header">Attributes</h3>
374
375                         
376                         <div id="ddl-attribute-method" class="method-detail">
377                                 <a name="ddl"></a>
378                                 
379                                 <a name="ddl="></a>
380                                 
381                                 <div class="method-heading attribute-method-heading">
382                                         <span class="method-name">ddl</span><span
383                                                 class="attribute-access-type">[RW]</span>
384                                 </div>
385
386                                 <div class="method-description">
387                                 
388                                 <p class="missing-docs">(Not documented)</p>
389                                 
390                                 </div>
391                         </div>
392                         
393                         <div id="functions-attribute-method" class="method-detail">
394                                 <a name="functions"></a>
395                                 
396                                 <a name="functions="></a>
397                                 
398                                 <div class="method-heading attribute-method-heading">
399                                         <span class="method-name">functions</span><span
400                                                 class="attribute-access-type">[RW]</span>
401                                 </div>
402
403                                 <div class="method-description">
404                                 
405                                 <p class="missing-docs">(Not documented)</p>
406                                 
407                                 </div>
408                         </div>
409                         
410                         <div id="action-attribute-method" class="method-detail">
411                                 <a name="action"></a>
412                                 
413                                 <a name="action="></a>
414                                 
415                                 <div class="method-heading attribute-method-heading">
416                                         <span class="method-name">action</span><span
417                                                 class="attribute-access-type">[RW]</span>
418                                 </div>
419
420                                 <div class="method-description">
421                                 
422                                 <p class="missing-docs">(Not documented)</p>
423                                 
424                                 </div>
425                         </div>
426                         
427                         <div id="failed-attribute-method" class="method-detail">
428                                 <a name="failed"></a>
429                                 
430                                 <a name="failed="></a>
431                                 
432                                 <div class="method-heading attribute-method-heading">
433                                         <span class="method-name">failed</span><span
434                                                 class="attribute-access-type">[RW]</span>
435                                 </div>
436
437                                 <div class="method-description">
438                                 
439                                 <p class="missing-docs">(Not documented)</p>
440                                 
441                                 </div>
442                         </div>
443                         
444                 </div>
445                 
446
447                 <!-- Methods -->
448                 
449                 <div id="public-class-method-details" class="method-section section">
450                         <h3 class="section-header">Public Class Methods</h3>
451
452                 
453                         <div id="new-method" class="method-detail ">
454                                 <a name="M000135"></a>
455
456                                 <div class="method-heading">
457                                 
458                                         <span class="method-name">new</span><span
459                                                 class="method-args">(ddl)</span>
460                                         <span class="method-click-advice">click to toggle source</span>
461                                 
462                                 </div>
463
464                                 <div class="method-description">
465                                         
466                                         <p class="missing-docs">(Not documented)</p>
467                                         
468
469                                         
470                                         <div class="method-source-code"
471                                                 id="new-source">
472 <pre>
473     <span class="ruby-comment cmt"># File lib/mcollective/aggregate.rb, line 8</span>
474  8:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">ddl</span>)
475  9:       <span class="ruby-ivar">@functions</span> = []
476 10:       <span class="ruby-ivar">@ddl</span> = <span class="ruby-identifier">ddl</span>
477 11:       <span class="ruby-ivar">@action</span> = <span class="ruby-identifier">ddl</span>[<span class="ruby-identifier">:action</span>]
478 12:       <span class="ruby-ivar">@failed</span> = []
479 13: 
480 14:       <span class="ruby-identifier">create_functions</span>
481 15:     <span class="ruby-keyword kw">end</span></pre>
482                                         </div>
483                                         
484                                 </div>
485
486                                 
487                         </div>
488
489                 
490                 </div>
491         
492                 <div id="public-instance-method-details" class="method-section section">
493                         <h3 class="section-header">Public Instance Methods</h3>
494
495                 
496                         <div id="call-functions-method" class="method-detail ">
497                                 <a name="M000138"></a>
498
499                                 <div class="method-heading">
500                                 
501                                         <span class="method-name">call_functions</span><span
502                                                 class="method-args">(reply)</span>
503                                         <span class="method-click-advice">click to toggle source</span>
504                                 
505                                 </div>
506
507                                 <div class="method-description">
508                                         
509                                         <p>
510 Call all the appropriate functions with the reply data received from <a
511 href="RPC/Client.html">RPC::Client</a>
512 </p>
513                                         
514
515                                         
516                                         <div class="method-source-code"
517                                                 id="call-functions-source">
518 <pre>
519     <span class="ruby-comment cmt"># File lib/mcollective/aggregate.rb, line 45</span>
520 45:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call_functions</span>(<span class="ruby-identifier">reply</span>)
521 46:       <span class="ruby-ivar">@functions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">function</span><span class="ruby-operator">|</span>
522 47:         <span class="ruby-constant">Log</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">&quot;Calling aggregate function #{function} for result&quot;</span>)
523 48:         <span class="ruby-keyword kw">begin</span>
524 49:           <span class="ruby-identifier">function</span>.<span class="ruby-identifier">process_result</span>(<span class="ruby-identifier">reply</span>[<span class="ruby-identifier">:data</span>][<span class="ruby-identifier">function</span>.<span class="ruby-identifier">output_name</span>], <span class="ruby-identifier">reply</span>)
525 50:         <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
526 51:           <span class="ruby-constant">Log</span>.<span class="ruby-identifier">error</span>(<span class="ruby-node">&quot;Could not process aggregate function for '#{function.output_name}'. #{e.to_s}&quot;</span>)
527 52:           <span class="ruby-ivar">@failed</span> <span class="ruby-operator">&lt;&lt;</span> {<span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">function</span>.<span class="ruby-identifier">output_name</span>, <span class="ruby-identifier">:type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:process_result</span>}
528 53:           <span class="ruby-ivar">@functions</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">function</span>)
529 54:         <span class="ruby-keyword kw">end</span>
530 55:       <span class="ruby-keyword kw">end</span>
531 56:     <span class="ruby-keyword kw">end</span></pre>
532                                         </div>
533                                         
534                                 </div>
535
536                                 
537                         </div>
538
539                 
540                         <div id="contains-output--method" class="method-detail ">
541                                 <a name="M000137"></a>
542
543                                 <div class="method-heading">
544                                 
545                                         <span class="method-name">contains_output?</span><span
546                                                 class="method-args">(output)</span>
547                                         <span class="method-click-advice">click to toggle source</span>
548                                 
549                                 </div>
550
551                                 <div class="method-description">
552                                         
553                                         <p>
554 Check if the function param is defined as an output for the action in the
555 ddl
556 </p>
557                                         
558
559                                         
560                                         <div class="method-source-code"
561                                                 id="contains-output--source">
562 <pre>
563     <span class="ruby-comment cmt"># File lib/mcollective/aggregate.rb, line 40</span>
564 40:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">contains_output?</span>(<span class="ruby-identifier">output</span>)
565 41:       <span class="ruby-ivar">@ddl</span>[<span class="ruby-identifier">:output</span>].<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">output</span>)
566 42:     <span class="ruby-keyword kw">end</span></pre>
567                                         </div>
568                                         
569                                 </div>
570
571                                 
572                         </div>
573
574                 
575                         <div id="create-functions-method" class="method-detail ">
576                                 <a name="M000136"></a>
577
578                                 <div class="method-heading">
579                                 
580                                         <span class="method-name">create_functions</span><span
581                                                 class="method-args">()</span>
582                                         <span class="method-click-advice">click to toggle source</span>
583                                 
584                                 </div>
585
586                                 <div class="method-description">
587                                         
588                                         <p>
589 Creates instances of the <a href="Aggregate.html">Aggregate</a> functions
590 and stores them in the function array. All aggregate call and summarize
591 method calls operate on these function as a batch.
592 </p>
593                                         
594
595                                         
596                                         <div class="method-source-code"
597                                                 id="create-functions-source">
598 <pre>
599     <span class="ruby-comment cmt"># File lib/mcollective/aggregate.rb, line 19</span>
600 19:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_functions</span>
601 20:       <span class="ruby-ivar">@ddl</span>[<span class="ruby-identifier">:aggregate</span>].<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">agg</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
602 21:         <span class="ruby-identifier">output</span> = <span class="ruby-identifier">agg</span>[<span class="ruby-identifier">:args</span>][<span class="ruby-value">0</span>]
603 22: 
604 23:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">contains_output?</span>(<span class="ruby-identifier">output</span>)
605 24:           <span class="ruby-identifier">arguments</span> = <span class="ruby-identifier">agg</span>[<span class="ruby-identifier">:args</span>][<span class="ruby-value">1</span>]
606 25:           <span class="ruby-identifier">format</span> = (<span class="ruby-identifier">arguments</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:format</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arguments</span>) <span class="ruby-operator">||</span> <span class="ruby-keyword kw">nil</span>
607 26:           <span class="ruby-keyword kw">begin</span>
608 27:             <span class="ruby-ivar">@functions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">load_function</span>(<span class="ruby-identifier">agg</span>[<span class="ruby-identifier">:function</span>]).<span class="ruby-identifier">new</span>(<span class="ruby-identifier">output</span>, <span class="ruby-identifier">arguments</span>, <span class="ruby-identifier">format</span>, <span class="ruby-ivar">@action</span>)
609 28:           <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
610 29:             <span class="ruby-constant">Log</span>.<span class="ruby-identifier">error</span>(<span class="ruby-node">&quot;Cannot create aggregate function '#{output}'. #{e.to_s}&quot;</span>)
611 30:             <span class="ruby-ivar">@failed</span> <span class="ruby-operator">&lt;&lt;</span> {<span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">output</span>, <span class="ruby-identifier">:type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:startup</span>}
612 31:           <span class="ruby-keyword kw">end</span>
613 32:         <span class="ruby-keyword kw">else</span>
614 33:           <span class="ruby-constant">Log</span>.<span class="ruby-identifier">error</span>(<span class="ruby-node">&quot;Cannot create aggregate function '#{output}'. '#{output}' has not been specified as a valid ddl output.&quot;</span>)
615 34:           <span class="ruby-ivar">@failed</span> <span class="ruby-operator">&lt;&lt;</span> {<span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">output</span>, <span class="ruby-identifier">:type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:create</span>}
616 35:         <span class="ruby-keyword kw">end</span>
617 36:       <span class="ruby-keyword kw">end</span>
618 37:     <span class="ruby-keyword kw">end</span></pre>
619                                         </div>
620                                         
621                                 </div>
622
623                                 
624                         </div>
625
626                 
627                         <div id="load-function-method" class="method-detail ">
628                                 <a name="M000140"></a>
629
630                                 <div class="method-heading">
631                                 
632                                         <span class="method-name">load_function</span><span
633                                                 class="method-args">(function_name)</span>
634                                         <span class="method-click-advice">click to toggle source</span>
635                                 
636                                 </div>
637
638                                 <div class="method-description">
639                                         
640                                         <p>
641 Loads function from disk for use
642 </p>
643                                         
644
645                                         
646                                         <div class="method-source-code"
647                                                 id="load-function-source">
648 <pre>
649     <span class="ruby-comment cmt"># File lib/mcollective/aggregate.rb, line 76</span>
650 76:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_function</span>(<span class="ruby-identifier">function_name</span>)
651 77:       <span class="ruby-identifier">function_name</span> = <span class="ruby-identifier">function_name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">capitalize</span>
652 78: 
653 79:       <span class="ruby-constant">PluginManager</span>.<span class="ruby-identifier">loadclass</span>(<span class="ruby-node">&quot;MCollective::Aggregate::#{function_name}&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">Aggregate</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-identifier">function_name</span>)
654 80:       <span class="ruby-constant">Aggregate</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">function_name</span>)
655 81:     <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
656 82:       <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Aggregate function file '#{function_name.downcase}.rb' cannot be loaded&quot;</span>
657 83:     <span class="ruby-keyword kw">end</span></pre>
658                                         </div>
659                                         
660                                 </div>
661
662                                 
663                         </div>
664
665                 
666                         <div id="summarize-method" class="method-detail ">
667                                 <a name="M000139"></a>
668
669                                 <div class="method-heading">
670                                 
671                                         <span class="method-name">summarize</span><span
672                                                 class="method-args">()</span>
673                                         <span class="method-click-advice">click to toggle source</span>
674                                 
675                                 </div>
676
677                                 <div class="method-description">
678                                         
679                                         <p>
680 Finalizes the function returning a result object
681 </p>
682                                         
683
684                                         
685                                         <div class="method-source-code"
686                                                 id="summarize-source">
687 <pre>
688     <span class="ruby-comment cmt"># File lib/mcollective/aggregate.rb, line 59</span>
689 59:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">summarize</span>
690 60:       <span class="ruby-identifier">summary</span> = <span class="ruby-ivar">@functions</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">function</span><span class="ruby-operator">|</span>
691 61:         <span class="ruby-keyword kw">begin</span>
692 62:           <span class="ruby-identifier">function</span>.<span class="ruby-identifier">summarize</span>
693 63:         <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
694 64:           <span class="ruby-constant">Log</span>.<span class="ruby-identifier">error</span>(<span class="ruby-node">&quot;Could not summarize aggregate result for '#{function.output_name}'. #{e.to_s}&quot;</span>)
695 65:           <span class="ruby-ivar">@failed</span> <span class="ruby-operator">&lt;&lt;</span> {<span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">function</span>.<span class="ruby-identifier">output_name</span>, <span class="ruby-identifier">:type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:summarize</span>}
696 66:           <span class="ruby-keyword kw">nil</span>
697 67:         <span class="ruby-keyword kw">end</span>
698 68:       <span class="ruby-keyword kw">end</span>
699 69: 
700 70:       <span class="ruby-identifier">summary</span>.<span class="ruby-identifier">reject</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">nil?</span>}.<span class="ruby-identifier">sort</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span><span class="ruby-operator">|</span>
701 71:         <span class="ruby-identifier">x</span>.<span class="ruby-identifier">result</span>[<span class="ruby-identifier">:output</span>] <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">y</span>.<span class="ruby-identifier">result</span>[<span class="ruby-identifier">:output</span>]
702 72:       <span class="ruby-keyword kw">end</span>
703 73:     <span class="ruby-keyword kw">end</span></pre>
704                                         </div>
705                                         
706                                 </div>
707
708                                 
709                         </div>
710
711                 
712                 </div>
713         
714
715         </div>
716
717
718         <div id="rdoc-debugging-section-dump" class="debugging-section">
719         
720                 <p>Disabled; run with --debug to generate this.</p>
721         
722         </div>
723
724         <div id="validator-badges">
725                 <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
726                 <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
727                         Rdoc Generator</a> 1.1.6</small>.</p>
728         </div>
729
730 </body>
731 </html>
732