Thanks Vinod. It would be better if I could call launchTasks() multiple times per OfferID since my request-to-offer matching algo requires is a little bit involved. This way I would not have to wait till then end of my matching algo to launch the tasks (per OfferID batch). But I can deal with it by batching everything up and then calling launchTasks once I have found the optimal matches at then end of the matching algo. This deals calling launchTasks till the end but hopefully that will not be a big problem.
Reason I have to do this is that my scheduler has essentially multiple schedulers (queues) inside of it (each with different priority rules). And I want to be fair to all the jobs requesting resources across all the queues. Some of the queues have strict FIFOs (and others don't) so I need to set some Offers aside to see if I can match the request with other Offers while still try to use all the Offers. So I am doing a multiple passes across the queues horizontally (multiple queues) and vertically (depth of queues) while randomizing each row scan point starting point. If it possible to have launchTasks() called multiple times for the same OfferID in the future that would be cool. Thanks, Sam Taha http://www.grandlogic.com On Tue, Oct 1, 2013 at 1:37 PM, Vinod Kone <[email protected]> wrote: > On Tue, Oct 1, 2013 at 9:55 AM, Sam Taha <[email protected]> wrote: > >> Sorry, just noticed that SchedulerDriver.launchTasks() takes a List of >> Tasks, so I guess you can launch multiple job/Task requests against the >> same OfferID if you make them all in the same launchTasks() call. >> >> > You are right. You can launch multiple tasks within the same offer as long > as it is in the same launchTasks() call. > > >> Is this an all or nothing batch call if one of them say requests more >> than what is available on the slave? >> >> > From looking at the code, mesos will launch as many tasks as it can based > on the resources available in the offer. All subsequent tasks will be > rejected. > > > Also is it kosher to make multiple launchTasks() calls for the same >> OfferID or do they have to batched in one launchTasks() call? Just want to >> make sure I follow recommended API usage and not get my self in deep water >> or any unexpected behavior for how resources are allocated. >> >> > No. You cannot reuse offerId in multiple launchTasks(). A launchTasks() > call invalidates the offerId. So yes, you need to batch all your tasks for > that offer in the launchTasks() call. Alternatively, you can wait for the > remaining resources to be offered again with a different offerId. But if > you already have queue of jobs to fit in the offer, I would recommend > batching them to save time. > > HTH, > vinod > > >> Thanks, >> Sam Taha >> >> http://www.grandlogic.com >> >> >> On Tue, Oct 1, 2013 at 12:32 PM, Sam Taha <[email protected]> wrote: >> >>> Simple example scenario: >>> >>> If my Framework/Scheduler gets an Offer for say 2 cpu and 10G (from a >>> single Slave/OfferID) and let's say I have two job requests that each need >>> 1 cpu and 5G each. Now, can I make both requests against the same Offer >>> (same OfferID) or can I only make one request even though there are enough >>> resources for the second job? >>> >>> As I am looping through the Offers and comparing them to my requests, >>> how should I keep track that my first request already "consumed" and >>> (launchedTask) resources of 1cpu and 5G on this OfferID (should I update >>> the Offer/Resource to reflect the change as I loop to the next request in >>> my list)? Or can I only make one request per OfferID and just wait to >>> presented with the left over resources on the next time Mesos callbacks? >>> >>> Basically my question is if I have not consumed the full resources for >>> that Offer, do I have to wait for the next time Mesos presents me with the >>> rest of the Offer resource in order to launch my second request or do I >>> track all this on my Framework side as I am matching Offers to Requests? >>> >>> Thanks, >>> Sam Taha >>> >>> http://www.grandlogic.com >>> >>> >>> >> >

