<?php /** * Script to test * * @author Toon Schoenmakers <*****@*****.**> * @copyright 2015 Copernica BV * @documentation private */ /** * Dependencies */ require_once 'Task.php'; // Create an instance of the WordCount algorithm $test = new Task("Input"); // create the connection $master = new Yothalot\Connection(array("host" => "localhost", "vhost" => "gluster")); // create the new job $job = new Yothalot\Job($master, $test); // start the job and wait for the result $result = $job->wait(); // simply var_dump the result var_dump($result->result());
$sub3 = new Yothalot\Job($connection, $linecount3); /** * Assign a job an input */ function assign($job, $path) { $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST); foreach ($objects as $name => $object) { // add the jobs with an empty key, all to singular files $job->add("", $object->getPathName()); } } // assign all subjobs the input assign($sub1, getcwd()); assign($sub2, getcwd()); assign($sub3, getcwd()); /** * We wait for all the jobs. In the real case you'd probably want to make * sure that everything went as planned, but we don't do that here */ $sub1->wait(); $sub2->wait(); $sub3->wait(); /** * Now start the final job */ $job->wait(); /** * Show the found words */ echo file_get_contents($path->absolute());