You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mesos.apache.org by Wenzhao Zhang <wz...@ncsu.edu> on 2017/07/12 13:21:09 UTC

Specify requested resource when running a docker app

Hello, All:

I have a problem of explicitly specify needed request when running a docker
app over Apache Mesos.

if I run,
mesos-execute --master=XXX --containerizer=docker --name=XXX
--docker_image=XXX --shell=false
I understand it defaults to add --resources=cpus:1;mem:128.

But if I explicitly add something like,  --resources=cpus:2;mem:256, or
--resources=mem:512;cpus:2,  only the first resource is accepted by the
mesos-execute,  e.g for  "cpus:2;mem:256"  only "cpus" info is parsed by
Mesos,
the remaining resources are ignored.

It looks like a bug. But I'm not sure of how to bypass it. Could anyone
help me out?
I'm working on Mesos1.2

Thanks very much

Re: Specify requested resource when running a docker app

Posted by Wenzhao Zhang <wz...@ncsu.edu>.
Thanks everyone for the help.
--resources="cpus:2;mem:512"   is the correct way to go.

Wenzhao


On Wed, Jul 12, 2017 at 10:24 PM, Chun-Hung Hsiao <ch...@mesosphere.io>
wrote:

> In your original command, the shell sees you typed in two commands: one
> before the semicolon, and one after it.
> The shell will execute them in sequence, and that's why only the first
> resource requirement is applied, since only the first one is included in
> the command.
>
> The backquotes in Jen's reply is just used to quote the parameters you
> want to put in the command line. Don't add backquotes themselves!
> Otherwise the shell would try to run the command  [
> --resource="cpus:2;mem:256" ], which is an invalid command so it would
> return a null string,
> and print "command not found" in the standard error stream; then, the
> shell plugs the null string into your command, and that's why it's ignored.
>
> On Wed, Jul 12, 2017 at 5:25 PM, Qian Zhang <zh...@gmail.com> wrote:
>
>> You need to put cpus:2;mem:256 into double quote, like
>> --resources="cpus:2;mem:256", I tried it with the latest Mesos code, it
>> works well.
>>
>>
>> Regards,
>> Qian Zhang
>>
>> On Wed, Jul 12, 2017 at 11:49 PM, Wenzhao Zhang <wz...@ncsu.edu>
>> wrote:
>>
>>> Hi, Jan:
>>>
>>> I've tried `--resources="cpus:2;mem:256"`,   but in this way, it seems
>>> that Mesos ignores the input entirely,  it just uses the default option (
>>> cpus:1;mem:128).
>>>
>>> Thanks
>>>
>>> On Wed, Jul 12, 2017 at 10:27 AM, Jan Schlicht <ja...@mesosphere.io>
>>> wrote:
>>>
>>>> Do you use quotes when specifying the resources? I.e.
>>>> `--resources="cpus:2;mem:256"`? If you don't, the semicolon will be
>>>> treated as a command separator.
>>>>
>>>> On Wed, Jul 12, 2017 at 3:21 PM, Wenzhao Zhang <wz...@ncsu.edu>
>>>> wrote:
>>>>
>>>>> Hello, All:
>>>>>
>>>>> I have a problem of explicitly specify needed request when running a
>>>>> docker app over Apache Mesos.
>>>>>
>>>>> if I run,
>>>>> mesos-execute --master=XXX --containerizer=docker --name=XXX
>>>>> --docker_image=XXX --shell=false
>>>>> I understand it defaults to add --resources=cpus:1;mem:128.
>>>>>
>>>>> But if I explicitly add something like,  --resources=cpus:2;mem:256,
>>>>> or --resources=mem:512;cpus:2,  only the first resource is accepted by the
>>>>> mesos-execute,  e.g for  "cpus:2;mem:256"  only "cpus" info is parsed by
>>>>> Mesos,
>>>>> the remaining resources are ignored.
>>>>>
>>>>> It looks like a bug. But I'm not sure of how to bypass it. Could
>>>>> anyone help me out?
>>>>> I'm working on Mesos1.2
>>>>>
>>>>> Thanks very much
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *Jan Schlicht*
>>>> Distributed Systems Engineer, Mesosphere
>>>>
>>>
>>>
>>
>

Re: Specify requested resource when running a docker app

Posted by Chun-Hung Hsiao <ch...@mesosphere.io>.
In your original command, the shell sees you typed in two commands: one
before the semicolon, and one after it.
The shell will execute them in sequence, and that's why only the first
resource requirement is applied, since only the first one is included in
the command.

The backquotes in Jen's reply is just used to quote the parameters you want
to put in the command line. Don't add backquotes themselves!
Otherwise the shell would try to run the command  [
--resource="cpus:2;mem:256" ], which is an invalid command so it would
return a null string,
and print "command not found" in the standard error stream; then, the shell
plugs the null string into your command, and that's why it's ignored.

On Wed, Jul 12, 2017 at 5:25 PM, Qian Zhang <zh...@gmail.com> wrote:

> You need to put cpus:2;mem:256 into double quote, like
> --resources="cpus:2;mem:256", I tried it with the latest Mesos code, it
> works well.
>
>
> Regards,
> Qian Zhang
>
> On Wed, Jul 12, 2017 at 11:49 PM, Wenzhao Zhang <wz...@ncsu.edu> wrote:
>
>> Hi, Jan:
>>
>> I've tried `--resources="cpus:2;mem:256"`,   but in this way, it seems
>> that Mesos ignores the input entirely,  it just uses the default option (
>> cpus:1;mem:128).
>>
>> Thanks
>>
>> On Wed, Jul 12, 2017 at 10:27 AM, Jan Schlicht <ja...@mesosphere.io> wrote:
>>
>>> Do you use quotes when specifying the resources? I.e.
>>> `--resources="cpus:2;mem:256"`? If you don't, the semicolon will be
>>> treated as a command separator.
>>>
>>> On Wed, Jul 12, 2017 at 3:21 PM, Wenzhao Zhang <wz...@ncsu.edu>
>>> wrote:
>>>
>>>> Hello, All:
>>>>
>>>> I have a problem of explicitly specify needed request when running a
>>>> docker app over Apache Mesos.
>>>>
>>>> if I run,
>>>> mesos-execute --master=XXX --containerizer=docker --name=XXX
>>>> --docker_image=XXX --shell=false
>>>> I understand it defaults to add --resources=cpus:1;mem:128.
>>>>
>>>> But if I explicitly add something like,  --resources=cpus:2;mem:256, or
>>>> --resources=mem:512;cpus:2,  only the first resource is accepted by the
>>>> mesos-execute,  e.g for  "cpus:2;mem:256"  only "cpus" info is parsed by
>>>> Mesos,
>>>> the remaining resources are ignored.
>>>>
>>>> It looks like a bug. But I'm not sure of how to bypass it. Could anyone
>>>> help me out?
>>>> I'm working on Mesos1.2
>>>>
>>>> Thanks very much
>>>>
>>>
>>>
>>>
>>> --
>>> *Jan Schlicht*
>>> Distributed Systems Engineer, Mesosphere
>>>
>>
>>
>

Re: Specify requested resource when running a docker app

Posted by Qian Zhang <zh...@gmail.com>.
You need to put cpus:2;mem:256 into double quote, like
--resources="cpus:2;mem:256",
I tried it with the latest Mesos code, it works well.


Regards,
Qian Zhang

On Wed, Jul 12, 2017 at 11:49 PM, Wenzhao Zhang <wz...@ncsu.edu> wrote:

> Hi, Jan:
>
> I've tried `--resources="cpus:2;mem:256"`,   but in this way, it seems
> that Mesos ignores the input entirely,  it just uses the default option (
> cpus:1;mem:128).
>
> Thanks
>
> On Wed, Jul 12, 2017 at 10:27 AM, Jan Schlicht <ja...@mesosphere.io> wrote:
>
>> Do you use quotes when specifying the resources? I.e.
>> `--resources="cpus:2;mem:256"`? If you don't, the semicolon will be
>> treated as a command separator.
>>
>> On Wed, Jul 12, 2017 at 3:21 PM, Wenzhao Zhang <wz...@ncsu.edu> wrote:
>>
>>> Hello, All:
>>>
>>> I have a problem of explicitly specify needed request when running a
>>> docker app over Apache Mesos.
>>>
>>> if I run,
>>> mesos-execute --master=XXX --containerizer=docker --name=XXX
>>> --docker_image=XXX --shell=false
>>> I understand it defaults to add --resources=cpus:1;mem:128.
>>>
>>> But if I explicitly add something like,  --resources=cpus:2;mem:256, or
>>> --resources=mem:512;cpus:2,  only the first resource is accepted by the
>>> mesos-execute,  e.g for  "cpus:2;mem:256"  only "cpus" info is parsed by
>>> Mesos,
>>> the remaining resources are ignored.
>>>
>>> It looks like a bug. But I'm not sure of how to bypass it. Could anyone
>>> help me out?
>>> I'm working on Mesos1.2
>>>
>>> Thanks very much
>>>
>>
>>
>>
>> --
>> *Jan Schlicht*
>> Distributed Systems Engineer, Mesosphere
>>
>
>

Re: Specify requested resource when running a docker app

Posted by Wenzhao Zhang <wz...@ncsu.edu>.
Hi, Jan:

I've tried `--resources="cpus:2;mem:256"`,   but in this way, it seems that
Mesos ignores the input entirely,  it just uses the default option (
cpus:1;mem:128).

Thanks

On Wed, Jul 12, 2017 at 10:27 AM, Jan Schlicht <ja...@mesosphere.io> wrote:

> Do you use quotes when specifying the resources? I.e.
> `--resources="cpus:2;mem:256"`? If you don't, the semicolon will be
> treated as a command separator.
>
> On Wed, Jul 12, 2017 at 3:21 PM, Wenzhao Zhang <wz...@ncsu.edu> wrote:
>
>> Hello, All:
>>
>> I have a problem of explicitly specify needed request when running a
>> docker app over Apache Mesos.
>>
>> if I run,
>> mesos-execute --master=XXX --containerizer=docker --name=XXX
>> --docker_image=XXX --shell=false
>> I understand it defaults to add --resources=cpus:1;mem:128.
>>
>> But if I explicitly add something like,  --resources=cpus:2;mem:256, or
>> --resources=mem:512;cpus:2,  only the first resource is accepted by the
>> mesos-execute,  e.g for  "cpus:2;mem:256"  only "cpus" info is parsed by
>> Mesos,
>> the remaining resources are ignored.
>>
>> It looks like a bug. But I'm not sure of how to bypass it. Could anyone
>> help me out?
>> I'm working on Mesos1.2
>>
>> Thanks very much
>>
>
>
>
> --
> *Jan Schlicht*
> Distributed Systems Engineer, Mesosphere
>

Re: Specify requested resource when running a docker app

Posted by Jan Schlicht <ja...@mesosphere.io>.
Do you use quotes when specifying the resources? I.e.
`--resources="cpus:2;mem:256"`? If you don't, the semicolon will be treated
as a command separator.

On Wed, Jul 12, 2017 at 3:21 PM, Wenzhao Zhang <wz...@ncsu.edu> wrote:

> Hello, All:
>
> I have a problem of explicitly specify needed request when running a
> docker app over Apache Mesos.
>
> if I run,
> mesos-execute --master=XXX --containerizer=docker --name=XXX
> --docker_image=XXX --shell=false
> I understand it defaults to add --resources=cpus:1;mem:128.
>
> But if I explicitly add something like,  --resources=cpus:2;mem:256, or
> --resources=mem:512;cpus:2,  only the first resource is accepted by the
> mesos-execute,  e.g for  "cpus:2;mem:256"  only "cpus" info is parsed by
> Mesos,
> the remaining resources are ignored.
>
> It looks like a bug. But I'm not sure of how to bypass it. Could anyone
> help me out?
> I'm working on Mesos1.2
>
> Thanks very much
>



-- 
*Jan Schlicht*
Distributed Systems Engineer, Mesosphere