Hi @Haosdent, i have done your steps, yes, it works; But marathon does not
cosume `dev` resources,
it uses default role resource instead:
```
# curl 10.132.46.71:5050/slaves | python -m json.tool
"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": 31967,
"end": 31967
}
]
},
"role": "*",
"type": "RANGES"
}
],
"version": "0.28.1"
```
@Guangya, so it should not be A DC/OS issue, it related to mesos, or maybe
marathon.
--
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]> 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