@Guangya, I tried with default_accepted_resource_roles option set to `dev`; 
same result, marathon can not start new tasks, waiting for resources.

@Guangya, @Haosdent, yes, on slave side, slave reports the resource consumed 
comes from `*` role;  
```
[root@localhost ~]# curl http://10.132.46.71:5050/slaves | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1091  100  1091    0     0   179k      0 --:--:-- --:--:-- --:--:--  213k
{
    "slaves": [
        {
            "active": true,
            "attributes": {},
            "hostname": "10.132.46.71",
            "id": "439a851d-aa09-47af-bc68-d5588dc9f5da-S0",
            "offered_resources": {
                "cpus": 0.0,
                "disk": 0.0,
                "mem": 0.0
            },
            "offered_resources_full": [],
            "pid": "slave(1)@10.132.46.71:5051",
            "registered_time": 1462091019.95277,
            "reregistered_time": 1462091019.95438,
            "reserved_resources": {
                "dev": {
                    "cpus": 2.0,
                    "disk": 0.0,
                    "mem": 1024.0
                }
            },
            "reserved_resources_full": {
                "dev": [
                    {
                        "name": "cpus",
                        "reservation": {},
                        "role": "dev",
                        "scalar": {
                            "value": 2.0
                        },
                        "type": "SCALAR"
                    },
                    {
                        "name": "mem",
                        "reservation": {},
                        "role": "dev",
                        "scalar": {
                            "value": 1024.0
                        },
                        "type": "SCALAR"
                    }
                ]
            },
            "resources": {
                "cpus": 4.0,
                "disk": 46055.0,
                "mem": 6727.0,
                "ports": "[31000-32000]"
            },
            "unreserved_resources": {
                "cpus": 2.0,
                "disk": 46055.0,
                "mem": 5703.0,
                "ports": "[31000-32000]"
            },
            "used_resources": {
                "cpus": 1.0,
                "disk": 0.0,
                "mem": 128.0,
                "ports": "[31994-31994]"
            },
            "used_resources_full": [
                {
                    "name": "cpus",
                    "role": "*",
                    "scalar": {
                        "value": 1.0
                    },
                    "type": "SCALAR"
                },
                {
                    "name": "mem",
                    "role": "*",
                    "scalar": {
                        "value": 128.0
                    },
                    "type": "SCALAR"
                },
                {
                    "name": "ports",
                    "ranges": {
                        "range": [
                            {
                                "begin": 31994,
                                "end": 31994
                            }
                        ]
                    },
                    "role": "*",
                    "type": "RANGES"
                }
            ],
            "version": "0.28.1"
        }
    ]
}
```


while, on the master side, when curl http://10.132.46.71:5050/roles, it shows 
the resource comes from
`dev` role; 


```
[root@localhost ~]# curl http://10.132.46.71:5050/roles | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   250  100   250    0     0  46772      0 --:--:-- --:--:-- --:--:-- 50000
{
    "roles": [
        {
            "frameworks": [],
            "name": "*",
            "resources": {
                "cpus": 0,
                "disk": 0,
                "mem": 0
            },
            "weight": 1.0
        },
        {
            "frameworks": [
                "439a851d-aa09-47af-bc68-d5588dc9f5da-0002"
            ],
            "name": "dev",
            "resources": {
                "cpus": 1.0,
                "disk": 0,
                "mem": 128.0,
                "ports": "[31994-31994]"
            },
            "weight": 1.0
        }
    ]
}
```

moreover, when i reserve all resources(dynamic reservation) from default role 
to `dev` role, not a single task can start on that slave, either declaring use 
`dev` resource or `*` resource.
```
  "reserved_resources": {
                "dev": {
                    "cpus": 4.0,
                    "disk": 0.0,
                    "mem": 6727.0
                }
            },
            "reserved_resources_full": {
                "dev": [
                    {
                        "name": "mem",
                        "reservation": {},
                        "role": "dev",
                        "scalar": {
                            "value": 6727.0
                        },
                        "type": "SCALAR"
                    },
                    {
                        "name": "cpus",
                        "reservation": {},
                        "role": "dev",
                        "scalar": {
                            "value": 4.0
                        },
                        "type": "SCALAR"
                    }
                ]
            },
            "resources": {
                "cpus": 4.0,
                "disk": 46055.0,
                "mem": 6727.0,
                "ports": "[31000-32000]"
            },
            "unreserved_resources": {
                "cpus": 0.0,
                "disk": 46055.0,
                "mem": 0.0,
                "ports": "[31000-32000]"
            },
```

@Haosdent, can u post your master:5050/slaves? i think this should be the issue.
--
Best Regards,

GaoJin CAO 
ChinaMobile(Suzhou) R&D
Mail:caogaojin at cmss.chinamobile.com <http://cmss.chinamobile.com/>
> On May 1, 2016, at 15:32, Guangya Liu <[email protected]> wrote:
> 
> Not sure if you need add a new parameter default_accepted_resource_roles , 
> even if you start marathon with role dev, it can still get resources from 
> both role dev and *. 
> 
> Please refer to 
> https://github.com/mesosphere/marathon/blob/master/docs/docs/command-line-flags.md
>  
> <https://github.com/mesosphere/marathon/blob/master/docs/docs/command-line-flags.md>
>  for marathon configuration.
> 
> v0.9.0 --default_accepted_resource_roles (Optional. Default: all roles): 
> Default for the "acceptedResourceRoles"attribute as a comma-separated list of 
> strings. All app definitions which do not specify this attribute explicitly 
> use this value for launching new tasks. Examples: *, production,*, production
> 
> On Sun, May 1, 2016 at 3:21 PM, haosdent <[email protected] 
> <mailto:[email protected]>> wrote:
> could you show the result of curl 10.132.46.71:5050/ 
> <http://10.132.46.71:5050/slaves>roles  It shows consume "dev" in my side.
> 
> On Sun, May 1, 2016 at 3:04 PM, caogaojin <[email protected] 
> <mailto:[email protected]>> wrote:
> @Haosdent, by the way, i’m using mesos:0.28.1, not the master branch. and 
> marathon version is 1.1.1
>  
> --
> Best Regards,
> 
> GaoJin CAO 
> ChinaMobile(Suzhou) R&D
> Mail:caogaojin at cmss.chinamobile.com <http://cmss.chinamobile.com/>
>> On May 1, 2016, at 14:04, haosdent <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> Hi, @caogaoin. I try in with the master branch of Mesos and Marathon. And it 
>> works fine for me.
>> 
>> 
>> ```
>> INFO Finished processing dda04940-55b6-4ba7-a7bb-75c2108f3151-O8. Matched 1 
>> ops after 2 passes. cpus(dev) 2.0; mem(dev) 1024.0; cpus(*) 5.0; mem(*) 
>> 29808.0; disk(*) 915273.0; ports(*) 31000->31254,31256->32000 left. 
>> (mesosphere.marathon.core.matcher.manager.impl.OfferMatcherManagerActor:marathon-akka.actor.default-dispatcher-2)
>> ```
>> 
>> Let me list my verify steps to help you find your problem when start your 
>> tasks.
>> 
>> 1. start Mesos master and agent, and reserve resources for dev.
>> 
>> ```
>> $ ./bin/mesos-master.sh --work_dir=/tmp/mesos --ip=127.0.0.1 
>> --hostname=127.0.0.1
>> 
>> $ ./bin/mesos-slave.sh --work_dir=/tmp/mesos --ip=127.0.0.1 
>> --hostname=127.0.0.1 --master=127.0.0.1:5050 <http://127.0.0.1:5050/>
>> 
>> 
>> $ curl -i -d slaveId=dda04940-55b6-4ba7-a7bb-75c2108f3151-S0 \
>> -d resources='[
>> {
>>             "name": "cpus",
>>             "type": "SCALAR",
>>             "scalar": {
>>               "value": 2.0
>>             },
>>             "role": "dev",
>>               "reservation": {
>>               }
>> 
>> },
>> {
>>             "name": "mem",
>>             "type": "SCALAR",
>>             "scalar": {
>>               "value": 1024.0
>> 
>>             },
>>             "role": "dev",
>>               "reservation": {
>>               }
>> }
>> ]' -X POST http://127.0.0.1:5050/reserve <http://127.0.0.1:5050/reserve>
>> 
>> 2. start Marathon with dev role
>> 
>> ```
>> ./bin/start --master 127.0.0.1:5050 <http://127.0.0.1:5050/> --zk 
>> zk://10.10.120.61:2181/marathon <http://10.10.120.61:2181/marathon> 
>> --mesos_role dev
>> ```
>> 
>> 3. start task
>> 
>> ```
>> $ cat task.json
>> {
>>     "id": "/test-health",
>>     "cmd": "sleep 200",
>>     "cpus": 1.0,
>>     "mem": 128.0
>> }
>> 
>> $ curl -X POST -H "Content-type: application/json" 
>> http://127.0.0.1:8080/v2/apps <http://127.0.0.1:8080/v2/apps> -d @task.json
>> ```
>> 
>> On Sun, May 1, 2016 at 12:18 PM, haosdent <[email protected] 
>> <mailto:[email protected]>> wrote:
>> Sorry for make you confusing before. The offer looks match resource 
>> requirement according to your log, let me reproduce it first.
>> 
>> On Sun, May 1, 2016 at 8:57 AM, Guangya Liu <[email protected] 
>> <mailto:[email protected]>> wrote:
>> Gaojin,
>> 
>> Some questions and suggestions here:
>> 
>> 1) How did you deploy the nginx with new marathon URI? I did not found that 
>> I can configure the new marathon URI with nginx.
>> 
>> 2) Can you please send out the curl output for your master node:
>>     a) curl "http://master-ip:5050/master/slaves 
>> <http://9.21.51.123:5050/master/slaves>" 2>/dev/null|python -m json.tool 
>> 
>>    b) curl "http://master-ip:5050/master/state 
>> <http://9.21.51.123:5050/master/slaves>" 2>/dev/null|python -m json.tool 
>> 
>> 3) For open source DC/OS issues, it is suggested to post your question to 
>> [email protected] <mailto:[email protected]> where you can always get instant and 
>> professional support.
>> 
>> Thanks,
>> 
>> Guangya
>> 
>> 
>> On Sun, May 1, 2016 at 1:49 AM, caogaojin <[email protected] 
>> <mailto:[email protected]>> wrote:
>> Hi list,
>> 
>> I’m currently using dynamic reservation mechanism with mesosphere/DCOS 1.7, 
>> the opensourced version, 
>> and something wired just happened. I tried to setup a new marathon service 
>> from the universe repo, 
>> and i did a slight modification, setting mesos_role to `dev`. i also turned 
>> off mesos anthentication 
>> mechenism. 
>> 
>> My steps are:
>> 
>> First i tried to reserve 2 cpu and 1743 ram to `dev` role using http 
>> endpoint, and it works:
>> # curl -i -d slaveId=e6d590b1-5f2d-4be9-93fd-2fac364584cf-S11 \
>> -d resources='[
>> {
>>             "name": "cpus",
>>             "type": "SCALAR",
>>             "scalar": {
>>               "value": 2.0
>>             },
>>             "role": "dev",
>>               "reservation": {
>>               }
>> 
>> },
>> {
>>             "name": "mem",
>>             "type": "SCALAR",
>>             "scalar": {
>>               "value": 1024.0
>> 
>>             },
>>             "role": "dev",
>>               "reservation": {
>>               }
>> }
>> ]' -X POST http://10.132.46.81:5050/unreserve 
>> <http://10.132.46.81:5050/unreserve>
>> 
>> Second, the slave shows following infomation:
>> # curl http://10.132.46.81/mesos/slaves <http://10.132.46.81/mesos/slaves>
>> reserved_resources_full: {
>> dev: [
>> {
>> name: "cpus",
>> type: "SCALAR",
>> scalar: {
>> value: 2
>> },
>> role: "dev",
>> reservation: { }
>> },
>> {
>> name: "mem",
>> type: "SCALAR",
>> scalar: {
>> value: 1743
>> },
>> role: "dev",
>> reservation: { }
>> }
>> ]
>> },
>> 
>> Third, i tried to run nginx using the new marathon service, which i also set 
>> the task only accept `dev` resources, 
>> 
>> ID: /nginx
>> ...
>> Resource Roles:  dev
>> 
>> 4.  on marathon ui i just see the waiting status, which means there’s no 
>> suitable resource offer, marathon reports:
>> 
>> Insufficient resources for [/nginx] (need cpus=1.0, mem=128.0, disk=0.0, 
>> ports=(1 dynamic), available in offer: [id { value: 
>> "e6d590b1-5f2d-4be9-93fd-2fac364584cf-O7476" } framework_id { value: 
>> "e6d590b1-5f2d-4be9-93fd-2fac364584cf-0006" } slave_id { value: 
>> "e6d590b1-5f2d-4be9-93fd-2fac364584cf-S11" } hostname: "10.132.46.84" 
>> resources { name: "ports" type: RANGES ranges { range { begin: 8182 end: 
>> 32000 } } role: "dev" reservation { } } resources { name: "cpus" type: 
>> SCALAR scalar { value: 2.0 } role: "dev" reservation { } } resources { name: 
>> "mem" type: SCALAR scalar { value: 1743.0 } role: "dev" reservation { } } 
>> resources { name: "ports" type: RANGES ranges { range { begin: 1025 end: 
>> 2180 } range { begin: 2182 end: 3887 } range { begin: 3889 end: 5049 } range 
>> { begin: 5052 end: 6326 } range { begin: 6328 end: 8079 } range { begin: 
>> 8082 end: 8180 } } role: "*" } resources { name: "disk" type: SCALAR scalar 
>> { value: 41497.0 } role: "*" } resources { name: "cpus" type: SCALAR scalar 
>> { value: 1.0 } role: "*" } resources { name: "mem" type: SCALAR scalar { 
>> value: 896.0 } role: "*" } url { scheme: "http" address { hostname: 
>> "10.132.46.84" ip: "10.132.46.84" port: 5051 } path: "/slave(1)" }] 
>> (mesosphere.mesos.TaskBuilder:marathon-akka.actor.default-dispatcher-19)
>> 
>> can anyone help me with this?
>> 
>> thank you.
>> 
>> 
>> GaoJin CAO 
>> ChinaMobile(Suzhou) R&D
>> Phone:18896723732 
>> Mail:caogaojin at cmss.chinamobile.com <http://cmss.chinamobile.com/>
>> 
>> 
>> 
>> 
>> -- 
>> Best Regards,
>> Haosdent Huang
>> 
>> 
>> 
>> -- 
>> Best Regards,
>> Haosdent Huang
> 
> 
> 
> 
> -- 
> Best Regards,
> Haosdent Huang
> 

Reply via email to