> On Jan. 8, 2016, 10:36 a.m., Adam B wrote: > > src/master/weights_handler.cpp, lines 97-100 > > <https://reviews.apache.org/r/41681/diff/21/?file=1183538#file1183538line97> > > > > Why the ostringstream here?
In order to convert double to string. > On Jan. 8, 2016, 10:36 a.m., Adam B wrote: > > src/master/weights_handler.cpp, line 53 > > <https://reviews.apache.org/r/41681/diff/21/?file=1183538#file1183538line53> > > > > Why did we choose PUT instead of POST. Everything else uses POST. In Restful API, POST is always use to set/add new entry, and PUT is always use to do update. In Mesos, any role will always has a default weight (1.0), and this endpoint is used to update weight (change 1.0 to other) rather than add/set weight. so we choose PUT. > On Jan. 8, 2016, 10:36 a.m., Adam B wrote: > > src/master/master.hpp, lines 1037-1039 > > <https://reviews.apache.org/r/41681/diff/21/?file=1183535#file1183535line1037> > > > > Just wondering if we really want the authorize() interface to take > > multiple roles, or just a single role at a time. In our design, A weights update request is an atomic operation, if any one role in the specified roles is invaild, then fail the request, so use multiple roles is better. - Yongqiao ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/41681/#review113439 ----------------------------------------------------------- On Jan. 6, 2016, 2:15 a.m., Yongqiao Wang wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/41681/ > ----------------------------------------------------------- > > (Updated Jan. 6, 2016, 2:15 a.m.) > > > Review request for mesos, Adam B, Neil Conway, and Qian Zhang. > > > Bugs: MESOS-4214 > https://issues.apache.org/jira/browse/MESOS-4214 > > > Repository: mesos > > > Description > ------- > > Introduce HTTP endpoint /weights for updating weight. > > > Diffs > ----- > > include/mesos/authorizer/authorizer.hpp > f61613948b7b5c5c2118f1782a0c5f8ff7e8e057 > include/mesos/authorizer/authorizer.proto > 7b729e19484d92be48bbde4dff2c833a4109936e > src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 > src/Makefile.am e08e86724abaa3023f0483aa222354c95d4d3817 > src/authorizer/local/authorizer.hpp > 1563c11709c2612350354690b50ceb33d2720f98 > src/authorizer/local/authorizer.cpp > 1d135fb6906c7050a788cbac9ca2d8164ff064ef > src/master/http.cpp deb0c8f9852dc0eec1e8c0ff35c684f982e8b110 > src/master/master.hpp 1cc5531de70bdc0bdce9835c4930dc774406fac9 > src/master/master.cpp 40ce3e17fca88da689128bcf5d35fdddc396c011 > src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 > src/master/weights_handler.cpp PRE-CREATION > src/tests/mesos.hpp a4811b0d8dee33ff2ca4968f532ce64b7ea95249 > src/tests/mesos.cpp f4b0f82449c4b6a2b4b7b7f14518714485d5a13a > > Diff: https://reviews.apache.org/r/41681/diff/ > > > Testing > ------- > > Make & Make check successfully! > > $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/Users/yqwyq/tmp/mesos-master > >> /tmp/mesos-master.log 2>&1 &) > $ curl -d > weights="[{\"weight\":1.0,\"role\":\"role1\"},{\"weight\":8.0,\"role\":\"role2\"}]" > -X PUT http://localhost:5050/weights > $ curl http://localhost:5050/roles > { > "roles": [ > { > "frameworks": [ ], > "name": "*", > "resources": { > "cpus": 0, > "disk": 0, > "mem": 0 > }, > "weight": 1 > }, > { > "frameworks": [ ], > "name": "role1", > "resources": { > "cpus": 0, > "disk": 0, > "mem": 0 > }, > "weight": 1 > }, > { > "frameworks": [ ], > "name": "role2", > "resources": { > "cpus": 0, > "disk": 0, > "mem": 0 > }, > "weight": 8 > } > ] > } > > > Thanks, > > Yongqiao Wang > >