On Tue, Oct 1, 2013 at 9:55 AM, Sam Taha <taha...@gmail.com> 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 <taha...@gmail.com> 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
>>
>>
>>
>

Reply via email to