MCPcopy Index your code
hub / github.com/node-js-libs/node.io / onload

Function onload

lib/node.io/processor.js:73–105  ·  view source on GitHub ↗
(job_name, job_obj)

Source from the content-addressed store, hash-verified

71
72 //Callback for once we've loaded the job
73 var onload = function (job_name, job_obj) {
74
75 //If we're capturing output, we need to explicitly override job.output()
76 if (isMaster && capture_output) {
77 var output = [];
78 job_obj.output = function (out) {
79 if (out instanceof Array && job_obj.options.flatten) {
80 for (var i = 0, l = out.length; i < l; i++) {
81 output.push(out[i]);
82 }
83 } else {
84 output.push(out);
85 }
86 };
87 var old_callback = callback;
88 callback = function (err) {
89 old_callback(err, output);
90 };
91 }
92
93 //Are we distributing work?
94 fork = job_obj.options.fork;
95
96 //Initialise the processor
97 processor.init(function () {
98
99 //Start the job
100 if (isMaster) {
101 processor.startJob(job_name, job_obj, callback);
102 }
103
104 });
105 };
106
107 //Load the job
108 processor.loadJob(job, options, function (err, job_name, job_obj) {

Callers 1

processor.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected