1 #include "Forwarder.hpp"
\r
2 #include "BasicTask.hpp"
\r
3 #include "FinalizeTask.hpp"
\r
5 #include <HostNotFoundException.hpp>
\r
9 MSG_IMPLEMENT_DYNAMIC(Forwarder, Process);
\r
12 int Forwarder::main(int argc, char** argv)
\r
16 int slavesCount = argc;
\r
18 Host* slaves = new Host[slavesCount];
\r
20 for (int i = 0; i < argc; i++)
\r
24 slaves[i] = Host::getByName(argv[i]);
\r
26 catch (HostNotFoundException e)
\r
28 error(TEXT_(e.toString()));
\r
29 error("Buggy deployment file");
\r
38 Task* t = Task::get(0);
\r
40 if(t->isInstanceOf("FinalizeTask"))
\r
42 info("All tasks have been dispatched. Let's tell everybody the computation is over.");
\r
44 for (int cpt = 0; cpt< slavesCount; cpt++)
\r
45 slaves[cpt].put(0, new FinalizeTask());
\r
52 info(TEXT_("Received \"") + TEXT_(t->getName()) + TEXT_("\" "));
\r
54 info(TEXT_("Sending \"") + TEXT_(t->getName()) + TEXT_("\" to \"") + TEXT_(slaves[taskCount % slavesCount].getName()) + TEXT_("\""));
\r
56 slaves[taskCount % slavesCount].put(0, t);
\r
62 info("I'm done. See you!");
\r