mesos / mesos-go

Go language bindings for Apache Mesos
Apache License 2.0
545 stars 146 forks source link

next: Accept operations with offerID array #249

Closed athlum closed 8 years ago

athlum commented 8 years ago

I wrote a mesos framework for mesos 0.25.0 on mesos-go master branch. Now I'm trying use the next branch for mesos 0.28.0 because of v1 Scheduler HTTP API.

On mesos 0.25.0, when you kill a running task, mesos master will offer the resource used by that task immediately. If my scheduler is holding the resource with the same slaveId, then I have two offers with one slaveId now (in different offerId). With method AcceptOffers (in master branch), I can request reserve/launch operations with these two offer to avoid resource fragments or let the big task (require the resources more than any of those two offers) go.

In the next branch, I find there is a method OfferWithOperations that allow me to request operations on only one offerId. BTW, I find acceptBuilder support request operations array with offer array. Is there an other way for me to request operations on the offerId array that with the same slaveId? Or is there anything I can do.

Thx.

hi-wayne commented 8 years ago

@athlum You can try to write

once := sync.Once{} for _, offid := range selectedOffMap { once.Do(func() { OfferWithOperations(offid, taskinfo1) }) OfferWithOperations(offid) }

@jdef I think this is bad

jdef commented 8 years ago

Thanks for the feedback!! Sounds like the convenience funcs aren't that convenient for your use case.

That said, is anything stopping you from manually constructing the Call the way that you need it? All the requisite protos are publicly exposed.

On Tue, Jun 14, 2016 at 7:44 AM, wangwei notifications@github.com wrote:

@athlum https://github.com/athlum You can try to write

once := sync.Once{} for _, offid := range selectedOffMap { once.Do(func() { OfferWithOperations(offid, taskinfo1) }) OfferWithOperations(offid) }

@jdef https://github.com/jdef I think this is bad

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mesos/mesos-go/issues/249#issuecomment-225856694, or mute the thread https://github.com/notifications/unsubscribe/ACPVLEEgBwavFh7tl47qL-KJQ8JASqxoks5qLpQRgaJpZM4I1Loo .

jdef commented 8 years ago

thoughts re: #250?

athlum commented 8 years ago

Thanks jdef, that's cool.