You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by Wenzhao Zhang <wz...@ncsu.edu> on 2017/06/27 14:03:22 UTC
Resource information when executing a docker image
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
Re: Resource information when executing a docker image
Posted by Wenzhao Zhang <wz...@ncsu.edu>.
Thanks everyone, I see this.
I missed some small details.
Wenzhao
On Wed, Jun 28, 2017 at 8:46 AM, Wenzhao Zhang <wz...@ncsu.edu> wrote:
> Hi, Qian:
> Thanks for the response.
> I use command like this, to lunch a docker application:
> ./build/bin/mesos-execute --master=152.54.14.7:5050 --name=test
> --docker_image=mycoy/repository:hello01 --shell=false
>
> It's not mandatory to specify the resource here.
> In this case, what's the resource allocated for this app? I don't see any
> default resource usage allocation in the code?
>
> Thanks
> Wenzhao
>
>
> On Tue, Jun 27, 2017 at 7:49 PM, Qian Zhang <zh...@gmail.com> wrote:
>
>> 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 <wz...@ncsu.edu>
>> 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
>> >
>>
>
>
Re: Resource information when executing a docker image
Posted by Wenzhao Zhang <wz...@ncsu.edu>.
Hi, Qian:
Thanks for the response.
I use command like this, to lunch a docker application:
./build/bin/mesos-execute --master=152.54.14.7:5050 --name=test
--docker_image=mycoy/repository:hello01 --shell=false
It's not mandatory to specify the resource here.
In this case, what's the resource allocated for this app? I don't see any
default resource usage allocation in the code?
Thanks
Wenzhao
On Tue, Jun 27, 2017 at 7:49 PM, Qian Zhang <zh...@gmail.com> wrote:
> 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 <wz...@ncsu.edu> 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
> >
>
Re: Resource information when executing a docker image
Posted by Qian Zhang <zh...@gmail.com>.
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 <wz...@ncsu.edu> 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
>