Re: Threading model of mesos API (C++)

2015-06-11 Thread James Vanns
Excellent. Thank you both for your time and efforts - and most importantly clarifying behavior :) Jim

Re: Threading model of mesos API (C++)

2015-06-10 Thread James Vanns
Thanks for the responses, guys. That link of the 'detailed description' will be handy - I've not come across that before. I do now have another question though! Aren't these two a contradiction; Alex; you launch a task, before the method returns (say you do some blocking stuff after, like sync

Re: Threading model of mesos API (C++)

2015-06-10 Thread Alexander Gallego
Jim, Let me prototype something small today. After reading my scheduler (in c++) i do have comments and synchronization on some state vars, but it might have to do with a more complex async code base I manage. I'll get back to you. - alex On Wed, Jun 10, 2015 at 6:15 AM, James Vanns

Re: Threading model of mesos API (C++)

2015-06-10 Thread James Vanns
You are a star, Alex. Thank you :) Jim On 10 June 2015 at 15:15, Alexander Gallego agall...@concord.io wrote: Jim, Let me prototype something small today. After reading my scheduler (in c++) i do have comments and synchronization on some state vars, but it might have to do with a more

Threading model of mesos API (C++)

2015-06-09 Thread James Vanns
Hi. I'm toying with the mesos scheduler (C++) API and running into unexpected race conditions. I have *not* synchronised access to attributes of my Scheduler-derived class. Is the mesos library code threaded and network communication asynchronous? What it *looks like* I'm seeing is my

Re: Threading model of mesos API (C++)

2015-06-09 Thread James Vanns
Replying to my own thread here ;) It is also possible that resourceOffers() is called more than once before the first statusUpdate() is received. That is more likely. Some links to state transitions, and any threading model would be handy though. Or at least how and when callbacks are invoked.

Re: Threading model of mesos API (C++)

2015-06-09 Thread Alexander Gallego
Jim, You do need to do your own synchronization. It's basically possible for ANY callback to call your code in any order. The API does not guarantee ordering. For example, say you launch a task, before the method returns (say you do some blocking stuff after, like sync update zookeeper), you

Re: Threading model of mesos API (C++)

2015-06-09 Thread Benjamin Mahler
If that's really what you're seeing, it is a bug and a very surprising one, so please provide evidence :) See the detailed description here: http://mesos.apache.org/api/latest/c++/classmesos_1_1Scheduler.html The scheduler driver will serially invoke methods on your Scheduler implementation.