Hi Wenzhao,
Did you mean how we specify the resources for the task in
"src/cli/execute.cpp"?
Basically there are two ways to launch a task with mesos-execute:
1. You can use the "--task" flag to specify a JSON file which is a
JSON-formatted string of "TaskInfo", and in such file, you can specify the
detailed info for the task that you want to launch, e.g., task name,
command, image and resources:
{
"name": "test",
"task_id": {"value" : "test"},
"agent_id": {"value" : ""},
"resources": [
{
"name": "cpus",
"type": "SCALAR",
"scalar": {
"value": 0.1
},
"role": "*"
},
{
"name": "mem",
"type": "SCALAR",
"scalar": {
"value": 32
},
"role": "*"
}
],
"command": {
"value": ""
},
"container": {
"type": "MESOS",
"mesos": {
"image": {
"type": "DOCKER",
"docker": {
"name": "busybox"
}
}
},
"network_infos": [
{
"name": "net1"
}
]
}
}
2. In addition to the JSON file, you can also specify the detailed info for
the task with individual flags, e.g., --name, --command, --docker_image,
and for the resources, you can use the flag "--resources", e.g.,
--resources=cpus:1;mem:128
Regards,
Qian Zhang
On Tue, Jun 27, 2017 at 10:03 PM, Wenzhao Zhang <[email protected]> wrote:
> Hello, Everyone:
>
> I'm working on Mesos code, and become very confused about the resource
> needed for executing a docker image.
>
> In, "*src/cli/execute.cpp*", *CommandScheduler.offers()*, it pulls out
> the resource from the task, and uses this resource information to check
> whether to accept or decline the offer.
>
> However in CommandScheduler, I don't see anywhere the task's resource is
> updated.
> And in the main() function, where a CommandScheduler object is create, I
> only see a docker-image-string used to create the task-info, still no
> explicit compute resource usage information.
>
> I need this resource information (code level) explicitly. Could anyone help
> me to understand this point?
>
> Thanks
> Wenzhao
>