> On July 19, 2016, 11:13 p.m., Dmitriy Shirchenko wrote: > > File Attachment: NEW - offers-new.json > > <https://reviews.apache.org/r/50052/#fcomment104> > > > > Why is there a double nested labels: labels array under reservation? Is > > this just a carry over from how Aurora gets offers from Mesos? > > > > So there is a key `labels` and then underneath is there's another key > > `labels` whose value is an array. Seems like one of them is not necessary. > > > > ```json > > reservation: { > > labels: { > > labels: [ > > { > > key: "job", > > value: "devcluster/www-data/prod/hello" > > } > > ] > > } > > } > > ``` > > Mehrdad Nurolahzade wrote: > This is a question we have to put to Mesos people, it's a weired design. > I can confirm that it is not due to our rendering of their protobuf > structures. > > To verify I played with their > ```src/tests/reservation_endpoints_tests.cpp``` tests and dumped their > ```ReservationInfo``` structures and noticed the same weired nest behavior. > Also, if you try to set labels through supplied http endpoints ```/reserve``` > you would notice the call would fail unless you supply nested labels: > ``` > curl -i \ > -d slaveId="d091a635-33c8-4409-989f-9bef16e36f34-S0" \ > -d resources='[ > { > "name": "disk", > "type": "SCALAR", > "scalar": { "value": 128 }, > "role": "aurora-role", > "reservation": { > "labels": { > "labels" : [{"key": "job", "value": > "devcluster/www-data/prod/hello"}] > } > } > } > ]' \ > -X POST http://192.168.33.7:5050/master/reserve > ```
Looks like this is due to a sub-optimal desire for code reuse: * Definition: https://github.com/apache/mesos/blob/cbfd3575414eef6f2faf249b4b0a2a8de015cc42/include/mesos/mesos.proto#L1980-L1991 * Usage (one of many): https://github.com/apache/mesos/blob/cbfd3575414eef6f2faf249b4b0a2a8de015cc42/include/mesos/mesos.proto#L692-L698 We would not see this, if the would be using `repeated Label labels` everywhere, rather than `optional Labels labels`. - Stephan ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/50052/#review142830 ----------------------------------------------------------- On July 19, 2016, 4:12 a.m., Mehrdad Nurolahzade wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/50052/ > ----------------------------------------------------------- > > (Updated July 19, 2016, 4:12 a.m.) > > > Review request for Aurora, Joshua Cohen and Stephan Erb. > > > Bugs: AURORA-1736 > https://issues.apache.org/jira/browse/AURORA-1736 > > > Repository: aurora > > > Description > ------- > > AURORA-1736 Display reservations and persistent volumes in /offers debug http > endpoint > > > Diffs > ----- > > config/legacy_untested_classes.txt 1ea2183ab20cc5c6bca147bcea4e5c708d576b62 > src/main/java/org/apache/aurora/scheduler/http/Offers.java > 80f082410896a50d86c7886736caf79581f5051c > src/test/java/org/apache/aurora/scheduler/http/OffersTest.java PRE-CREATION > > Diff: https://reviews.apache.org/r/50052/diff/ > > > Testing > ------- > > Manual, Jenkins, and end_to_end > > > File Attachments > ---------------- > > CURRENT > > https://reviews.apache.org/media/uploaded/files/2016/07/18/1de4c357-c932-4c84-962f-4209a5b679bc__offers-old.json > NEW > > https://reviews.apache.org/media/uploaded/files/2016/07/19/799bcd1f-f9c8-4b6e-bbaa-ce8022b1dac1__offers-new.json > > > Thanks, > > Mehrdad Nurolahzade > >