I'm still a little confused as the document http://mesos.apache.org/api/latest/java/org/apache/mesos/MesosSchedulerDriver.html says:
> Note that blocking on the MesosSchedulerDriver (e.g., via join()) doesn't > affect > the scheduler callbacks in anyway because they are handled by a different > thread. My understand as below, *please* correct me if anything wrong. the driver handle messages between scheduler and mesos, and start another thread to handle callback(e.g. resourceOffers()) and wait(maybe join()) for the callback thread. Though the callback may signal the driver that have message to send(e.g. launchTasks()), the driver is still waiting for callback thread finished, and will continue to handle event(from mesos, to mesos) once the callback thread exit. -- Thanks, Chengwei On Wed, Feb 04, 2015 at 10:53:51AM -0800, Vinod Kone wrote: > You are understanding is right. The driver is single threaded. So, if it is > busy in a callback it can't send a message to the master. > > On Tue, Feb 3, 2015 at 7:04 PM, Chengwei Yang <[email protected]> > wrote: > > On Tue, Feb 03, 2015 at 05:21:55PM -0800, Vinod Kone wrote: > > > > On Tue, Feb 3, 2015 at 5:46 AM, Chengwei Yang > <[email protected] > > > > wrote: > > > > As we can see, mesos-master send offer to chronos at 18:32:33, but > received > > all > > 4 decline message (LaunchTasksMessage) at 18:33.03, we are very > curious why > > the > > first decline doesn't sent before sleep 30 seconds? > > > > > > Just to be sure, if you sleep inside the callback any driver calls you > make > > (launch/decline) will not be sent to the master until you return from > the > > callback. > > > > Thanks Vinod, so if I understand correctly you did mean that all calls to > driver->launchTasks() will to be send at the time it returns from > resourceOffers() callback? > > For example, a pesudo code snippet like blow: > > resourceOffers() { > foreach offer:offers; do > // construct task > driver->launchTasks(offer, tasks); > } > > though there isn't any sleep in resourceOffers, but all the tasks only be > sent > to mesos-master at the time resourceOffers() finished? rather than sent > when > resourceOffers is running as the above code says? > > -- > Thanks, > Chengwei > >
signature.asc
Description: Digital signature
