> On July 18, 2013, 6:34 p.m., Benjamin Hindman wrote: > > This looks like it still needs to get rebased on the other reviews, but > > this looks good to me. What is the current impact on the Java and Python > > examples until we provide Resources.java and resources.py?
Even if we don't have Resources.java and resources.py, the Java and Python examples should still work correctly, because they will register as the default role and only get offered resources from that role. I'm happy to get this done (I'm assuming its mostly just boiler plate anyways), but I uploaded the patch with all the other changes and not Java and Python so we can maybe get that much committed soon. > On July 18, 2013, 6:34 p.m., Benjamin Hindman wrote: > > include/mesos/resources.hpp, line 34 > > <https://reviews.apache.org/r/12365/diff/2/?file=321974#file321974line34> > > > > Is this needed by the header? If so, we'll need to make this public too > > (which we should do anyway). Its needed by the implementation of the templated get() functions, which can't be moved into resources.cpp, so I made values.hpp public. - Thomas ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/12365/#review23410 ----------------------------------------------------------- On July 16, 2013, 12:29 a.m., Thomas Marshall wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/12365/ > ----------------------------------------------------------- > > (Updated July 16, 2013, 12:29 a.m.) > > > Review request for mesos and Benjamin Hindman. > > > Bugs: MESOS-505 > https://issues.apache.org/jira/browse/MESOS-505 > > > Repository: mesos > > > Description > ------- > > One of the biggest potential problems with adding roles to resources is that > it significantly increases the complexity of dealing with resources for > scheduler writers - you end up in a situation where the Resources sent as > part of an offer may, for example, contain multiple cpu resources, each > marked with a different role, and you may want to launch tasks that use cpus > across roles. > > The solution for this is to provide the utilities of the Resources class for > use by scheduler writers. In particular, I've implemented a function called > findWithRoles that I believe covers the common case of launching tasks from > offers in a simple way - the idea is that a scheduler will construct a > Resources object representing the amount of resources it wants for a task but > not marked with roles. Then you call findWithRoles on the offer's resources > with the task's resources as the parameter. findWithRoles will return a > Resources object with the same total amount of resources as the parameter, > but with roles marked appropriately to match up with resources from the > offer, taking resources first from the role specified as a parameter to > findWithRoles, then from the default role, then from any other role. > test_framework.cpp is a good example of how this would work. > > > Diffs > ----- > > include/mesos/resources.hpp PRE-CREATION > src/Makefile.am 5d6f309 > src/common/resources.hpp 42dfb6a > src/common/resources.cpp 8bc1057 > src/common/type_utils.hpp 377b65f > src/common/values.cpp 36e11d1 > src/examples/test_framework.cpp 2c46c24 > src/master/allocator.hpp 9fc802a > src/master/drf_sorter.hpp 80f4798 > src/master/hierarchical_allocator_process.hpp c959c3f > src/master/http.cpp b5c8db9 > src/master/master.hpp a076658 > src/slave/http.cpp dc2955f > src/slave/isolator.hpp 67effd3 > src/slave/slave.hpp c679447 > src/tests/gc_tests.cpp 1745800 > src/tests/isolator_tests.cpp a37f006 > src/tests/mesos.hpp 5cb5aa2 > src/tests/resources_tests.cpp 67a11b3 > src/tests/slave_recovery_tests.cpp b0843d7 > src/tests/sorter_tests.cpp 619e786 > > Diff: https://reviews.apache.org/r/12365/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Thomas Marshall > >
