----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/44450/#review125394 -----------------------------------------------------------
Fix it, then Ship it! Let's agree to remove the below check (or not?), and then I'll commit this. src/master/weights_handler.cpp (lines 176 - 182) <https://reviews.apache.org/r/44450/#comment188181> Why do we need this check here? You refer to the "capacity heuristic" which is all the way in the quota_handler, unrelated to weights. If a slave is disconnected or inactive, I wouldn't expect it to have any offers, so it'll early exit out of the foreach(offer) loop anyway. I don't think it hurts, but I would prefer to remove it, since the logic is unnecessary to what you're doing here. - Adam B On March 22, 2016, 6:59 p.m., Yongqiao Wang wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/44450/ > ----------------------------------------------------------- > > (Updated March 22, 2016, 6:59 p.m.) > > > Review request for mesos, Adam B and Alexander Rukletsov. > > > Bugs: MESOS-4881 > https://issues.apache.org/jira/browse/MESOS-4881 > > > Repository: mesos > > > Description > ------- > > Rescind all outstanding offers to satisfy weights update. > > > Diffs > ----- > > src/master/master.hpp 124d43931a5c8a00ee0aaa604feb1761795209f2 > src/master/weights_handler.cpp c9a1b0d9adbeb1e165999cdbb4f295b24f10b18f > > Diff: https://reviews.apache.org/r/44450/diff/ > > > Testing > ------- > > Make && Make check. > > Manual test steps: > > - Start Mesos master: > $ ./bin/mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master > > - Start Mesos slave: > $ ./bin/mesos-slave.sh --master=127.0.0.1:5050 > > - Register a framwork with `curl` > $ curl -v http://127.0.0.1:5050/api/v1/scheduler -H "Content-type: > application/json" -X POST -d @subscribe.json > $ cat subscribe.json > { > "type" : "SUBSCRIBE", > > "subscribe" : { > "framework_info" : { > "user" : "root", > "name" : "comsumer c1 HTTP Framework", > "role" : "mesos", > "principal":"wyq" > }, > > "force" : true > } > } > > And this framework will receive an offer: > {"subscribed":{"framework_id":{"value":"7de42f40-2ddd-44a1-a4ff-4af932d25e02-0000"}},"type":"SUBSCRIBED"}20 > {"type":"HEARTBEAT"}680 > {"offers":{"offers":[{"agent_id":{"value":"7de42f40-2ddd-44a1-a4ff-4af932d25e02-S0"},"framework_id":{"value":"7de42f40-2ddd-44a1-a4ff-4af932d25e02-0000"},"hostname":"192.168.1.5","id":{"value":"7de42f40-2ddd-44a1-a4ff-4af932d25e02-O0"},"resources":[{"name":"cpus","role":"*","scalar":{"value":8.0},"type":"SCALAR"},{"name":"mem","role":"*","scalar":{"value":15360.0},"type":"SCALAR"},{"name":"disk","role":"*","scalar":{"value":470832.0},"type":"SCALAR"},{"name":"ports","ranges":{"range":[{"begin":31000,"end":32000}]},"role":"*","type":"RANGES"}],"url":{"address":{"hostname":"192.168.1.5","ip":"192.168.1.5","port":5051},"path":"\/slave(1)","scheme":"http"}}]},"type":"OFFERS"}20 > {"type":"HEARTBEAT"}20 > > - Update the weight of role `mesos` > $ curl --data "[{\"weight\":1.8,\"role\":\"mesos\"}]" -X PUT > http://127.0.0.1:5050/weights > > Receive an rescind offer, and a new offer received: > {"rescind":{"offer_id":{"value":"7de42f40-2ddd-44a1-a4ff-4af932d25e02-O0"}},"type":"RESCIND"}680 > {"offers":{"offers":[{"agent_id":{"value":"7de42f40-2ddd-44a1-a4ff-4af932d25e02-S0"},"framework_id":{"value":"7de42f40-2ddd-44a1-a4ff-4af932d25e02-0000"},"hostname":"192.168.1.5","id":{"value":"7de42f40-2ddd-44a1-a4ff-4af932d25e02-O1"},"resources":[{"name":"cpus","role":"*","scalar":{"value":8.0},"type":"SCALAR"},{"name":"mem","role":"*","scalar":{"value":15360.0},"type":"SCALAR"},{"name":"disk","role":"*","scalar":{"value":470832.0},"type":"SCALAR"},{"name":"ports","ranges":{"range":[{"begin":31000,"end":32000}]},"role":"*","type":"RANGES"}],"url":{"address":{"hostname":"192.168.1.5","ip":"192.168.1.5","port":5051},"path":"\/slave(1)","scheme":"http"}}]},"type":"OFFERS"}20 > {"type":"HEARTBEAT"}20 > > - Update the weight of role `mesos1` > $ curl --data "[{\"weight\":2.8,\"role\":\"mesos1\"}]" -X PUT > http://127.0.0.1:5050/weights > > - The outstanding offer will not be rescinded. > > > (TODO) I will add couple of tests for this patch in another JIRA. > > > Thanks, > > Yongqiao Wang > >