2
My understanding is that the -X option should distribute arguments evenly among the jobs. Yet, I get a very skewed distribution:
user@host:/tmp/ptest$ count() {
> echo $#
> }
user@host:/tmp/ptest$ export -f count
user@host:/tmp/ptest$ count *.jpg
5825
user@host:/tmp/ptest$ parallel -X count ::: *.jpg
5039
197
197
197
195
Interestingly enough, using only a subset of the files leads to an even distribution of parameters:
user@host:/tmp/ptest$ count p129*.jpg
975
user@host:/tmp/ptest$ parallel -X count ::: p129*.jpg
244
244
244
243
user@host:/tmp/ptest$ count p12*.jpg
4007
user@host:/tmp/ptest$ parallel -X count ::: p12*.jpg
1002
1002
1002
1001
user@host:/tmp/ptest$ count p13*.jpg
1818
user@host:/tmp/ptest$ parallel -X count ::: p13*.jpg
455
455
455
453
Why is wrong in the first case and how can I fix it?
Thanks for explaining why this happens. Is there any way to achieve or approximate the desired behaviour? – Zoltan – 2018-10-02T11:11:25.517
1The linked material looks like a great book by the way! – Zoltan – 2018-10-02T11:15:55.703