You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Yongqiao Wang <yq...@cn.ibm.com> on 2015/12/23 10:18:33 UTC

Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

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/mesos.proto 2431fdd6b84625c6140a2b3913736bffada4e7f6 
  src/CMakeLists.txt bdc45ae604c940dadc27ab6e8b8a3327bd00642b 
  src/Makefile.am cf7f950c0c320a6c8e956409a35a7f47d905f71d 
  src/master/http.cpp deb0c8f9852dc0eec1e8c0ff35c684f982e8b110 
  src/master/master.hpp 8af82a0bbc2038e18180136c82cbaeeacc7b3526 
  src/master/master.cpp 40ce3e17fca88da689128bcf5d35fdddc396c011 
  src/master/weights_handler.cpp PRE-CREATION 

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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Mesos ReviewBot <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review111770
-----------------------------------------------------------


Bad patch!

Reviews applied: [41597, 41681]

Failed command: ./support/apply-review.sh -n -r 41681

Error:
 2015-12-23 10:33:16 URL:https://reviews.apache.org/r/41681/diff/raw/ [10249/10249] -> "41681.patch" [1]
error: patch failed: src/master/master.hpp:1173
error: src/master/master.hpp: patch does not apply

- Mesos ReviewBot


On Dec. 23, 2015, 9:18 a.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Dec. 23, 2015, 9:18 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/mesos.proto 2431fdd6b84625c6140a2b3913736bffada4e7f6 
>   src/CMakeLists.txt bdc45ae604c940dadc27ab6e8b8a3327bd00642b 
>   src/Makefile.am cf7f950c0c320a6c8e956409a35a7f47d905f71d 
>   src/master/http.cpp deb0c8f9852dc0eec1e8c0ff35c684f982e8b110 
>   src/master/master.hpp 8af82a0bbc2038e18180136c82cbaeeacc7b3526 
>   src/master/master.cpp 40ce3e17fca88da689128bcf5d35fdddc396c011 
>   src/master/weights_handler.cpp PRE-CREATION 
> 
> 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
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Mesos ReviewBot <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review111904
-----------------------------------------------------------


Patch looks great!

Reviews applied: [41597, 41681]

Passed command: export OS=ubuntu:14.04;export CONFIGURATION="--verbose";export COMPILER=gcc; ./support/docker_build.sh

- Mesos ReviewBot


On Dec. 26, 2015, 2:22 a.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Dec. 26, 2015, 2:22 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/mesos.proto 2431fdd6b84625c6140a2b3913736bffada4e7f6 
>   src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
>   src/Makefile.am 8af0115caa67ac8f3193d8f0d0f1a4ae739af275 
>   src/master/http.cpp deb0c8f9852dc0eec1e8c0ff35c684f982e8b110 
>   src/master/master.hpp 1cc5531de70bdc0bdce9835c4930dc774406fac9 
>   src/master/master.cpp 40ce3e17fca88da689128bcf5d35fdddc396c011 
>   src/master/weights_handler.cpp PRE-CREATION 
> 
> 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
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Mesos ReviewBot <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review112188
-----------------------------------------------------------


Patch looks great!

Reviews applied: [41597, 41681]

Passed command: export OS=ubuntu:14.04;export CONFIGURATION="--verbose";export COMPILER=gcc; ./support/docker_build.sh

- Mesos ReviewBot


On Dec. 29, 2015, 12:51 p.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Dec. 29, 2015, 12:51 p.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 19f6e1a2d025bf6ff07f515b10d41e8a48d7d0b4 
>   include/mesos/authorizer/authorizer.proto 7b729e19484d92be48bbde4dff2c833a4109936e 
>   src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
>   src/Makefile.am 8af0115caa67ac8f3193d8f0d0f1a4ae739af275 
>   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 de9c3b9054611bf65f51df4d499bee927cf4d01d 
>   src/tests/mesos.cpp 11ca0519ad0dad44328b6ebdf52c5356fda818b7 
> 
> 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
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.

> 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
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.

> On Jan. 8, 2016, 10:36 a.m., Adam B wrote:
> > Here's my first full pass over this patch. Couldn't find anything major except the PUT vs. POST question.
> > I'll admit I was surprised to see in your testing section that `role1` showed up in `/roles` even though it has a default weight. Can you explain why that happens and if it was intended behavior?

I have updated the test result. The current behaviour is if weight is updated to the default weight (1.0) by /weights endpoint, then the non-default weights will not be showed up in /roles.


> On Jan. 8, 2016, 10:36 a.m., Adam B wrote:
> > src/master/master.cpp, line 1479
> > <https://reviews.apache.org/r/41681/diff/21/?file=1183536#file1183536line1479>
> >
> >     Is `weights` loaded with the contents of `--weights` first?
> >     If there's a role in `--weights` that was since erased from the registry (weight=1.0), wouldn't `weights` still have the cmd-line value after fresh recovery?

Yes, weights hashmap in master is loaded with --weights first before recovering the weights information from registry. And if registry.weights_size() > 0 when master recovery, then weights hashmap will be reloaded.  After recovering from registry, then all cmd-value (specified by --weights) will be removed from weights hashmap. 

And If weight is updated to 1.0 by /weights, then it well be removed from registry and weights hashmap.


> On Jan. 8, 2016, 10:36 a.m., Adam B wrote:
> > src/master/master.cpp, lines 1471-1475
> > <https://reviews.apache.org/r/41681/diff/21/?file=1183536#file1183536line1471>
> >
> >     Do you still want to update the allocator (push_back) with 1.0 weights? Are those even possible if we're recovering all this from the registry? Maybe we should just CHECK.

weights hashmap and allocator are initialized by --weights flag before recovering from registry.  In our design, we prefer to use weights information in registry and ignore the weights specified by --weights, so it needs to remove all non-default weight information (weights hashmap in allocator ) stored in allocator first, and then update the allocator with the weights recoverd from registry, if weight is updated to 1.0 then it will be removed from weights in allocator.


- Yongqiao


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review113439
-----------------------------------------------------------


On Jan. 8, 2016, 3 p.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Jan. 8, 2016, 3 p.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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
>   src/CMakeLists.txt 6ae44c76def124bbd1ccd4e6ad510c2fd0bfda5e 
>   src/Makefile.am bbd0c119321fa9d11fea61b140428dd92d1258c8 
>   src/authorizer/local/authorizer.hpp 586f0da19c050e75e20902c376627c8f0b4bf272 
>   src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
>   src/master/http.cpp bcafc7aff89659a68352f3876ce6042f8b34bd5d 
>   src/master/master.hpp f02d165874fa8023675e545793de699aeecae29b 
>   src/master/master.cpp 2d9b7f9540574aa3ef9e5af3b2b8922dffeebac8 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
>   src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 
> 
> 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
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Adam B <ad...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review113439
-----------------------------------------------------------


Here's my first full pass over this patch. Couldn't find anything major except the PUT vs. POST question.
I'll admit I was surprised to see in your testing section that `role1` showed up in `/roles` even though it has a default weight. Can you explain why that happens and if it was intended behavior?


include/mesos/authorizer/authorizer.hpp (lines 192 - 197)
<https://reviews.apache.org/r/41681/#comment174090>

    Delete everything in this comment after the first sentence "Used to verify... specific roles." We recently removed some redundancy in these comments, and I think you're still following the old pattern.



include/mesos/authorizer/authorizer.hpp (lines 199 - 201)
<https://reviews.apache.org/r/41681/#comment174091>

    "@param request `ACL::UpdateWeights` packing all the parameters needed to verify if the given principal is allowed to update the weight of the specified roles.



include/mesos/authorizer/authorizer.hpp (line 204)
<https://reviews.apache.org/r/41681/#comment174092>

    s/however//



include/mesos/authorizer/authorizer.proto (line 125)
<https://reviews.apache.org/r/41681/#comment174088>

    s/roles.../roles to update./



src/CMakeLists.txt (lines 173 - 178)
<https://reviews.apache.org/r/41681/#comment174093>

    'weights' goes after 'validation' alphabetically



src/Makefile.am (lines 580 - 583)
<https://reviews.apache.org/r/41681/#comment174094>

    'weights' after 'validation'



src/master/http.cpp (lines 1103 - 1104)
<https://reviews.apache.org/r/41681/#comment174095>

    POST or PUT?
    "... and updates the weight for the specified roles."



src/master/http.cpp (lines 1115 - 1117)
<https://reviews.apache.org/r/41681/#comment174096>

    "Like /quota, we should also add query logic for /weights to keep consistent. Then /roles no longer needs to show weight information."
    
    Create a separate follow-up JIRA for this. We don't need to get to it for MVP, but we can revisit it later.



src/master/master.hpp (lines 1037 - 1039)
<https://reviews.apache.org/r/41681/#comment174097>

    Just wondering if we really want the authorize() interface to take multiple roles, or just a single role at a time.



src/master/master.hpp (line 1560)
<https://reviews.apache.org/r/41681/#comment174098>

    Please add a space before parentheses like "value (1.0)"



src/master/master.hpp (line 1561)
<https://reviews.apache.org/r/41681/#comment174099>

    s/remove/remove it/



src/master/master.cpp (line 1445)
<https://reviews.apache.org/r/41681/#comment174101>

    s/is/are/



src/master/master.cpp (line 1451)
<https://reviews.apache.org/r/41681/#comment174102>

    s/Ignore/Ignoring/



src/master/master.cpp (lines 1471 - 1475)
<https://reviews.apache.org/r/41681/#comment174104>

    Do you still want to update the allocator (push_back) with 1.0 weights? Are those even possible if we're recovering all this from the registry? Maybe we should just CHECK.



src/master/master.cpp (line 1479)
<https://reviews.apache.org/r/41681/#comment174106>

    Is `weights` loaded with the contents of `--weights` first?
    If there's a role in `--weights` that was since erased from the registry (weight=1.0), wouldn't `weights` still have the cmd-line value after fresh recovery?



src/master/master.cpp (line 1480)
<https://reviews.apache.org/r/41681/#comment174105>

    s/boostrap cluster/bootstrapping the cluster/



src/master/registry.proto (line 82)
<https://reviews.apache.org/r/41681/#comment174100>

    This last line is false, since the agents of the cluster know nothing about the weights. A newly elected master will recover the weights from the registry.



src/master/weights_handler.cpp (line 53)
<https://reviews.apache.org/r/41681/#comment174111>

    Why did we choose PUT instead of POST. Everything else uses POST.



src/master/weights_handler.cpp (lines 60 - 61)
<https://reviews.apache.org/r/41681/#comment174112>

    You can squeeze these two onto the same line.



src/master/weights_handler.cpp (line 72)
<https://reviews.apache.org/r/41681/#comment174114>

    We don't use the 'Str' abbreviation in Mesos. How about just `weights`?



src/master/weights_handler.cpp (lines 81 - 83)
<https://reviews.apache.org/r/41681/#comment174115>

    Wow, you should have `using google::protobuf::RepeatedPtrField;` up top so you can shorten this.



src/master/weights_handler.cpp (line 93)
<https://reviews.apache.org/r/41681/#comment174118>

    Why the `_`? Why not just `weightInfo`?



src/master/weights_handler.cpp (lines 97 - 100)
<https://reviews.apache.org/r/41681/#comment174117>

    Why the ostringstream here?



src/master/weights_handler.cpp (line 105)
<https://reviews.apache.org/r/41681/#comment174119>

    Can you also show the weight as well, so they know what weight value is invalid?



src/master/weights_handler.cpp (lines 111 - 112)
<https://reviews.apache.org/r/41681/#comment174120>

    Please put these two on the same line. In fact, it looks like you're wrapping at 52chars for some reason. Wrap at 80, please.



src/master/weights_handler.cpp (line 124)
<https://reviews.apache.org/r/41681/#comment174125>

    Can you s/Option<string>::none()/None()/?



src/master/weights_handler.cpp (line 140)
<https://reviews.apache.org/r/41681/#comment174126>

    // Update the registry and acknowledge the request.



src/master/weights_handler.cpp (lines 150 - 151)
<https://reviews.apache.org/r/41681/#comment174128>

    How about an `else` instead of a `continue`?



src/master/weights_handler.cpp (line 172)
<https://reviews.apache.org/r/41681/#comment174129>

    "to update weights for roles..."


- Adam B


On Jan. 5, 2016, 6:15 p.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Jan. 5, 2016, 6:15 p.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
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Adam B <ad...@mesosphere.io>.

> On Jan. 20, 2016, 1:51 a.m., Adam B wrote:
> > src/master/master.hpp, line 1577
> > <https://reviews.apache.org/r/41681/diff/28/?file=1199825#file1199825line1577>
> >
> >     Can it ever return anything but `true`? Are there any error conditions at all?
> 
> Yongqiao Wang wrote:
>     I have double checked that there are no any error conditions in our case.

Ok, looks like this function has to return a Try<bool> because that's what Operation defines for its interface. Makes sense for your to always return 'true' in such a simple Operation. Dropping the review issue.


> On Jan. 20, 2016, 1:51 a.m., Adam B wrote:
> > src/master/weights_handler.cpp, lines 113-115
> > <https://reviews.apache.org/r/41681/diff/28/?file=1199828#file1199828line113>
> >
> >     Why are you reconstructing a roles `string` out of the weightInfos instead of just using a `vector`? Does `authorize()` really require a comma-delimited string?
> >     
> >     What I was proposing before was that you call `authorize(principal, role)` for each weightInfo.role, and fail if any of those fails.
> 
> Yongqiao Wang wrote:
>     Reconstructing a roles string is only for print all roles in Master::WeightsHandler::authorize function.
>     
>     In addition, authorize() is an asynchronous call and will return a Future<bool>, in our logic, weights can only be updated in master, registry and allocator if authorization passed for all specified roles. So it is complex to block the authorization for each roles, then call _update() to updates weights in registry and registry. So I authorize all roles together at one time.

Printing doesn't seem like a good enough reason to have to translate roles back and forth. How about you pass a vector of roles to `authorize()` and just use `stringify` for the print string.?

And you wouldn't need to block sequentially for the calls, just wait for all of the futures to return. But I can see what that's unnecessary for WeightsHandler::authorize. I'll drop that idea.


- Adam


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review115379
-----------------------------------------------------------


On Jan. 20, 2016, 6:16 a.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Jan. 20, 2016, 6:16 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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
>   src/CMakeLists.txt a52203ab9aa47315e6e5c58cc283a7b5df597c76 
>   src/Makefile.am 4fabe600d4ba38c95a777d622b0b675dd5811a53 
>   src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
>   src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
>   src/master/http.cpp 34a70ee50553492fc8c3947497ab5922f4379d72 
>   src/master/master.hpp 3a7e18232323a1c051bcc97915484b1195fffe58 
>   src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
>   src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 
> 
> Diff: https://reviews.apache.org/r/41681/diff/
> 
> 
> Testing
> -------
> 
> Make & Make check successfully!
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [ ], 
>             "name": "*", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 1
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role1", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 4.2
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role2", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.1
>         }
>     ]
> }
> 
> Test update:
> $ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> Test recovuery:
> $ ps -ef | grep mesos-master
> 501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
> $ kill -9 56292
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.

> On Jan. 20, 2016, 9:51 a.m., Adam B wrote:
> > src/master/master.hpp, line 1577
> > <https://reviews.apache.org/r/41681/diff/28/?file=1199825#file1199825line1577>
> >
> >     Can it ever return anything but `true`? Are there any error conditions at all?

I have double checked that there are no any error conditions in our case.


> On Jan. 20, 2016, 9:51 a.m., Adam B wrote:
> > src/master/master.cpp, line 1572
> > <https://reviews.apache.org/r/41681/diff/28/?file=1199826#file1199826line1572>
> >
> >     Should this also `allocator->updateWeights(weightInfos);`?

It does not need, allocator has be initalized with --weights before recovery, and weights does not changed after allocator initalization.


> On Jan. 20, 2016, 9:51 a.m., Adam B wrote:
> > src/master/weights_handler.cpp, lines 113-115
> > <https://reviews.apache.org/r/41681/diff/28/?file=1199828#file1199828line113>
> >
> >     Why are you reconstructing a roles `string` out of the weightInfos instead of just using a `vector`? Does `authorize()` really require a comma-delimited string?
> >     
> >     What I was proposing before was that you call `authorize(principal, role)` for each weightInfo.role, and fail if any of those fails.

Reconstructing a roles string is only for print all roles in Master::WeightsHandler::authorize function.

In addition, authorize() is an asynchronous call and will return a Future<bool>, in our logic, weights can only be updated in master, registry and allocator if authorization passed for all specified roles. So it is complex to block the authorization for each roles, then call _update() to updates weights in registry and registry. So I authorize all roles together at one time.


- Yongqiao


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review115379
-----------------------------------------------------------


On Jan. 20, 2016, 2:16 p.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Jan. 20, 2016, 2:16 p.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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
>   src/CMakeLists.txt a52203ab9aa47315e6e5c58cc283a7b5df597c76 
>   src/Makefile.am 4fabe600d4ba38c95a777d622b0b675dd5811a53 
>   src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
>   src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
>   src/master/http.cpp 34a70ee50553492fc8c3947497ab5922f4379d72 
>   src/master/master.hpp 3a7e18232323a1c051bcc97915484b1195fffe58 
>   src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
>   src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 
> 
> Diff: https://reviews.apache.org/r/41681/diff/
> 
> 
> Testing
> -------
> 
> Make & Make check successfully!
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [ ], 
>             "name": "*", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 1
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role1", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 4.2
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role2", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.1
>         }
>     ]
> }
> 
> Test update:
> $ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> Test recovuery:
> $ ps -ef | grep mesos-master
> 501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
> $ kill -9 56292
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Adam B <ad...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review115379
-----------------------------------------------------------


Getting close. Just get rid of the special 1.0 behavior and I'll give it a final review.


src/master/http.cpp (line 1297)
<https://reviews.apache.org/r/41681/#comment176365>

    s/update/updates the/



src/master/master.hpp (lines 1556 - 1561)
<https://reviews.apache.org/r/41681/#comment176366>

    We got rid of this excecption in the allocator. Shouldn't we store explicitly set 1.0s in the registry and show them in /roles too?



src/master/weights_handler.cpp (lines 143 - 145)
<https://reviews.apache.org/r/41681/#comment176367>

    Remove, unnecessarily complex.



include/mesos/authorizer/authorizer.hpp (lines 211 - 212)
<https://reviews.apache.org/r/41681/#comment176373>

    s/can update/is allowed to update/
    s/the specified roles/every specified role/



include/mesos/authorizer/authorizer.proto (line 130)
<https://reviews.apache.org/r/41681/#comment176372>

    `UpdateRoleWeights`? In case we end up allowing weights on frameworks too. Else we could use `optional Entity roles` and later add something like `optional Entity frameworkId` and possibly an ObjectType enum.



src/master/http.cpp (line 1294)
<https://reviews.apache.org/r/41681/#comment176377>

    s/weight/weights/



src/master/http.cpp (line 1297)
<https://reviews.apache.org/r/41681/#comment176381>

    s/update weight/updates weights/



src/master/master.hpp (line 1577)
<https://reviews.apache.org/r/41681/#comment176384>

    Can it ever return anything but `true`? Are there any error conditions at all?



src/master/master.cpp (lines 1556 - 1559)
<https://reviews.apache.org/r/41681/#comment176388>

    Remove. Unnecessary complexity. (and then we won't need the `utils::copy(weights)` above)



src/master/master.cpp (line 1562)
<https://reviews.apache.org/r/41681/#comment176389>

    s/if(/if (/



src/master/master.cpp (line 1563)
<https://reviews.apache.org/r/41681/#comment176391>

    s/log //



src/master/master.cpp (line 1565)
<https://reviews.apache.org/r/41681/#comment176390>

    s/updateWeightInfos/weightInfos/?



src/master/master.cpp (line 1566)
<https://reviews.apache.org/r/41681/#comment176392>

    foreachpair? Then you don't have to get `weights[role]`



src/master/master.cpp (line 1572)
<https://reviews.apache.org/r/41681/#comment176393>

    Should this also `allocator->updateWeights(weightInfos);`?



src/master/registry.proto (line 81)
<https://reviews.apache.org/r/41681/#comment176394>

    s/non-default//



src/master/weights_handler.cpp (line 93)
<https://reviews.apache.org/r/41681/#comment176396>

    s/can not/cannot/



src/master/weights_handler.cpp (lines 113 - 115)
<https://reviews.apache.org/r/41681/#comment176395>

    Why are you reconstructing a roles `string` out of the weightInfos instead of just using a `vector`? Does `authorize()` really require a comma-delimited string?
    
    What I was proposing before was that you call `authorize(principal, role)` for each weightInfo.role, and fail if any of those fails.


- Adam B


On Jan. 18, 2016, 6:09 a.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Jan. 18, 2016, 6:09 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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
>   src/CMakeLists.txt 39a23df3227a4f524ea0d408dc894fa5bbab7d10 
>   src/Makefile.am d23e35001078a86775bd9b76baa207ecb9dab7e1 
>   src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
>   src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
>   src/master/http.cpp 34a70ee50553492fc8c3947497ab5922f4379d72 
>   src/master/master.hpp 3a7e18232323a1c051bcc97915484b1195fffe58 
>   src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
>   src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 
> 
> Diff: https://reviews.apache.org/r/41681/diff/
> 
> 
> Testing
> -------
> 
> Make & Make check successfully!
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ 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": 4.2
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role2", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.1
>         }
>     ]
> }
> 
> - Test update:
> $ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1: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.8
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role3", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.4
>         }
>     ]
> }
> 
> - Test recovuery:
> $ ps -ef | grep mesos-master
> 501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
> $ kill -9 56292
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ 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.8
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role3", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.4
>         }
>     ]
> }
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.

> On Feb. 9, 2016, 7:07 a.m., Adam B wrote:
> > src/master/master.cpp, lines 1560-1561
> > <https://reviews.apache.org/r/41681/diff/29-31/?file=1203160#file1203160line1560>
> >
> >     Can you explain more clearly why this needs to be done? Is it because we already initialized the allocator with the weights from --weights?

Yes, when master recovered the weight infos from registry, allocator has been initialized with the weights specified by --weights flag, so we need to do this update.


- Yongqiao


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review118362
-----------------------------------------------------------


On Jan. 25, 2016, 3:36 p.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Jan. 25, 2016, 3:36 p.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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 226441f8cbd6d0828bf1636cc08c21ffcc75e6a7 
>   src/CMakeLists.txt 47d0a7c0fe73b9297cd7dde6086b5e6e9e1f9e4e 
>   src/Makefile.am 8657a869f931aa7482fbb09f2c6df95b6a8c50c6 
>   src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
>   src/authorizer/local/authorizer.cpp 9557bbdf68ff182c4538bbf70cee576d717abc05 
>   src/master/http.cpp 12c1fe5a514903f657911302e8770e9b245fdbb7 
>   src/master/master.hpp 3a7e18232323a1c051bcc97915484b1195fffe58 
>   src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp 5a737a6490060b0194db097990b327c9921221f4 
>   src/tests/mesos.cpp 18d0d8f8037ebc27c87bcb0f1ce9f143e7505ec8 
> 
> Diff: https://reviews.apache.org/r/41681/diff/
> 
> 
> Testing
> -------
> 
> Make & Make check successfully!
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [ ], 
>             "name": "*", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 1
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role1", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 4.2
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role2", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.1
>         }
>     ]
> }
> 
> Test update:
> $ curl --user framework1:secret_string1 --data "[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> Test recovuery:
> $ ps -ef | grep mesos-master
> 501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
> $ kill -9 56292
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Adam B <ad...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review118362
-----------------------------------------------------------



I like the reworking of the recover logic, but I'm still unclear about why you have to tell the allocator to update some weights to 1.0.


src/master/master.hpp (line 1560)
<https://reviews.apache.org/r/41681/#comment179590>

    Nit: Could you swap the order here, so that it matches the check above in `if (weight->info().role() != weightInfo.role()) {`? I think it'll read a bit cleaner, and even align with the line following: `weight->mutable_info()->CopyFrom(weightInfo);`



src/master/master.cpp (line 1548)
<https://reviews.apache.org/r/41681/#comment179591>

    s/alloctor/allocator/



src/master/master.cpp (lines 1548 - 1549)
<https://reviews.apache.org/r/41681/#comment179593>

    Can you explain more clearly why this needs to be done? Is it because we already initialized the allocator with the weights from --weights?


- Adam B


On Jan. 25, 2016, 7:36 a.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Jan. 25, 2016, 7:36 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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 226441f8cbd6d0828bf1636cc08c21ffcc75e6a7 
>   src/CMakeLists.txt 47d0a7c0fe73b9297cd7dde6086b5e6e9e1f9e4e 
>   src/Makefile.am 8657a869f931aa7482fbb09f2c6df95b6a8c50c6 
>   src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
>   src/authorizer/local/authorizer.cpp 9557bbdf68ff182c4538bbf70cee576d717abc05 
>   src/master/http.cpp 12c1fe5a514903f657911302e8770e9b245fdbb7 
>   src/master/master.hpp 3a7e18232323a1c051bcc97915484b1195fffe58 
>   src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp 5a737a6490060b0194db097990b327c9921221f4 
>   src/tests/mesos.cpp 18d0d8f8037ebc27c87bcb0f1ce9f143e7505ec8 
> 
> Diff: https://reviews.apache.org/r/41681/diff/
> 
> 
> Testing
> -------
> 
> Make & Make check successfully!
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [ ], 
>             "name": "*", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 1
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role1", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 4.2
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role2", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.1
>         }
>     ]
> }
> 
> Test update:
> $ curl --user framework1:secret_string1 --data "[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> Test recovuery:
> $ ps -ef | grep mesos-master
> 501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
> $ kill -9 56292
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Adam B <ad...@mesosphere.io>.

> On Feb. 19, 2016, 2:24 a.m., Alexander Rukletsov wrote:
> > src/master/master.hpp, lines 1530-1531
> > <https://reviews.apache.org/r/41681/diff/32/?file=1241338#file1241338line1530>
> >
> >     Let's pull at least the implementation out of the header. You may look at maintenance and quota for inspiration : ).
> >     
> >     Going further, how about extracting registry part into a separate patch? It will make reviewing easier. Also, it would be great to see some registry tests as well.
> 
> Yongqiao Wang wrote:
>     Thanks Alex. Personally, I find it more difficult to review a chain of commits than a single, a single patch can give a whole picture of a feature at a time. In addition, the main reason is Adam has completed to review this patch, if I split it into some small patches, then maybe Adam needs to review them again before commiting them. Can we keep this patch except make the smaller chagnes for addressing comments? can you just review the changes to each file one at a time in the this commit? Based on your comments, I will post another patch for registery test later.
>     
>     For moving the implementation out of the header, I will update this patches later.

I agree with Yongqioa. While patches with <100 lines are quicker/easier to review, this patch is only about 300 new/changed lines, and I like to think I've reviewed it pretty thoroughly already. Please review the patch as is, and let us know if there's anything for which we should block the commit.
We can pull the implementation out of the header in a separate, follow-up patch.
We can also add additional registry tests and/or authz tests in a follow-up patch, if they aren't already covered in https://reviews.apache.org/r/41790/
In the future, we can encourage Yongqiao to break up larger patches earlier in the review process.


- Adam


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review119857
-----------------------------------------------------------


On Feb. 14, 2016, 4:02 a.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Feb. 14, 2016, 4:02 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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 226441f8cbd6d0828bf1636cc08c21ffcc75e6a7 
>   src/CMakeLists.txt 9ab84c0898b3adce6063cc50b04ee74cf1471609 
>   src/Makefile.am 5813ab2c33a7de6b612064e894e5f15b5a474e2b 
>   src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
>   src/authorizer/local/authorizer.cpp 9557bbdf68ff182c4538bbf70cee576d717abc05 
>   src/master/http.cpp f92212bf69f9db51d729347fb553e74e28e105fd 
>   src/master/master.hpp 2f2ad2ada508e1923bf995ab124367a3b082b572 
>   src/master/master.cpp e1ca81dab85a7ab1391eca0d6bd995548bf79c22 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp 242a11658c0a9ba4caced9b2b2bdbcb921f7fdd0 
>   src/tests/mesos.cpp e0f641c6828833de13a0a233e39ff6dc3f343d5c 
> 
> Diff: https://reviews.apache.org/r/41681/diff/
> 
> 
> Testing
> -------
> 
> Make & Make check successfully!
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [ ], 
>             "name": "*", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 1
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role1", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 4.2
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role2", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.1
>         }
>     ]
> }
> 
> Test update:
> $ curl --user framework1:secret_string1 --data "[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> Test recovuery:
> $ ps -ef | grep mesos-master
> 501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
> $ kill -9 56292
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.

> On Feb. 19, 2016, 10:24 a.m., Alexander Rukletsov wrote:
> > src/master/master.hpp, lines 1530-1531
> > <https://reviews.apache.org/r/41681/diff/32/?file=1241338#file1241338line1530>
> >
> >     Let's pull at least the implementation out of the header. You may look at maintenance and quota for inspiration : ).
> >     
> >     Going further, how about extracting registry part into a separate patch? It will make reviewing easier. Also, it would be great to see some registry tests as well.

Thanks Alex. Personally, I find it more difficult to review a chain of commits than a single, a single patch can give a whole picture of a feature at a time. In addition, the main reason is Adam has completed to review this patch, if I split it into some small patches, then maybe Adam needs to review them again before commiting them. Can we keep this patch except make the smaller chagnes for addressing comments? can you just review the changes to each file one at a time in the this commit? Based on your comments, I will post another patch for registery test later.

For moving the implementation out of the header, I will update this patches later.


- Yongqiao


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review119857
-----------------------------------------------------------


On Feb. 14, 2016, 12:02 p.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Feb. 14, 2016, 12:02 p.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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 226441f8cbd6d0828bf1636cc08c21ffcc75e6a7 
>   src/CMakeLists.txt 9ab84c0898b3adce6063cc50b04ee74cf1471609 
>   src/Makefile.am 5813ab2c33a7de6b612064e894e5f15b5a474e2b 
>   src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
>   src/authorizer/local/authorizer.cpp 9557bbdf68ff182c4538bbf70cee576d717abc05 
>   src/master/http.cpp f92212bf69f9db51d729347fb553e74e28e105fd 
>   src/master/master.hpp 2f2ad2ada508e1923bf995ab124367a3b082b572 
>   src/master/master.cpp e1ca81dab85a7ab1391eca0d6bd995548bf79c22 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp 242a11658c0a9ba4caced9b2b2bdbcb921f7fdd0 
>   src/tests/mesos.cpp e0f641c6828833de13a0a233e39ff6dc3f343d5c 
> 
> Diff: https://reviews.apache.org/r/41681/diff/
> 
> 
> Testing
> -------
> 
> Make & Make check successfully!
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [ ], 
>             "name": "*", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 1
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role1", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 4.2
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role2", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.1
>         }
>     ]
> }
> 
> Test update:
> $ curl --user framework1:secret_string1 --data "[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> Test recovuery:
> $ ps -ef | grep mesos-master
> 501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
> $ kill -9 56292
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.

> On Feb. 19, 2016, 10:24 a.m., Alexander Rukletsov wrote:
> > src/master/master.hpp, lines 1530-1531
> > <https://reviews.apache.org/r/41681/diff/32/?file=1241338#file1241338line1530>
> >
> >     Let's pull at least the implementation out of the header. You may look at maintenance and quota for inspiration : ).
> >     
> >     Going further, how about extracting registry part into a separate patch? It will make reviewing easier. Also, it would be great to see some registry tests as well.
> 
> Yongqiao Wang wrote:
>     Thanks Alex. Personally, I find it more difficult to review a chain of commits than a single, a single patch can give a whole picture of a feature at a time. In addition, the main reason is Adam has completed to review this patch, if I split it into some small patches, then maybe Adam needs to review them again before commiting them. Can we keep this patch except make the smaller chagnes for addressing comments? can you just review the changes to each file one at a time in the this commit? Based on your comments, I will post another patch for registery test later.
>     
>     For moving the implementation out of the header, I will update this patches later.
> 
> Adam B wrote:
>     I agree with Yongqioa. While patches with <100 lines are quicker/easier to review, this patch is only about 300 new/changed lines, and I like to think I've reviewed it pretty thoroughly already. Please review the patch as is, and let us know if there's anything for which we should block the commit.
>     We can pull the implementation out of the header in a separate, follow-up patch.
>     We can also add additional registry tests and/or authz tests in a follow-up patch, if they aren't already covered in https://reviews.apache.org/r/41790/
>     In the future, we can encourage Yongqiao to break up larger patches earlier in the review process.

I have posted another patch https://reviews.apache.org/r/43863/ to move the implementation of updateWeights operation out of the header.


- Yongqiao


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review119857
-----------------------------------------------------------


On Feb. 14, 2016, 12:02 p.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Feb. 14, 2016, 12:02 p.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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 226441f8cbd6d0828bf1636cc08c21ffcc75e6a7 
>   src/CMakeLists.txt 9ab84c0898b3adce6063cc50b04ee74cf1471609 
>   src/Makefile.am 5813ab2c33a7de6b612064e894e5f15b5a474e2b 
>   src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
>   src/authorizer/local/authorizer.cpp 9557bbdf68ff182c4538bbf70cee576d717abc05 
>   src/master/http.cpp f92212bf69f9db51d729347fb553e74e28e105fd 
>   src/master/master.hpp 2f2ad2ada508e1923bf995ab124367a3b082b572 
>   src/master/master.cpp e1ca81dab85a7ab1391eca0d6bd995548bf79c22 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp 242a11658c0a9ba4caced9b2b2bdbcb921f7fdd0 
>   src/tests/mesos.cpp e0f641c6828833de13a0a233e39ff6dc3f343d5c 
> 
> Diff: https://reviews.apache.org/r/41681/diff/
> 
> 
> Testing
> -------
> 
> Make & Make check successfully!
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [ ], 
>             "name": "*", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 1
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role1", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 4.2
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role2", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.1
>         }
>     ]
> }
> 
> Test update:
> $ curl --user framework1:secret_string1 --data "[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> Test recovuery:
> $ ps -ef | grep mesos-master
> 501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
> $ kill -9 56292
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Alexander Rukletsov <ru...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review119857
-----------------------------------------------------------



I'd suggest splitting the patch into three parts: authz-related + tests, registry-related + tests, endpoint itself. This way it will be easier to review. Thanks!


src/master/master.hpp (lines 1530 - 1531)
<https://reviews.apache.org/r/41681/#comment181246>

    Let's pull at least the implementation out of the header. You may look at maintenance and quota for inspiration : ).
    
    Going further, how about extracting registry part into a separate patch? It will make reviewing easier. Also, it would be great to see some registry tests as well.


- Alexander Rukletsov


On Feb. 14, 2016, 12:02 p.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Feb. 14, 2016, 12:02 p.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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 226441f8cbd6d0828bf1636cc08c21ffcc75e6a7 
>   src/CMakeLists.txt 9ab84c0898b3adce6063cc50b04ee74cf1471609 
>   src/Makefile.am 5813ab2c33a7de6b612064e894e5f15b5a474e2b 
>   src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
>   src/authorizer/local/authorizer.cpp 9557bbdf68ff182c4538bbf70cee576d717abc05 
>   src/master/http.cpp f92212bf69f9db51d729347fb553e74e28e105fd 
>   src/master/master.hpp 2f2ad2ada508e1923bf995ab124367a3b082b572 
>   src/master/master.cpp e1ca81dab85a7ab1391eca0d6bd995548bf79c22 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp 242a11658c0a9ba4caced9b2b2bdbcb921f7fdd0 
>   src/tests/mesos.cpp e0f641c6828833de13a0a233e39ff6dc3f343d5c 
> 
> Diff: https://reviews.apache.org/r/41681/diff/
> 
> 
> Testing
> -------
> 
> Make & Make check successfully!
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [ ], 
>             "name": "*", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 1
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role1", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 4.2
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role2", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.1
>         }
>     ]
> }
> 
> Test update:
> $ curl --user framework1:secret_string1 --data "[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> Test recovuery:
> $ ps -ef | grep mesos-master
> 501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
> $ kill -9 56292
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.

> On March 8, 2016, 8:07 a.m., Adam B wrote:
> > src/master/master.hpp, lines 1040-1042
> > <https://reviews.apache.org/r/41681/diff/34/?file=1282844#file1282844line1040>
> >
> >     So if I try to update N roles in one request, but I am not authorized to update 1, then I would get back a simple boolean "Forbidden" response, rather than a pointer to which role was unauthorized? I guess the best thing the client/user can do then is just try to update each role individually until one is rejected.
> >     Is there some way we could give back a more helpful error message with the Forbidden response?

Current we do a batch authorization, the called functions `allows` and `matches` only return a `bool` value, so we can not get the detailed Forbidden response. Maybe two solutions can improve it:
1. Enhance `allows` and `matches` to return the Forbidden response.
2. Do authorization one by one, but it will have a worse performance than the corrent implementation.

Can us enhance this in another JIRA later?


- Yongqiao


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review122479
-----------------------------------------------------------


On March 7, 2016, 12:19 p.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated March 7, 2016, 12:19 p.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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 84d2cb3fbff3fbc7c3854d6eec5a3a55ad5760f8 
>   src/CMakeLists.txt 8f57a5701073bf1eaaa223383e928cf5db8f8ae4 
>   src/Makefile.am a41e95ddeb838fdebf4ced953c4a29181916e261 
>   src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
>   src/authorizer/local/authorizer.cpp a1486bd042e1d59e5ac99c2619fb3228c37b9788 
>   src/master/http.cpp 8276baa538eb4d2aaf54cc1aa516bffaadacc4dd 
>   src/master/master.hpp ea26670e6c6c67314406fded510e8fdd46053dc8 
>   src/master/master.cpp 57ff4a39039f573b8586bc03f873f97826b97f6f 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp d36840f6e23e5823332de53061bf6852330bdf0b 
>   src/tests/mesos.cpp e0f641c6828833de13a0a233e39ff6dc3f343d5c 
> 
> Diff: https://reviews.apache.org/r/41681/diff/
> 
> 
> Testing
> -------
> 
> Make & Make check successfully!
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [ ], 
>             "name": "*", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 1
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role1", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 4.2
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role2", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.1
>         }
>     ]
> }
> 
> Test update:
> $ curl --user framework1:secret_string1 --data "[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> Test recovuery:
> $ ps -ef | grep mesos-master
> 501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
> $ kill -9 56292
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Adam B <ad...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review122479
-----------------------------------------------------------


Fix it, then Ship it!




Would love to commit this asap, but we *need* to get the registry tests in with these changes. I'd like to at least do a quick pass over the registry tests first so a) we know we're testing the critical changes, and b) we have confidence that the tests will land in the same release as the endpoint.


include/mesos/authorizer/authorizer.proto (line 138)
<https://reviews.apache.org/r/41681/#comment184481>

    Oops, looks like you copied my typo. Sorry.
    s/updated/update/



src/master/master.cpp (lines 1549 - 1552)
<https://reviews.apache.org/r/41681/#comment184482>

    How about:
    "The registry contains dynamic weights, so static weights should be ignored. We must neutralize (set to 1.0) any weights statically set in `--weights` that are not explicitly overridden by the registry."
    or
    "Before recovering weights from the registry, the allocator was already initialized with `--weights`, so here we need to reset (to 1.0) weights in the allocator that are not overridden by the registry."



src/master/master.hpp (lines 1040 - 1042)
<https://reviews.apache.org/r/41681/#comment184486>

    So if I try to update N roles in one request, but I am not authorized to update 1, then I would get back a simple boolean "Forbidden" response, rather than a pointer to which role was unauthorized? I guess the best thing the client/user can do then is just try to update each role individually until one is rejected.
    Is there some way we could give back a more helpful error message with the Forbidden response?



src/master/master.cpp (lines 1546 - 1547)
<https://reviews.apache.org/r/41681/#comment184498>

    This log message will be easier to read if you wrap the flags value in single-quotes, so it becomes:
    ```
    ... flag '" << flags.weights.get()
    << "', and ...
    ```



src/master/master.cpp (line 1566)
<https://reviews.apache.org/r/41681/#comment184500>

    Why do you need a utils::copy() if `registry_weights` is not const, and will not be used after this?



src/master/master.cpp (lines 1571 - 1572)
<https://reviews.apache.org/r/41681/#comment184502>

    Let's add a comment that "The allocator was already updated with the flag values on startup."



src/master/weights_handler.cpp (line 71)
<https://reviews.apache.org/r/41681/#comment184503>

    How about renaming this to `validatedWeightInfos`? Both this and `weightInfos` are for updating, but only one of these is validated.



src/master/weights_handler.cpp (line 111)
<https://reviews.apache.org/r/41681/#comment184504>

    Why not just s/updateWeightInfos/weightInfos/?


- Adam B


On March 7, 2016, 4:19 a.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated March 7, 2016, 4:19 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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 84d2cb3fbff3fbc7c3854d6eec5a3a55ad5760f8 
>   src/CMakeLists.txt 8f57a5701073bf1eaaa223383e928cf5db8f8ae4 
>   src/Makefile.am a41e95ddeb838fdebf4ced953c4a29181916e261 
>   src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
>   src/authorizer/local/authorizer.cpp a1486bd042e1d59e5ac99c2619fb3228c37b9788 
>   src/master/http.cpp 8276baa538eb4d2aaf54cc1aa516bffaadacc4dd 
>   src/master/master.hpp ea26670e6c6c67314406fded510e8fdd46053dc8 
>   src/master/master.cpp 57ff4a39039f573b8586bc03f873f97826b97f6f 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp d36840f6e23e5823332de53061bf6852330bdf0b 
>   src/tests/mesos.cpp e0f641c6828833de13a0a233e39ff6dc3f343d5c 
> 
> Diff: https://reviews.apache.org/r/41681/diff/
> 
> 
> Testing
> -------
> 
> Make & Make check successfully!
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [ ], 
>             "name": "*", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 1
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role1", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 4.2
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role2", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.1
>         }
>     ]
> }
> 
> Test update:
> $ curl --user framework1:secret_string1 --data "[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> Test recovuery:
> $ ps -ef | grep mesos-master
> 501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
> $ kill -9 56292
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated March 8, 2016, 12:47 p.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Addressed comments of Adam.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp ec6c9928c55c3096c7de634f900419abbdd00886 
  include/mesos/authorizer/authorizer.proto 723da93fa1e968bd98612dd7594b59115050f489 
  src/CMakeLists.txt 8f57a5701073bf1eaaa223383e928cf5db8f8ae4 
  src/Makefile.am a41e95ddeb838fdebf4ced953c4a29181916e261 
  src/authorizer/local/authorizer.hpp 96baf77709cf721caf46b6c2c096a843c1b5d9c0 
  src/authorizer/local/authorizer.cpp 4e5c2c2869823ec957735cebfc80dc850d40f9eb 
  src/master/http.cpp a3ad57a1c3f8a01aa609b28c12825670bb243387 
  src/master/master.hpp ea26670e6c6c67314406fded510e8fdd46053dc8 
  src/master/master.cpp 57ff4a39039f573b8586bc03f873f97826b97f6f 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp 9c62833e0a64cfd62fce8cffd04f9cdd933646c8 
  src/tests/mesos.cpp 395b23d32b2d03aef446858e197cb9788644eefa 

Diff: https://reviews.apache.org/r/41681/diff/


Testing
-------

Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [ ], 
            "name": "*", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 1
        }, 
        {
            "frameworks": [ ], 
            "name": "role1", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 4.2
        }, 
        {
            "frameworks": [ ], 
            "name": "role2", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.1
        }
    ]
}

Test update:
$ curl --user framework1:secret_string1 --data "[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role1",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.8
        },
        {
            "frameworks": [],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}

Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role1",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.8
        },
        {
            "frameworks": [],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}


Thanks,

Yongqiao Wang


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated March 7, 2016, 12:19 p.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
  include/mesos/authorizer/authorizer.proto 84d2cb3fbff3fbc7c3854d6eec5a3a55ad5760f8 
  src/CMakeLists.txt 8f57a5701073bf1eaaa223383e928cf5db8f8ae4 
  src/Makefile.am a41e95ddeb838fdebf4ced953c4a29181916e261 
  src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
  src/authorizer/local/authorizer.cpp a1486bd042e1d59e5ac99c2619fb3228c37b9788 
  src/master/http.cpp 8276baa538eb4d2aaf54cc1aa516bffaadacc4dd 
  src/master/master.hpp ea26670e6c6c67314406fded510e8fdd46053dc8 
  src/master/master.cpp 57ff4a39039f573b8586bc03f873f97826b97f6f 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp d36840f6e23e5823332de53061bf6852330bdf0b 
  src/tests/mesos.cpp e0f641c6828833de13a0a233e39ff6dc3f343d5c 

Diff: https://reviews.apache.org/r/41681/diff/


Testing
-------

Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [ ], 
            "name": "*", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 1
        }, 
        {
            "frameworks": [ ], 
            "name": "role1", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 4.2
        }, 
        {
            "frameworks": [ ], 
            "name": "role2", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.1
        }
    ]
}

Test update:
$ curl --user framework1:secret_string1 --data "[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role1",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.8
        },
        {
            "frameworks": [],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}

Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role1",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.8
        },
        {
            "frameworks": [],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}


Thanks,

Yongqiao Wang


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Feb. 28, 2016, 10:27 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Addressed comments of Adam.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
  include/mesos/authorizer/authorizer.proto 84d2cb3fbff3fbc7c3854d6eec5a3a55ad5760f8 
  src/CMakeLists.txt 49a5645ef7242dbaee31e7b26dbbcb1f4f1f910e 
  src/Makefile.am 2a26261b513bb7c03437ed8e850c3b36b93d82f5 
  src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
  src/authorizer/local/authorizer.cpp a1486bd042e1d59e5ac99c2619fb3228c37b9788 
  src/master/http.cpp f3ce1aa22f5f753fcb254e9ecaa8ba571e3d2829 
  src/master/master.hpp 13c6ff153e77c527822309e787942eb463d59e7d 
  src/master/master.cpp 7c62f2a882a1c89d73f328b2ae665422fd84d7a1 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp 242a11658c0a9ba4caced9b2b2bdbcb921f7fdd0 
  src/tests/mesos.cpp e0f641c6828833de13a0a233e39ff6dc3f343d5c 

Diff: https://reviews.apache.org/r/41681/diff/


Testing
-------

Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [ ], 
            "name": "*", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 1
        }, 
        {
            "frameworks": [ ], 
            "name": "role1", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 4.2
        }, 
        {
            "frameworks": [ ], 
            "name": "role2", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.1
        }
    ]
}

Test update:
$ curl --user framework1:secret_string1 --data "[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role1",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.8
        },
        {
            "frameworks": [],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}

Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role1",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.8
        },
        {
            "frameworks": [],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}


Thanks,

Yongqiao Wang


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Adam B <ad...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review121130
-----------------------------------------------------------



Just a couple of suggested comment rewordings, as I've been looking at a lot of ACLs lately.


include/mesos/authorizer/authorizer.proto (line 141)
<https://reviews.apache.org/r/41681/#comment182774>

    "Which principals are authorized to updated weights for the given roles."



include/mesos/authorizer/authorizer.proto (line 146)
<https://reviews.apache.org/r/41681/#comment182775>

    The list of roles whose weights can be updated.


- Adam B


On Feb. 14, 2016, 4:02 a.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Feb. 14, 2016, 4:02 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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 226441f8cbd6d0828bf1636cc08c21ffcc75e6a7 
>   src/CMakeLists.txt 9ab84c0898b3adce6063cc50b04ee74cf1471609 
>   src/Makefile.am 5813ab2c33a7de6b612064e894e5f15b5a474e2b 
>   src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
>   src/authorizer/local/authorizer.cpp 9557bbdf68ff182c4538bbf70cee576d717abc05 
>   src/master/http.cpp f92212bf69f9db51d729347fb553e74e28e105fd 
>   src/master/master.hpp 2f2ad2ada508e1923bf995ab124367a3b082b572 
>   src/master/master.cpp e1ca81dab85a7ab1391eca0d6bd995548bf79c22 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp 242a11658c0a9ba4caced9b2b2bdbcb921f7fdd0 
>   src/tests/mesos.cpp e0f641c6828833de13a0a233e39ff6dc3f343d5c 
> 
> Diff: https://reviews.apache.org/r/41681/diff/
> 
> 
> Testing
> -------
> 
> Make & Make check successfully!
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [ ], 
>             "name": "*", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 1
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role1", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 4.2
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role2", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.1
>         }
>     ]
> }
> 
> Test update:
> $ curl --user framework1:secret_string1 --data "[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> Test recovuery:
> $ ps -ef | grep mesos-master
> 501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
> $ kill -9 56292
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Feb. 14, 2016, 12:02 p.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Addressed the comments of Adam.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
  include/mesos/authorizer/authorizer.proto 226441f8cbd6d0828bf1636cc08c21ffcc75e6a7 
  src/CMakeLists.txt 9ab84c0898b3adce6063cc50b04ee74cf1471609 
  src/Makefile.am 5813ab2c33a7de6b612064e894e5f15b5a474e2b 
  src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
  src/authorizer/local/authorizer.cpp 9557bbdf68ff182c4538bbf70cee576d717abc05 
  src/master/http.cpp f92212bf69f9db51d729347fb553e74e28e105fd 
  src/master/master.hpp 2f2ad2ada508e1923bf995ab124367a3b082b572 
  src/master/master.cpp e1ca81dab85a7ab1391eca0d6bd995548bf79c22 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp 242a11658c0a9ba4caced9b2b2bdbcb921f7fdd0 
  src/tests/mesos.cpp e0f641c6828833de13a0a233e39ff6dc3f343d5c 

Diff: https://reviews.apache.org/r/41681/diff/


Testing
-------

Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [ ], 
            "name": "*", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 1
        }, 
        {
            "frameworks": [ ], 
            "name": "role1", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 4.2
        }, 
        {
            "frameworks": [ ], 
            "name": "role2", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.1
        }
    ]
}

Test update:
$ curl --user framework1:secret_string1 --data "[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role1",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.8
        },
        {
            "frameworks": [],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}

Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role1",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.8
        },
        {
            "frameworks": [],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}


Thanks,

Yongqiao Wang


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 25, 2016, 3:36 p.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Update JOSN body to remove the key(weights).


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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
  include/mesos/authorizer/authorizer.proto 226441f8cbd6d0828bf1636cc08c21ffcc75e6a7 
  src/CMakeLists.txt 47d0a7c0fe73b9297cd7dde6086b5e6e9e1f9e4e 
  src/Makefile.am 8657a869f931aa7482fbb09f2c6df95b6a8c50c6 
  src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
  src/authorizer/local/authorizer.cpp 9557bbdf68ff182c4538bbf70cee576d717abc05 
  src/master/http.cpp 12c1fe5a514903f657911302e8770e9b245fdbb7 
  src/master/master.hpp 3a7e18232323a1c051bcc97915484b1195fffe58 
  src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp 5a737a6490060b0194db097990b327c9921221f4 
  src/tests/mesos.cpp 18d0d8f8037ebc27c87bcb0f1ce9f143e7505ec8 

Diff: https://reviews.apache.org/r/41681/diff/


Testing (updated)
-------

Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [ ], 
            "name": "*", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 1
        }, 
        {
            "frameworks": [ ], 
            "name": "role1", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 4.2
        }, 
        {
            "frameworks": [ ], 
            "name": "role2", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.1
        }
    ]
}

Test update:
$ curl --user framework1:secret_string1 --data "[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role1",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.8
        },
        {
            "frameworks": [],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}

Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role1",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.8
        },
        {
            "frameworks": [],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}


Thanks,

Yongqiao Wang


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 25, 2016, 3:23 p.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Remove the key(weights) from JSON body to keep consistant with other endpoint (such as /quota).


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
  include/mesos/authorizer/authorizer.proto 226441f8cbd6d0828bf1636cc08c21ffcc75e6a7 
  src/CMakeLists.txt 47d0a7c0fe73b9297cd7dde6086b5e6e9e1f9e4e 
  src/Makefile.am 8657a869f931aa7482fbb09f2c6df95b6a8c50c6 
  src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
  src/authorizer/local/authorizer.cpp 9557bbdf68ff182c4538bbf70cee576d717abc05 
  src/master/http.cpp 12c1fe5a514903f657911302e8770e9b245fdbb7 
  src/master/master.hpp 3a7e18232323a1c051bcc97915484b1195fffe58 
  src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp 5a737a6490060b0194db097990b327c9921221f4 
  src/tests/mesos.cpp 18d0d8f8037ebc27c87bcb0f1ce9f143e7505ec8 

Diff: https://reviews.apache.org/r/41681/diff/


Testing
-------

Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [ ], 
            "name": "*", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 1
        }, 
        {
            "frameworks": [ ], 
            "name": "role1", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 4.2
        }, 
        {
            "frameworks": [ ], 
            "name": "role2", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.1
        }
    ]
}

Test update:
$ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role1",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.8
        },
        {
            "frameworks": [],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}

Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role1",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.8
        },
        {
            "frameworks": [],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}


Thanks,

Yongqiao Wang


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 24, 2016, 5 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Addressed comments of Adam.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
  include/mesos/authorizer/authorizer.proto 226441f8cbd6d0828bf1636cc08c21ffcc75e6a7 
  src/CMakeLists.txt 47d0a7c0fe73b9297cd7dde6086b5e6e9e1f9e4e 
  src/Makefile.am 19bf3a7c2e43ca04ed6e6d506e052de5537f7c2f 
  src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
  src/authorizer/local/authorizer.cpp 9557bbdf68ff182c4538bbf70cee576d717abc05 
  src/master/http.cpp 12c1fe5a514903f657911302e8770e9b245fdbb7 
  src/master/master.hpp 3a7e18232323a1c051bcc97915484b1195fffe58 
  src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp ce6a12d480197d22529b4b50f1c72ce52d271917 
  src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 

Diff: https://reviews.apache.org/r/41681/diff/


Testing
-------

Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [ ], 
            "name": "*", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 1
        }, 
        {
            "frameworks": [ ], 
            "name": "role1", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 4.2
        }, 
        {
            "frameworks": [ ], 
            "name": "role2", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.1
        }
    ]
}

Test update:
$ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role1",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.8
        },
        {
            "frameworks": [],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}

Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role1",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.8
        },
        {
            "frameworks": [],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}


Thanks,

Yongqiao Wang


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Adam B <ad...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review115818
-----------------------------------------------------------



src/master/weights_handler.cpp (lines 92 - 94)
<https://reviews.apache.org/r/41681/#comment176888>

    Rather than using ostringstream directly, you could use stout's `stringify`


- Adam B


On Jan. 20, 2016, 6:16 a.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Jan. 20, 2016, 6:16 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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
>   src/CMakeLists.txt a52203ab9aa47315e6e5c58cc283a7b5df597c76 
>   src/Makefile.am 4fabe600d4ba38c95a777d622b0b675dd5811a53 
>   src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
>   src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
>   src/master/http.cpp 34a70ee50553492fc8c3947497ab5922f4379d72 
>   src/master/master.hpp 3a7e18232323a1c051bcc97915484b1195fffe58 
>   src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
>   src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 
> 
> Diff: https://reviews.apache.org/r/41681/diff/
> 
> 
> Testing
> -------
> 
> Make & Make check successfully!
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [ ], 
>             "name": "*", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 1
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role1", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 4.2
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role2", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.1
>         }
>     ]
> }
> 
> Test update:
> $ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> Test recovuery:
> $ ps -ef | grep mesos-master
> 501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
> $ kill -9 56292
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Mesos ReviewBot <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review115434
-----------------------------------------------------------


Patch looks great!

Reviews applied: [41597, 41681]

Passed command: export OS=ubuntu:14.04;export CONFIGURATION="--verbose";export COMPILER=gcc; ./support/docker_build.sh

- Mesos ReviewBot


On Jan. 20, 2016, 2:16 p.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Jan. 20, 2016, 2:16 p.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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
>   src/CMakeLists.txt a52203ab9aa47315e6e5c58cc283a7b5df597c76 
>   src/Makefile.am 4fabe600d4ba38c95a777d622b0b675dd5811a53 
>   src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
>   src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
>   src/master/http.cpp 34a70ee50553492fc8c3947497ab5922f4379d72 
>   src/master/master.hpp 3a7e18232323a1c051bcc97915484b1195fffe58 
>   src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
>   src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 
> 
> Diff: https://reviews.apache.org/r/41681/diff/
> 
> 
> Testing
> -------
> 
> Make & Make check successfully!
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [ ], 
>             "name": "*", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 1
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role1", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 4.2
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role2", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.1
>         }
>     ]
> }
> 
> Test update:
> $ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> Test recovuery:
> $ ps -ef | grep mesos-master
> 501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
> $ kill -9 56292
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.

> On Jan. 22, 2016, 9:34 a.m., Adam B wrote:
> > src/master/master.hpp, line 1547
> > <https://reviews.apache.org/r/41681/diff/29/?file=1203159#file1203159line1547>
> >
> >     It's a shame we can't store the weights as a map in the registry, so we don't have to iterate through all the registry's weights for each weight being updated.

Cannot agree with you more, maybe we can collect these similar flaws, and improve them before Mesos reach 1.0.


> On Jan. 22, 2016, 9:34 a.m., Adam B wrote:
> > src/master/master.cpp, lines 1544-1550
> > <https://reviews.apache.org/r/41681/diff/29/?file=1203160#file1203160line1544>
> >
> >     Why not combine these two loops rather than iterating twice?

I have updated the logic in recovering the weights, you can have a look.


> On Jan. 22, 2016, 9:34 a.m., Adam B wrote:
> > src/master/master.hpp, line 1568
> > <https://reviews.apache.org/r/41681/diff/29/?file=1203159#file1203159line1568>
> >
> >     Technically, the bool returned represents whether the registry was mutated. If there were no weights, or all weights are "updated" to their existing values, then there is no mutation, so you should return false.
> >     I'm not sure if these use cases are common enough to want to prevent a registrar update (and replication) though. What do you think?

Agree with you.  To improve the performance of replication, I have updated the logic to consider the cases you refered as above.


- Yongqiao


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review115815
-----------------------------------------------------------


On Jan. 24, 2016, 5 a.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Jan. 24, 2016, 5 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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 226441f8cbd6d0828bf1636cc08c21ffcc75e6a7 
>   src/CMakeLists.txt 47d0a7c0fe73b9297cd7dde6086b5e6e9e1f9e4e 
>   src/Makefile.am 19bf3a7c2e43ca04ed6e6d506e052de5537f7c2f 
>   src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
>   src/authorizer/local/authorizer.cpp 9557bbdf68ff182c4538bbf70cee576d717abc05 
>   src/master/http.cpp 12c1fe5a514903f657911302e8770e9b245fdbb7 
>   src/master/master.hpp 3a7e18232323a1c051bcc97915484b1195fffe58 
>   src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp ce6a12d480197d22529b4b50f1c72ce52d271917 
>   src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 
> 
> Diff: https://reviews.apache.org/r/41681/diff/
> 
> 
> Testing
> -------
> 
> Make & Make check successfully!
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [ ], 
>             "name": "*", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 1
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role1", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 4.2
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role2", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.1
>         }
>     ]
> }
> 
> Test update:
> $ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> Test recovuery:
> $ ps -ef | grep mesos-master
> 501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
> $ kill -9 56292
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Adam B <ad...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review115815
-----------------------------------------------------------

Ship it!


Looks good except for a handful of nits. Fix these up and I'll be ready to commit it.


include/mesos/authorizer/authorizer.proto (line 129)
<https://reviews.apache.org/r/41681/#comment176876>

    s/weight/weights/



src/master/master.hpp (lines 1540 - 1543)
<https://reviews.apache.org/r/41681/#comment176878>

    Looks like this can all fit on one line



src/master/master.hpp (line 1547)
<https://reviews.apache.org/r/41681/#comment176880>

    It's a shame we can't store the weights as a map in the registry, so we don't have to iterate through all the registry's weights for each weight being updated.



src/master/master.hpp (line 1568)
<https://reviews.apache.org/r/41681/#comment176879>

    Technically, the bool returned represents whether the registry was mutated. If there were no weights, or all weights are "updated" to their existing values, then there is no mutation, so you should return false.
    I'm not sure if these use cases are common enough to want to prevent a registrar update (and replication) though. What do you think?



src/master/master.cpp (line 1528)
<https://reviews.apache.org/r/41681/#comment176881>

    "After dynamic weights are supported"?
    Doesn't this change introduce support for it?
    How about "After the Mesos master quorum..."



src/master/master.cpp (lines 1531 - 1532)
<https://reviews.apache.org/r/41681/#comment176882>

    "..., so the `--weights` flag can be deprecated and this check can eventually be removed.



src/master/master.cpp (line 1535)
<https://reviews.apache.org/r/41681/#comment176883>

    s/recover/recovering/
    s/non-default //



src/master/master.cpp (lines 1537 - 1540)
<https://reviews.apache.org/r/41681/#comment176885>

    Why not just `weights.clear()`?



src/master/master.cpp (line 1543)
<https://reviews.apache.org/r/41681/#comment176884>

    s/non-default //



src/master/master.cpp (lines 1544 - 1550)
<https://reviews.apache.org/r/41681/#comment176886>

    Why not combine these two loops rather than iterating twice?


- Adam B


On Jan. 20, 2016, 6:16 a.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Jan. 20, 2016, 6:16 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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
>   include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
>   src/CMakeLists.txt a52203ab9aa47315e6e5c58cc283a7b5df597c76 
>   src/Makefile.am 4fabe600d4ba38c95a777d622b0b675dd5811a53 
>   src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
>   src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
>   src/master/http.cpp 34a70ee50553492fc8c3947497ab5922f4379d72 
>   src/master/master.hpp 3a7e18232323a1c051bcc97915484b1195fffe58 
>   src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
>   src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
>   src/master/weights_handler.cpp PRE-CREATION 
>   src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
>   src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 
> 
> Diff: https://reviews.apache.org/r/41681/diff/
> 
> 
> Testing
> -------
> 
> Make & Make check successfully!
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [ ], 
>             "name": "*", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 1
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role1", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 4.2
>         }, 
>         {
>             "frameworks": [ ], 
>             "name": "role2", 
>             "resources": {
>                 "cpus": 0, 
>                 "disk": 0, 
>                 "mem": 0
>             }, 
>             "weight": 3.1
>         }
>     ]
> }
> 
> Test update:
> $ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> Test recovuery:
> $ ps -ef | grep mesos-master
> 501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
> $ kill -9 56292
> 
> $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
> $ curl http://localhost:5050/roles | python -mjson.tool
> {
>     "roles": [
>         {
>             "frameworks": [],
>             "name": "*",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role1",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.8
>         },
>         {
>             "frameworks": [],
>             "name": "role2",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 1.0
>         },
>         {
>             "frameworks": [],
>             "name": "role3",
>             "resources": {
>                 "cpus": 0,
>                 "disk": 0,
>                 "mem": 0
>             },
>             "weight": 3.4
>         }
>     ]
> }
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 20, 2016, 2:16 p.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Addressed comments of Adam.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
  include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
  src/CMakeLists.txt a52203ab9aa47315e6e5c58cc283a7b5df597c76 
  src/Makefile.am 4fabe600d4ba38c95a777d622b0b675dd5811a53 
  src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
  src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
  src/master/http.cpp 34a70ee50553492fc8c3947497ab5922f4379d72 
  src/master/master.hpp 3a7e18232323a1c051bcc97915484b1195fffe58 
  src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
  src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 

Diff: https://reviews.apache.org/r/41681/diff/


Testing (updated)
-------

Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [ ], 
            "name": "*", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 1
        }, 
        {
            "frameworks": [ ], 
            "name": "role1", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 4.2
        }, 
        {
            "frameworks": [ ], 
            "name": "role2", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.1
        }
    ]
}

Test update:
$ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1:5050/weights
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role1",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.8
        },
        {
            "frameworks": [],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}

Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ curl http://localhost:5050/roles | python -mjson.tool
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role1",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.8
        },
        {
            "frameworks": [],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}


Thanks,

Yongqiao Wang


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 18, 2016, 2:09 p.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 (updated)
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs
-----

  include/mesos/authorizer/authorizer.hpp 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
  include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
  src/CMakeLists.txt 39a23df3227a4f524ea0d408dc894fa5bbab7d10 
  src/Makefile.am d23e35001078a86775bd9b76baa207ecb9dab7e1 
  src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
  src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
  src/master/http.cpp 34a70ee50553492fc8c3947497ab5922f4379d72 
  src/master/master.hpp 3a7e18232323a1c051bcc97915484b1195fffe58 
  src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
  src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 

Diff: https://reviews.apache.org/r/41681/diff/


Testing
-------

Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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": 4.2
        }, 
        {
            "frameworks": [ ], 
            "name": "role2", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.1
        }
    ]
}

- Test update:
$ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1: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.8
        }, 
        {
            "frameworks": [ ], 
            "name": "role3", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.4
        }
    ]
}

- Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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.8
        }, 
        {
            "frameworks": [ ], 
            "name": "role3", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.4
        }
    ]
}


Thanks,

Yongqiao Wang


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 18, 2016, 6:50 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description (updated)
-------

Testing Done:
Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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": 4.2
        },
        {
            "frameworks": [ ],
            "name": "role2",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.1
        }
    ]
}

- Test update:
$ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1: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.8
        },
        {
            "frameworks": [ ],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}

- Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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.8
        },
        {
            "frameworks": [ ],
            "name": "role3",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 3.4
        }
    ]
}

Bugs closed: MESOS-4214


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
  include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
  src/CMakeLists.txt 39a23df3227a4f524ea0d408dc894fa5bbab7d10 
  src/Makefile.am d23e35001078a86775bd9b76baa207ecb9dab7e1 
  src/authorizer/local/authorizer.hpp c7321c276d566eca6a91f45c546468bea1b0da15 
  src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
  src/master/http.cpp 34a70ee50553492fc8c3947497ab5922f4379d72 
  src/master/master.hpp 3a7e18232323a1c051bcc97915484b1195fffe58 
  src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
  src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 

Diff: https://reviews.apache.org/r/41681/diff/


Testing
-------

Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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": 4.2
        }, 
        {
            "frameworks": [ ], 
            "name": "role2", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.1
        }
    ]
}

- Test update:
$ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1: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.8
        }, 
        {
            "frameworks": [ ], 
            "name": "role3", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.4
        }
    ]
}

- Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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.8
        }, 
        {
            "frameworks": [ ], 
            "name": "role3", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.4
        }
    ]
}


Thanks,

Yongqiao Wang


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 12, 2016, 7:29 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
  include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
  src/CMakeLists.txt 39a23df3227a4f524ea0d408dc894fa5bbab7d10 
  src/Makefile.am 8cbfb1ba5fa49f2d3cc26ea325838a1c68a79660 
  src/authorizer/local/authorizer.hpp 586f0da19c050e75e20902c376627c8f0b4bf272 
  src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
  src/master/http.cpp bcafc7aff89659a68352f3876ce6042f8b34bd5d 
  src/master/master.hpp f02d165874fa8023675e545793de699aeecae29b 
  src/master/master.cpp 5268408fc63a28afabc27cba96d3ecb360608a65 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
  src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 

Diff: https://reviews.apache.org/r/41681/diff/


Testing
-------

Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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": 4.2
        }, 
        {
            "frameworks": [ ], 
            "name": "role2", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.1
        }
    ]
}

- Test update:
$ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1: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.8
        }, 
        {
            "frameworks": [ ], 
            "name": "role3", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.4
        }
    ]
}

- Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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.8
        }, 
        {
            "frameworks": [ ], 
            "name": "role3", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.4
        }
    ]
}


Thanks,

Yongqiao Wang


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 12, 2016, 4:04 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
  include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
  src/CMakeLists.txt 39a23df3227a4f524ea0d408dc894fa5bbab7d10 
  src/Makefile.am 8cbfb1ba5fa49f2d3cc26ea325838a1c68a79660 
  src/authorizer/local/authorizer.hpp 586f0da19c050e75e20902c376627c8f0b4bf272 
  src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
  src/master/http.cpp bcafc7aff89659a68352f3876ce6042f8b34bd5d 
  src/master/master.hpp f02d165874fa8023675e545793de699aeecae29b 
  src/master/master.cpp 5268408fc63a28afabc27cba96d3ecb360608a65 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
  src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 

Diff: https://reviews.apache.org/r/41681/diff/


Testing
-------

Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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": 4.2
        }, 
        {
            "frameworks": [ ], 
            "name": "role2", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.1
        }
    ]
}

- Test update:
$ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1: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.8
        }, 
        {
            "frameworks": [ ], 
            "name": "role3", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.4
        }
    ]
}

- Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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.8
        }, 
        {
            "frameworks": [ ], 
            "name": "role3", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.4
        }
    ]
}


Thanks,

Yongqiao Wang


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 11, 2016, 2:48 p.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
  include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
  src/CMakeLists.txt 39a23df3227a4f524ea0d408dc894fa5bbab7d10 
  src/Makefile.am 8cbfb1ba5fa49f2d3cc26ea325838a1c68a79660 
  src/authorizer/local/authorizer.hpp 586f0da19c050e75e20902c376627c8f0b4bf272 
  src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
  src/master/http.cpp bcafc7aff89659a68352f3876ce6042f8b34bd5d 
  src/master/master.hpp f02d165874fa8023675e545793de699aeecae29b 
  src/master/master.cpp 2d9b7f9540574aa3ef9e5af3b2b8922dffeebac8 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
  src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 

Diff: https://reviews.apache.org/r/41681/diff/


Testing
-------

Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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": 4.2
        }, 
        {
            "frameworks": [ ], 
            "name": "role2", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.1
        }
    ]
}

- Test update:
$ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1: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.8
        }, 
        {
            "frameworks": [ ], 
            "name": "role3", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.4
        }
    ]
}

- Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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.8
        }, 
        {
            "frameworks": [ ], 
            "name": "role3", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.4
        }
    ]
}


Thanks,

Yongqiao Wang


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 11, 2016, 11:32 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
  include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
  src/CMakeLists.txt 39a23df3227a4f524ea0d408dc894fa5bbab7d10 
  src/Makefile.am 8cbfb1ba5fa49f2d3cc26ea325838a1c68a79660 
  src/authorizer/local/authorizer.hpp 586f0da19c050e75e20902c376627c8f0b4bf272 
  src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
  src/master/http.cpp bcafc7aff89659a68352f3876ce6042f8b34bd5d 
  src/master/master.hpp f02d165874fa8023675e545793de699aeecae29b 
  src/master/master.cpp 2d9b7f9540574aa3ef9e5af3b2b8922dffeebac8 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
  src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 

Diff: https://reviews.apache.org/r/41681/diff/


Testing
-------

Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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": 4.2
        }, 
        {
            "frameworks": [ ], 
            "name": "role2", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.1
        }
    ]
}

- Test update:
$ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1: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.8
        }, 
        {
            "frameworks": [ ], 
            "name": "role3", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.4
        }
    ]
}

- Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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.8
        }, 
        {
            "frameworks": [ ], 
            "name": "role3", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.4
        }
    ]
}


Thanks,

Yongqiao Wang


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 9, 2016, 11:37 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
  include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
  src/CMakeLists.txt 6ae44c76def124bbd1ccd4e6ad510c2fd0bfda5e 
  src/Makefile.am bbd0c119321fa9d11fea61b140428dd92d1258c8 
  src/authorizer/local/authorizer.hpp 586f0da19c050e75e20902c376627c8f0b4bf272 
  src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
  src/master/http.cpp bcafc7aff89659a68352f3876ce6042f8b34bd5d 
  src/master/master.hpp f02d165874fa8023675e545793de699aeecae29b 
  src/master/master.cpp 2d9b7f9540574aa3ef9e5af3b2b8922dffeebac8 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
  src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 

Diff: https://reviews.apache.org/r/41681/diff/


Testing
-------

Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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": 4.2
        }, 
        {
            "frameworks": [ ], 
            "name": "role2", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.1
        }
    ]
}

- Test update:
$ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1: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.8
        }, 
        {
            "frameworks": [ ], 
            "name": "role3", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.4
        }
    ]
}

- Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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.8
        }, 
        {
            "frameworks": [ ], 
            "name": "role3", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.4
        }
    ]
}


Thanks,

Yongqiao Wang


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 9, 2016, 10:24 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 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
  include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
  src/CMakeLists.txt 6ae44c76def124bbd1ccd4e6ad510c2fd0bfda5e 
  src/Makefile.am bbd0c119321fa9d11fea61b140428dd92d1258c8 
  src/authorizer/local/authorizer.hpp 586f0da19c050e75e20902c376627c8f0b4bf272 
  src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
  src/master/http.cpp bcafc7aff89659a68352f3876ce6042f8b34bd5d 
  src/master/master.hpp f02d165874fa8023675e545793de699aeecae29b 
  src/master/master.cpp 2d9b7f9540574aa3ef9e5af3b2b8922dffeebac8 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
  src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 

Diff: https://reviews.apache.org/r/41681/diff/


Testing (updated)
-------

Make & Make check successfully!

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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": 4.2
        }, 
        {
            "frameworks": [ ], 
            "name": "role2", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.1
        }
    ]
}

- Test update:
$ curl --user framework1:secret_string1 --data weights="[{\"weight\":1.8,\"role\":\"role1\"},{\"weight\":1.0,\"role\":\"role2\"},{\"weight\":3.4,\"role\":\"role3\"}]" -X PUT http://127.0.0.1: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.8
        }, 
        {
            "frameworks": [ ], 
            "name": "role3", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.4
        }
    ]
}

- Test recovuery:
$ ps -ef | grep mesos-master
501 56292     1   0  6:18PM ttys001    0:00.31 /Users/yqwyq/Desktop/mesos/build/src/.libs/mesos-master --ip=127.0.0.1 --work_dir=/tmp/mesos-master --weights=role1=4.2,role2=3.1 --authenticate_http --credentials=/opt/credentials.json
$ kill -9 56292

$ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/tmp/mesos-master  --weights="role1=4.2,role2=3.1,role6=9.0" --authenticate_http --credentials=/opt/credentials.json  >> /tmp/mesos-master.log 2>&1 &)
$ 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.8
        }, 
        {
            "frameworks": [ ], 
            "name": "role3", 
            "resources": {
                "cpus": 0, 
                "disk": 0, 
                "mem": 0
            }, 
            "weight": 3.4
        }
    ]
}


Thanks,

Yongqiao Wang


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 8, 2016, 3 p.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Addressed the comments of Adam.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 5ee3c7afadd131802c93febbb6b4dbad069c2d81 
  include/mesos/authorizer/authorizer.proto 84727e66dd14be9a25705ab1141e92eee72fae50 
  src/CMakeLists.txt 6ae44c76def124bbd1ccd4e6ad510c2fd0bfda5e 
  src/Makefile.am bbd0c119321fa9d11fea61b140428dd92d1258c8 
  src/authorizer/local/authorizer.hpp 586f0da19c050e75e20902c376627c8f0b4bf272 
  src/authorizer/local/authorizer.cpp c1db9c2131ea8fbf835278203a240f108c6372c5 
  src/master/http.cpp bcafc7aff89659a68352f3876ce6042f8b34bd5d 
  src/master/master.hpp f02d165874fa8023675e545793de699aeecae29b 
  src/master/master.cpp 2d9b7f9540574aa3ef9e5af3b2b8922dffeebac8 
  src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 
  src/master/weights_handler.cpp PRE-CREATION 
  src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac 
  src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 

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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
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.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 6, 2016, 2:06 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 6, 2016, 1:53 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 5, 2016, 1:40 p.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 5, 2016, 12:55 p.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 (updated)
-----

  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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 5, 2016, 12:51 p.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 (updated)
-----

  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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 5, 2016, 11:39 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 5, 2016, 7:24 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Update the code diff due to the UpdateWeight() interface changes.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 4, 2016, 1:52 p.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp f61613948b7b5c5c2118f1782a0c5f8ff7e8e057 
  include/mesos/authorizer/authorizer.proto 7b729e19484d92be48bbde4dff2c833a4109936e 
  src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
  src/Makefile.am b58d6b560858d318058be766456dd5c5ef98c23e 
  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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Jan. 4, 2016, 11:21 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 19f6e1a2d025bf6ff07f515b10d41e8a48d7d0b4 
  include/mesos/authorizer/authorizer.proto 7b729e19484d92be48bbde4dff2c833a4109936e 
  src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
  src/Makefile.am b58d6b560858d318058be766456dd5c5ef98c23e 
  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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Dec. 31, 2015, 11:54 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Addressed the comments of Jian.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 19f6e1a2d025bf6ff07f515b10d41e8a48d7d0b4 
  include/mesos/authorizer/authorizer.proto 7b729e19484d92be48bbde4dff2c833a4109936e 
  src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
  src/Makefile.am bf71fe6ee65233bbc47a41f610d68ff9760e19f6 
  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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Jian Qiu <qi...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review112368
-----------------------------------------------------------



src/master/master.cpp (line 1445)
<https://reviews.apache.org/r/41681/#comment172839>

    one line?



src/master/master.cpp (line 1467)
<https://reviews.apache.org/r/41681/#comment172852>

    If there is a weight from --weight, and it is also in registry, the updateWeightinfos will have two weighinfo for the same role.



src/master/weights_handler.cpp (line 92)
<https://reviews.apache.org/r/41681/#comment172858>

    <= 0



src/master/weights_handler.cpp (line 101)
<https://reviews.apache.org/r/41681/#comment172864>

    s/existed/exist


- Jian Qiu


On 十二月 30, 2015, 11:54 a.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated 十二月 30, 2015, 11:54 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 19f6e1a2d025bf6ff07f515b10d41e8a48d7d0b4 
>   include/mesos/authorizer/authorizer.proto 7b729e19484d92be48bbde4dff2c833a4109936e 
>   src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
>   src/Makefile.am bf71fe6ee65233bbc47a41f610d68ff9760e19f6 
>   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
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Dec. 30, 2015, 11:54 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 19f6e1a2d025bf6ff07f515b10d41e8a48d7d0b4 
  include/mesos/authorizer/authorizer.proto 7b729e19484d92be48bbde4dff2c833a4109936e 
  src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
  src/Makefile.am bf71fe6ee65233bbc47a41f610d68ff9760e19f6 
  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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Dec. 30, 2015, 8:32 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 19f6e1a2d025bf6ff07f515b10d41e8a48d7d0b4 
  include/mesos/authorizer/authorizer.proto 7b729e19484d92be48bbde4dff2c833a4109936e 
  src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
  src/Makefile.am bf71fe6ee65233bbc47a41f610d68ff9760e19f6 
  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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Dec. 30, 2015, 8:07 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Rebase.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 19f6e1a2d025bf6ff07f515b10d41e8a48d7d0b4 
  include/mesos/authorizer/authorizer.proto 7b729e19484d92be48bbde4dff2c833a4109936e 
  src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
  src/Makefile.am bf71fe6ee65233bbc47a41f610d68ff9760e19f6 
  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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Dec. 29, 2015, 12:51 p.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Add authenrize logic for update weights request.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/authorizer/authorizer.hpp 19f6e1a2d025bf6ff07f515b10d41e8a48d7d0b4 
  include/mesos/authorizer/authorizer.proto 7b729e19484d92be48bbde4dff2c833a4109936e 
  src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
  src/Makefile.am 8af0115caa67ac8f3193d8f0d0f1a4ae739af275 
  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 de9c3b9054611bf65f51df4d499bee927cf4d01d 
  src/tests/mesos.cpp 11ca0519ad0dad44328b6ebdf52c5356fda818b7 

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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Mesos ReviewBot <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review112147
-----------------------------------------------------------


Patch looks great!

Reviews applied: [41597, 41681]

Passed command: export OS=ubuntu:14.04;export CONFIGURATION="--verbose";export COMPILER=gcc; ./support/docker_build.sh

- Mesos ReviewBot


On Dec. 29, 2015, 9:54 a.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Dec. 29, 2015, 9:54 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
> -----
> 
>   src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
>   src/Makefile.am 8af0115caa67ac8f3193d8f0d0f1a4ae739af275 
>   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 
> 
> 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
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Dec. 29, 2015, 9:54 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Add authentication logic.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
  src/Makefile.am 8af0115caa67ac8f3193d8f0d0f1a4ae739af275 
  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 

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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Dec. 29, 2015, 9:03 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Call allocator to update weights.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
  src/Makefile.am 8af0115caa67ac8f3193d8f0d0f1a4ae739af275 
  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 

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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Dec. 29, 2015, 9 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Remove weightinfo from registry when its value is updated to 1.0


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
  src/Makefile.am 8af0115caa67ac8f3193d8f0d0f1a4ae739af275 
  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 

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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Mesos ReviewBot <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/#review112132
-----------------------------------------------------------


Patch looks great!

Reviews applied: [41597, 41681]

Passed command: export OS=ubuntu:14.04;export CONFIGURATION="--verbose";export COMPILER=gcc; ./support/docker_build.sh

- Mesos ReviewBot


On Dec. 29, 2015, 6:40 a.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41681/
> -----------------------------------------------------------
> 
> (Updated Dec. 29, 2015, 6:40 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/mesos.proto 2431fdd6b84625c6140a2b3913736bffada4e7f6 
>   include/mesos/v1/mesos.proto 4aed0980b28dc1000aa2821f35303b736bc5bff8 
>   src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
>   src/Makefile.am 8af0115caa67ac8f3193d8f0d0f1a4ae739af275 
>   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 
> 
> 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
> 
>


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Dec. 29, 2015, 6:40 a.m.)


Review request for mesos, Adam B, Neil Conway, and Qian Zhang.


Changes
-------

Code refactory and add persistence logic.


Bugs: MESOS-4214
    https://issues.apache.org/jira/browse/MESOS-4214


Repository: mesos


Description
-------

Introduce HTTP endpoint /weights for updating weight.


Diffs (updated)
-----

  include/mesos/mesos.proto 2431fdd6b84625c6140a2b3913736bffada4e7f6 
  include/mesos/v1/mesos.proto 4aed0980b28dc1000aa2821f35303b736bc5bff8 
  src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
  src/Makefile.am 8af0115caa67ac8f3193d8f0d0f1a4ae739af275 
  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 

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


Re: Review Request 41681: Introduce HTTP endpoint /weights for updating weight.

Posted by Yongqiao Wang <yq...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41681/
-----------------------------------------------------------

(Updated Dec. 26, 2015, 2:22 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 (updated)
-----

  include/mesos/mesos.proto 2431fdd6b84625c6140a2b3913736bffada4e7f6 
  src/CMakeLists.txt 8169fe4f1a0eda5c2e2b30e22a7346478420a9a0 
  src/Makefile.am 8af0115caa67ac8f3193d8f0d0f1a4ae739af275 
  src/master/http.cpp deb0c8f9852dc0eec1e8c0ff35c684f982e8b110 
  src/master/master.hpp 1cc5531de70bdc0bdce9835c4930dc774406fac9 
  src/master/master.cpp 40ce3e17fca88da689128bcf5d35fdddc396c011 
  src/master/weights_handler.cpp PRE-CREATION 

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