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

Reply via email to