* Separate taskset arguments from the command arguments @ 2016-02-27 18:46 Akshay Adiga 2016-02-27 22:52 ` Yuriy M. Kaminskiy 0 siblings, 1 reply; 4+ messages in thread From: Akshay Adiga @ 2016-02-27 18:46 UTC (permalink / raw) To: util-linux Hi, I want to run a command which looks something like this : taskset -c 10 ycsb -p "redis_host=1234" The actual command is : ycsb -p "redis_host=1234" But argument -p "redis_host=1234" is taken by taskset as it argument and throws an error : Failed to set pid 0's affinity: -p "redis_host=1234" is an argument to ycsb command. shell/tasket misunderstands that and takes it as an argument for taskset. Is there a work around for this? -- Regards -- Akshay Adiga ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Separate taskset arguments from the command arguments 2016-02-27 18:46 Separate taskset arguments from the command arguments Akshay Adiga @ 2016-02-27 22:52 ` Yuriy M. Kaminskiy 2016-02-28 0:23 ` Yuriy M. Kaminskiy 0 siblings, 1 reply; 4+ messages in thread From: Yuriy M. Kaminskiy @ 2016-02-27 22:52 UTC (permalink / raw) To: util-linux Akshay Adiga <akshay.adiga@gmail.com> writes: > I want to run a command which looks something like this : > > taskset -c 10 ycsb -p "redis_host=1234" > > The actual command is : > > ycsb -p "redis_host=1234" > > But argument -p "redis_host=1234" is taken by taskset as it argument > and throws an error : Failed to set pid 0's affinity: > > -p "redis_host=1234" is an argument to ycsb command. shell/tasket > misunderstands that and takes it as an argument for taskset. > > Is there a work around for this? Normally, such problem are solved by inserting `--` before your command; however, taskset have somewhat unusual parsing of arguments (-c is not an "option with argument", but the flag), so it will be taskset -c -- 10 ycsb -p "redis_host=1234" ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Separate taskset arguments from the command arguments 2016-02-27 22:52 ` Yuriy M. Kaminskiy @ 2016-02-28 0:23 ` Yuriy M. Kaminskiy 2016-02-29 7:12 ` Akshay Adiga 0 siblings, 1 reply; 4+ messages in thread From: Yuriy M. Kaminskiy @ 2016-02-28 0:23 UTC (permalink / raw) To: util-linux yumkam@gmail.com (Yuriy M. Kaminskiy) writes: > Akshay Adiga <akshay.adiga@gmail.com> > writes: > >> I want to run a command which looks something like this : >> >> taskset -c 10 ycsb -p "redis_host=1234" >> >> The actual command is : >> >> ycsb -p "redis_host=1234" >> >> But argument -p "redis_host=1234" is taken by taskset as it argument >> and throws an error : Failed to set pid 0's affinity: >> >> -p "redis_host=1234" is an argument to ycsb command. shell/tasket >> misunderstands that and takes it as an argument for taskset. >> >> Is there a work around for this? > > Normally, such problem are solved by inserting `--` before your command; > however, taskset have somewhat unusual parsing of arguments (-c is not > an "option with argument", but the flag), so it will be > > taskset -c -- 10 ycsb -p "redis_host=1234" Hmm... actually, on which util-linux and libc version this is on? This should work even without -- (and it works for me [on util-linux 2.25.2 and glibc 2.19; and on util-linux git master branch too), note `getopt ... "+` in taskset.c and `man 3 getopt_long` on meaning (getopt should stop parsing on first non-option argument, in your case `ycsb`). And do your system have 10 cpu's/cores/whatever? Because if I specify cpu number larger than present, taskset gives exactly this error: $ taskset -c 100 echo -p foobar taskset: failed to set pid 0's affinity: Invalid argument This may be confused as "incorrect argument parsing", but it is not ("pid 0" is just means it tries to apply affinity to itself, it is not misparsed "foobar"); with existing cpu number everything works: $ taskset -c 1 echo -p foobar -p foobar $ taskset -c -- 1 echo -p foobar -p foobar (That said, taskset and chrt argument parsing is a bit unusual and may be confusing) ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Separate taskset arguments from the command arguments 2016-02-28 0:23 ` Yuriy M. Kaminskiy @ 2016-02-29 7:12 ` Akshay Adiga 0 siblings, 0 replies; 4+ messages in thread From: Akshay Adiga @ 2016-02-29 7:12 UTC (permalink / raw) To: Yuriy M. Kaminskiy; +Cc: util-linux Hi Yuriy, I am using util-linux v2.27 and GLIBC v2.21 on ubuntu. As you pointed out rightly, its the invalid logical cpu number, rather than mis-parsed argument. I was confused because of the error message. Thanks :) On Sun, Feb 28, 2016 at 5:53 AM, Yuriy M. Kaminskiy <yumkam@gmail.com> wrote: > yumkam@gmail.com (Yuriy M. Kaminskiy) > writes: > >> Akshay Adiga <akshay.adiga@gmail.com> >> writes: >> >>> I want to run a command which looks something like this : >>> >>> taskset -c 10 ycsb -p "redis_host=1234" >>> >>> The actual command is : >>> >>> ycsb -p "redis_host=1234" >>> >>> But argument -p "redis_host=1234" is taken by taskset as it argument >>> and throws an error : Failed to set pid 0's affinity: >>> >>> -p "redis_host=1234" is an argument to ycsb command. shell/tasket >>> misunderstands that and takes it as an argument for taskset. >>> >>> Is there a work around for this? >> >> Normally, such problem are solved by inserting `--` before your command; >> however, taskset have somewhat unusual parsing of arguments (-c is not >> an "option with argument", but the flag), so it will be >> >> taskset -c -- 10 ycsb -p "redis_host=1234" > > Hmm... actually, on which util-linux and libc version this is on? > > This should work even without -- (and it works for me [on util-linux 2.25.2 > and glibc 2.19; and on util-linux git master branch too), note `getopt > ... "+` in taskset.c and `man 3 getopt_long` on meaning (getopt should > stop parsing on first non-option argument, in your case `ycsb`). > > And do your system have 10 cpu's/cores/whatever? Because if I specify cpu number > larger than present, taskset gives exactly this error: > > $ taskset -c 100 echo -p foobar > taskset: failed to set pid 0's affinity: Invalid argument > > This may be confused as "incorrect argument parsing", but it is not > ("pid 0" is just means it tries to apply affinity to itself, it is not > misparsed "foobar"); with existing cpu number everything works: > > $ taskset -c 1 echo -p foobar > -p foobar > $ taskset -c -- 1 echo -p foobar > -p foobar > > (That said, taskset and chrt argument parsing is a bit unusual and may be confusing) > > -- > To unsubscribe from this list: send the line "unsubscribe util-linux" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html- ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-29 7:12 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-02-27 18:46 Separate taskset arguments from the command arguments Akshay Adiga 2016-02-27 22:52 ` Yuriy M. Kaminskiy 2016-02-28 0:23 ` Yuriy M. Kaminskiy 2016-02-29 7:12 ` Akshay Adiga
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox