DC/OS 服务中如何指定自定义资源?

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

我已将名为 my_resource 的自定义资源添加到我的代理节点,但我不知道如何在服务中使用它。

我已经使用 CLI 命令 dcos node --json 验证了我的自定义资源正确显示:

...
"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
},
...

如何在服务中指定自定义资源?我尝试了以下 JSON:

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

但是 my_resource 行在我 运行 时从服务定义中消失了:dcos marathon app add test_custom_resource.json

遗憾的是,Marathon 尚不支持任意资源。请参阅 this Marathon ticket 了解更多信息。