/** * We want to send this WordCount instance to the Yothalot connection. To do this, * we need an instance of the connection to Yothalot. * * (Under the hood, you do not connect with the Yothalot master process, but to * a RabbitMQ message queue, the login details are therefore the RabbitMQ * details) * * @var Yothalot\Connect */ $connection = new Yothalot\Connection(); /** * Create the merging job * @var Job */ $job = new Yothalot\Job($connection, $merger); /** * Create an instance of the WordCount algorithm * @var WordCount */ $linecount1 = new KvChainedLineCount($job->directory() . "/tmp1.out"); $linecount2 = new KvChainedLineCount($job->directory() . "/tmp2.out"); $linecount3 = new KvChainedLineCount($job->directory() . "/tmp3.out"); /** * Start several subjobs * @var Job */ $sub1 = new Yothalot\Job($connection, $linecount1); $sub2 = new Yothalot\Job($connection, $linecount2); $sub3 = new Yothalot\Job($connection, $linecount3); /**
<?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());
/** * Script to test * * @author Toon Schoenmakers <*****@*****.**> * @copyright 2015 Copernica BV * @documentation private */ /** * Dependencies */ require_once 'Race.php'; // Create an instance of the WordCount algorithm $test = new MyRace("test"); // create the connection $master = new Yothalot\Connection(); // create the new job $job = new Yothalot\Job($master, $test); // add some data.. $job->add(1); $job->add("2"); for ($i = 4; $i < 1124; $i++) { $job->add($i); } $job->add(3); // start the job $job->start(); // start the job and wait for the result $result = $job->wait(); // simply var_dump the result var_dump($result->result());