You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/05 05:23:23 UTC
svn commit: r1131563 - in /incubator/mesos/trunk/src: master.cpp master.hpp
Author: benh
Date: Sun Jun 5 03:23:22 2011
New Revision: 1131563
URL: http://svn.apache.org/viewvc?rev=1131563&view=rev
Log:
tasks for frameworks now updated whenever a slave or framework reconnects
Modified:
incubator/mesos/trunk/src/master.cpp
incubator/mesos/trunk/src/master.hpp
Modified: incubator/mesos/trunk/src/master.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master.cpp?rev=1131563&r1=1131562&r2=1131563&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master.cpp (original)
+++ incubator/mesos/trunk/src/master.cpp Sun Jun 5 03:23:22 2011
@@ -256,6 +256,25 @@ SlotOffer * Master::lookupSlotOffer(Offe
return NULL;
}
+void Master::updateFrameworkTasks() {
+ foreachpair (SlaveID sid, Slave *slave, slaves) {
+ foreachpair (_, TaskInfo *task, slave->tasks) {
+ updateFrameworkTasks(task);
+ }
+ }
+}
+
+//alibandali++
+void Master::updateFrameworkTasks(TaskInfo *task) {
+ Framework *fwrk = lookupFramework(task->frameworkId);
+ if (fwrk != NULL) {
+ if (fwrk->tasks.find(task->id) == fwrk->tasks.end()) {
+ fwrk->tasks[task->id] = task;
+ // this->resources += resources; // alig: not sure if this should be done or not
+ }
+ }
+}
+
void Master::operator () ()
{
@@ -310,6 +329,9 @@ void Master::operator () ()
LOG(INFO) << "Registering " << framework << " at " << framework->pid;
frameworks[framework->id] = framework;
pidToFid[framework->pid] = framework->id;
+
+ updateFrameworkTasks();
+
link(framework->pid);
send(framework->pid, pack<M2F_REGISTER_REPLY>(framework->id));
allocator->frameworkAdded(framework);
@@ -416,7 +438,9 @@ void Master::operator () ()
slave->resources, taskVec);
foreach(TaskInfo &ti, taskVec) {
- slave->addTask(new TaskInfo(ti));
+ TaskInfo *tip = new TaskInfo(ti);
+ slave->addTask(tip);
+ updateFrameworkTasks(tip);
}
//alibandali
Modified: incubator/mesos/trunk/src/master.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master.hpp?rev=1131563&r1=1131562&r2=1131563&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master.hpp (original)
+++ incubator/mesos/trunk/src/master.hpp Sun Jun 5 03:23:22 2011
@@ -301,6 +301,13 @@ public:
SlotOffer * lookupSlotOffer(OfferID soid);
+ // Used in FT mode. Ensures that task is also registered in frameworks->tasks
+ void updateFrameworkTasks(TaskInfo *task);
+
+ // Used in FT mode. Traverses all slaves' tasks t and calls updateFrameworkTasks(t)
+ void updateFrameworkTasks();
+
+
// Return connected frameworks that are not in the process of being removed
vector<Framework *> getActiveFrameworks();