Skip to content

Commit

Permalink
Fix issue with getting the correct algorithm for serialized objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Aljar committed Jul 8, 2016
1 parent 6bf217a commit 91b2ea6
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion data.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,19 @@ class Data : public JSON::Object, private TupleHelper
*/
Data(const JSON::Object &object) :
JSON::Object(object),
_input(object.array("input")) {}
_input(object.array("input"))
{
// Check if we are a mapreduce, race or regular task
// if we contain mapper information we are a map reduce algorithm
if (contains("mapper") && contains("reducer") && contains("finalizer")) _algorithm = Algorithm::mapreduce;

// if we are not a map reduce algorithm but have input we are a race algorithm
else if (contains("input")) _algorithm = Algorithm::race;

// if we are neither a mapreduce nor a race algorithm we are
// a regular task
else _algorithm = Algorithm::job;
}

/**
* Destructor
Expand Down

0 comments on commit 91b2ea6

Please sign in to comment.