mesosmesospheredcos

How are custom resources specified in a DC/OS service?


I have added a custom resource called my_resource to my agent nodes but I can't figure out how to use it in a service.

I have verified that my custom resource shows up correctly using the CLI command dcos node --json which shows:

...
"unreserved_resources": {
  "cpus": 12.0,
  "disk": 174179.0,
  "gpus": 3.0,
  "mem": 31052.0,
  "ports": "[1025-2180, 2182-3887, 3889-5049, 5052-8079, 8082-8180, 8182-32000]",
  "my_resource": 3.0
},
...

How do I specify the custom resource in a service? I've tried the following JSON:

{
 "id": "test-custom-resource",
 "cmd": "while [ true ] ; do sleep 5; done",
 "cpus": 1,
 "mem": 128,
 "disk": 0,
 "instances": 1,
 "my_resource": 1
}

but the my_resource line disappears from the service definition when I run it: dcos marathon app add test_custom_resource.json


Solution

  • Unfortunately, arbitrary resources are not supported in Marathon yet. Please, see this Marathon ticket for more information.