You may register in multiple roles simultaneously. Register with the MULTI_ROLE capability ( https://github.com/apache/mesos/blob/master/include/mesos/mesos.proto#L345). Our frameworks all register with a role, but never the role '*'. We get Offers from all agents that don't have statically partitioned resources and do dynamic reservation into one of our registered roles. I don't know the purpose or goals of your project, but some example Java based frameworks are available here: https://github.com/mesosphere/dcos-commons.
We use multiple roles when appropriate here: https://github.com/mesosphere/dcos-commons/blob/master/sdk/scheduler/src/main/java/com/mesosphere/sdk/specification/DefaultService.java#L200 Maybe have a look at the DefaultScheduler for an implementation of a look at the DefaultScheduler there as well, if you're just trying to get things building and off the ground ( https://github.com/mesosphere/dcos-commons/blob/master/sdk/scheduler/src/main/java/com/mesosphere/sdk/scheduler/DefaultScheduler.java#L53 ). On Wed, Jul 5, 2017 at 3:13 AM James Peach <jor...@gmail.com> wrote: > > > On Jul 5, 2017, at 2:39 AM, Thodoris Zois <z...@ics.forth.gr> wrote: > > > > Ok, probably you are right but what you don’t understand is that i am a > completely newbie and i see such systems for the first time. It’s about a > university project that i am working on in order to get my bachelor degree. > I don’t really know the proper way to express what i want to like you do. I > don’t know how to connect 2 frameworks or something, i don’t even know how > to make my own framework and compile it with the dependencies that Mesos > needs. I am just writting on TestFramework.java and TestExecutor.java and > that’s all. The reason that i want to run everything from the same > framework (instance) is because keep a TreeMap with some info that i don’t > want to lose if i terminate the Schedulers driver. So if i start up a new > framework, TreeMap is gone. Forget about the tasks, i can use the same > TestExecutor.java for every scheduler. > > Note that you can start multiple Scheduler drivers within the same server. > Each one can register with Mesos as a separate framework. > > > What i want to achieve is to get offers from a specific agent with role > “SB” and run 10 tasks (i give also to my Framework role “SB”), then i store > those information (which are actually TaskInfo in Schedulers TreeMap). > After that i would like to change the role of my Framework to “*(default)”. > Then i will get offer from an agent that has the default role and i will > still have the info in my TreeMap because scheduler instance didn’t stop. > > If you start multiple Scheduler drivers, they can all share a TreeMap > because they are running in the same Java process. > > > That’s all. My problem is that i don’t know how to change the role of > the Framework without losing that TreeMap, and also how to set it with > version 1.3.0. > > > > Hope that everybody understands now…. > > Thank you, and i am really sorry for the spam > > > > > >> On 5 Jul 2017, at 12:24, James Peach <jor...@gmail.com> wrote: > >> > >> > >>> On Jul 5, 2017, at 12:54 AM, Thodoris Zois <z...@ics.forth.gr> wrote: > >>> > >>> Hi, > >>> > >>> No, i would like my framework to be offered resources from agent with > role (e.g: thz) and after running the specific tasks change its role to (*) > in order to get offers from different agents, but it will run the same > tasks because i am never terminating the scheduler driver (that’s what i > want to). > >> > >> As I suggested on Slack, I still think the most obvious way to > implement this is to connect 2 frameworks, 1 for each role. Just > co-ordinate internally to accept the offers you want in the right sequence. > From your description, there's no requirement for this to be done in 1 > framework. > >> > >> I don't really follow what you mean by "run the same tasks". You can > run new instances of the same task (from whatever framework you like); you > can also send new tasks to an existing executor (from the same framework). > >> > >>> Don’t try to find logic, it’s not for a company or something :) > >> > >> I think that for people to help you, they need to be able to understand > the logic of what you want to achieve and why :) > >> > >>> > >>> Thank you, > >>> Thodoris > >>> > >>>> On 5 Jul 2017, at 05:36, Jay Guo <guojiannan1...@gmail.com> wrote: > >>>> > >>>> Hi Thodoris, > >>>> > >>>> If I understand correctly, you would like your framework to receive > offers from both 'role' and '*', so resources reserved to 'role' on > particular agent could be reliably supplied to the framework? Isn't it > sufficient to start your framework with multiple roles, 'role' & '*'? You > need to enable the capability. > >>>> > >>>> - J > >>>> > >>>> On Wed, Jul 5, 2017 at 7:28 AM, Thodoris Zois <z...@ics.forth.gr> > wrote: > >>>> I have built a Framework in Java that is running certain tasks. I > would like to run those tasks on a specific agent. I have set a role to the > Framework and used flags upon starting of the agent. Till here everything > is good. When framework has run tasks successfully i am not terminating it. > I would like to change its role to default (*) and get offered resources > from master that correspond to that role and it will run again the same > amount of tasks (and the same tasks) because i never terminated (and i > don't want to terminate its instance because i keep some mesos metrics to a > static TreeMap). That's all.. I just wanted somebody to explain me exactly > how it works and what i have to do because everything i have tried today > fails, and seems i can't find useful info on the Internet about this. > >>>> > >>>> Thank you! > >>>> > >>>> On 4 Jul 2017, at 21:00, Michael Park <mp...@apache.org> wrote: > >>>> > >>>>> What is it that you need help with? > >>>>> > >>>>> On Tue, Jul 4, 2017 at 11:12 AM Thodoris Zois <z...@ics.forth.gr> > wrote: > >>>>> Hello list, > >>>>> > >>>>> Is anybody available to help me with the new feature of 1.3.0 > version, that a framework can modify its role? > >>>>> > >>>>> Thank you > >>>> > >>> > >> > > > >