Skip to content

Commit

Permalink
Should fully work again now, the directory was improperly transferred…
Browse files Browse the repository at this point in the history
… earlier. Tried and tested again, and removed the old results from the tests.
  • Loading branch information
mvdwerve committed Jan 17, 2016
1 parent 551cbf6 commit 010876f
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 31 deletions.
2 changes: 1 addition & 1 deletion data.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ class Data : public JSON::Object, private TupleHelper
JSON::Object object;

// set the dirname
object.set("dirname", dirname);
object.set("directory", dirname);

// set whether or not to remove
object.set("remove", remove);
Expand Down
2 changes: 1 addition & 1 deletion init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ Php::Value yothalotInit(Php::Parameters &params)
if (strcasecmp(params[0].rawValue(), "run") == 0) result = run(input);

// check the type of task to run that is part of the mapreduce algorithm
if (strcasecmp(params[0].rawValue(), "kvmapper") == 0) result = kvmap(input);
if (strcasecmp(params[0].rawValue(), "kvmapper") == 0) result = kvmap(input);
else if (strcasecmp(params[0].rawValue(), "mapper") == 0) result = map(input);
else if (strcasecmp(params[0].rawValue(), "reducer") == 0) result = reduce(input);
else if (strcasecmp(params[0].rawValue(), "finalizer") == 0) result = write(input);
Expand Down
1 change: 1 addition & 0 deletions tests/WordCount.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public function reduce($key, Yothalot\Values $values, Yothalot\Writer $writer)
*/
public function write($key, $value)
{
// if we've not added the file yet
if (!$this->file)
{
// the output file is stored on the gluster
Expand Down
29 changes: 14 additions & 15 deletions tests/test.kvlinecount.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,25 @@
require_once('KvLineCount.php');

/**
* The output file on the gluster
* @var string
* The WordCount class wrote its output to a file on the distributed file
* system. To find out what the absolute path name of this file is on this
* machine, we make use of the Yothalot\Path class to turn the relative name
* into an absolute path (GlusterFS must be mounted on this machine)
*
* @var Yothalot\Path
*/
$path = new Yothalot\Path("linecount-results-kv.txt");

/**
* Unlink the result upon start, to make sure that we don't display the previous result.
*/
$output = "linecount-results.txt";
unlink($path->absolute());

/**
* Create an instance of the WordCount algorithm
* @var WordCount
*/
$wordcount = new KvLineCount($output);
$wordcount = new KvLineCount($path->relative());

/**
* We want to send this WordCount instance to the Yothalot master. To do this,
Expand Down Expand Up @@ -61,17 +70,7 @@ function assign($job, $path)
/**
* Wait for the result of the map reduce job
*/
$job->wait();

/**
* The WordCount class wrote its output to a file on the distributed file
* system. To find out what the absolute path name of this file is on this
* machine, we make use of the Yothalot\Path class to turn the relative name
* into an absolute path (GlusterFS must be mounted on this machine)
*
* @var Yothalot\Path
*/
$path = new Yothalot\Path($output);
$result = $job->wait();

/**
* Show the found words
Expand Down
28 changes: 14 additions & 14 deletions tests/test.linecount.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,26 @@
require_once('LineCount.php');

/**
* The output file on the gluster
* @var string
* The WordCount class wrote its output to a file on the distributed file
* system. To find out what the absolute path name of this file is on this
* machine, we make use of the Yothalot\Path class to turn the relative name
* into an absolute path (GlusterFS must be mounted on this machine)
*
* @var Yothalot\Path
*/
$path = new Yothalot\Path("linecount-results.txt");


/**
* Unlink the result upon start, to make sure that we don't display the previous result.
*/
$output = "linecount-results.txt";
unlink($path->absolute());

/**
* Create an instance of the WordCount algorithm
* @var WordCount
*/
$wordcount = new LineCount($output);
$wordcount = new LineCount($path->relative());

/**
* We want to send this WordCount instance to the Yothalot master. To do this,
Expand Down Expand Up @@ -75,16 +85,6 @@ function assign($job, $path)
*/
$job->wait();

/**
* The WordCount class wrote its output to a file on the distributed file
* system. To find out what the absolute path name of this file is on this
* machine, we make use of the Yothalot\Path class to turn the relative name
* into an absolute path (GlusterFS must be mounted on this machine)
*
* @var Yothalot\Path
*/
$path = new Yothalot\Path($output);

/**
* Show the found words
*/
Expand Down
5 changes: 5 additions & 0 deletions tests/test.wordcount.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
*/
$path = new Yothalot\Path("wordcount-results.txt");

/**
* Unlink the result upon start, to make sure that we don't display the previous result.
*/
unlink($path->absolute());

/**
* Create an instance of the WordCount algorithm
* @var WordCount
Expand Down

0 comments on commit 010876f

Please sign in to comment.