Using xargs instead of GNU Parallel
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
GNU Parallel can generate all combinations of input, export a function and run it on 3 remote servers without mixing the output, retrying the command if it fails:
#!/bin/bash
env_parallel --record-env
process_output() =1; @a=split//;
while(@a)
print ".",shift @a;
select($a,$a,$a,0.100);
';
env_parallel --env _ --retries 4 -Sserver1..3,:
'echo X=1 Y=2 Z=3 | process_output'
::: "a' "b"1..3 ::: "c" 'd"3..4 ::: "e$ f'"7..8
Output:
.X.=.a.'. . .".b.1. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.1. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.1. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.1. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.2. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.2. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.2. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.2. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.3. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.3. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.3. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.3. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.8.
xargs -P$(nproc)
can run one job per processor.
Given
- the function
process_output
, - the servers to run on (server1, server2, server3),
- the argument groups (
a' "b1, a' "b2, a' "b3
;c" 'd1, c" 'd2, c" 'd3
;e$ f'7, e$ f'8
)
how can you emulate GNU Parallel using xargs
to get the same done using process_output
and the servers?
xargs
add a comment |Â
up vote
0
down vote
favorite
GNU Parallel can generate all combinations of input, export a function and run it on 3 remote servers without mixing the output, retrying the command if it fails:
#!/bin/bash
env_parallel --record-env
process_output() =1; @a=split//;
while(@a)
print ".",shift @a;
select($a,$a,$a,0.100);
';
env_parallel --env _ --retries 4 -Sserver1..3,:
'echo X=1 Y=2 Z=3 | process_output'
::: "a' "b"1..3 ::: "c" 'd"3..4 ::: "e$ f'"7..8
Output:
.X.=.a.'. . .".b.1. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.1. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.1. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.1. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.2. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.2. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.2. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.2. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.3. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.3. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.3. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.3. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.8.
xargs -P$(nproc)
can run one job per processor.
Given
- the function
process_output
, - the servers to run on (server1, server2, server3),
- the argument groups (
a' "b1, a' "b2, a' "b3
;c" 'd1, c" 'd2, c" 'd3
;e$ f'7, e$ f'8
)
how can you emulate GNU Parallel using xargs
to get the same done using process_output
and the servers?
xargs
you mean to just produce the same output withxargs -P<N>
OR it should also fulfill all conditions like distributingprocess_output
calls on 3 remote servers?
â RomanPerekhrest
Nov 19 '17 at 8:08
Based on my experience: there is no easy way to emulate "parallel" with "xargs". It is allways easier to find package of GNU Parallel on your OS and Platfrom than create something new and update and support this solution after. By the way, what are your restrictions to use xargs instead of parallel ?
â Fedor Dikarev
Nov 19 '17 at 12:21
I think what you're really asking is how to run parallel to execute all work on one machine/container. To do this, you simply drop the reference to your remote servers.
â David Favor
Nov 19 '17 at 13:05
@ole are you debugging gnu parallell? ;-), or just asking whether xargs actually can do the same job?
â Hannu
Nov 19 '17 at 16:14
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
GNU Parallel can generate all combinations of input, export a function and run it on 3 remote servers without mixing the output, retrying the command if it fails:
#!/bin/bash
env_parallel --record-env
process_output() =1; @a=split//;
while(@a)
print ".",shift @a;
select($a,$a,$a,0.100);
';
env_parallel --env _ --retries 4 -Sserver1..3,:
'echo X=1 Y=2 Z=3 | process_output'
::: "a' "b"1..3 ::: "c" 'd"3..4 ::: "e$ f'"7..8
Output:
.X.=.a.'. . .".b.1. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.1. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.1. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.1. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.2. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.2. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.2. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.2. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.3. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.3. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.3. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.3. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.8.
xargs -P$(nproc)
can run one job per processor.
Given
- the function
process_output
, - the servers to run on (server1, server2, server3),
- the argument groups (
a' "b1, a' "b2, a' "b3
;c" 'd1, c" 'd2, c" 'd3
;e$ f'7, e$ f'8
)
how can you emulate GNU Parallel using xargs
to get the same done using process_output
and the servers?
xargs
GNU Parallel can generate all combinations of input, export a function and run it on 3 remote servers without mixing the output, retrying the command if it fails:
#!/bin/bash
env_parallel --record-env
process_output() =1; @a=split//;
while(@a)
print ".",shift @a;
select($a,$a,$a,0.100);
';
env_parallel --env _ --retries 4 -Sserver1..3,:
'echo X=1 Y=2 Z=3 | process_output'
::: "a' "b"1..3 ::: "c" 'd"3..4 ::: "e$ f'"7..8
Output:
.X.=.a.'. . .".b.1. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.1. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.1. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.1. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.2. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.2. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.2. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.2. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.3. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.3. .Y.=.c.". . .'.d.3. .Z.=.e.$. . .f.'.8.
.X.=.a.'. . .".b.3. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.7.
.X.=.a.'. . .".b.3. .Y.=.c.". . .'.d.4. .Z.=.e.$. . .f.'.8.
xargs -P$(nproc)
can run one job per processor.
Given
- the function
process_output
, - the servers to run on (server1, server2, server3),
- the argument groups (
a' "b1, a' "b2, a' "b3
;c" 'd1, c" 'd2, c" 'd3
;e$ f'7, e$ f'8
)
how can you emulate GNU Parallel using xargs
to get the same done using process_output
and the servers?
xargs
edited Nov 19 '17 at 12:13
asked Nov 19 '17 at 6:44
Ole Tange
11.4k1344102
11.4k1344102
you mean to just produce the same output withxargs -P<N>
OR it should also fulfill all conditions like distributingprocess_output
calls on 3 remote servers?
â RomanPerekhrest
Nov 19 '17 at 8:08
Based on my experience: there is no easy way to emulate "parallel" with "xargs". It is allways easier to find package of GNU Parallel on your OS and Platfrom than create something new and update and support this solution after. By the way, what are your restrictions to use xargs instead of parallel ?
â Fedor Dikarev
Nov 19 '17 at 12:21
I think what you're really asking is how to run parallel to execute all work on one machine/container. To do this, you simply drop the reference to your remote servers.
â David Favor
Nov 19 '17 at 13:05
@ole are you debugging gnu parallell? ;-), or just asking whether xargs actually can do the same job?
â Hannu
Nov 19 '17 at 16:14
add a comment |Â
you mean to just produce the same output withxargs -P<N>
OR it should also fulfill all conditions like distributingprocess_output
calls on 3 remote servers?
â RomanPerekhrest
Nov 19 '17 at 8:08
Based on my experience: there is no easy way to emulate "parallel" with "xargs". It is allways easier to find package of GNU Parallel on your OS and Platfrom than create something new and update and support this solution after. By the way, what are your restrictions to use xargs instead of parallel ?
â Fedor Dikarev
Nov 19 '17 at 12:21
I think what you're really asking is how to run parallel to execute all work on one machine/container. To do this, you simply drop the reference to your remote servers.
â David Favor
Nov 19 '17 at 13:05
@ole are you debugging gnu parallell? ;-), or just asking whether xargs actually can do the same job?
â Hannu
Nov 19 '17 at 16:14
you mean to just produce the same output with
xargs -P<N>
OR it should also fulfill all conditions like distributing process_output
calls on 3 remote servers?â RomanPerekhrest
Nov 19 '17 at 8:08
you mean to just produce the same output with
xargs -P<N>
OR it should also fulfill all conditions like distributing process_output
calls on 3 remote servers?â RomanPerekhrest
Nov 19 '17 at 8:08
Based on my experience: there is no easy way to emulate "parallel" with "xargs". It is allways easier to find package of GNU Parallel on your OS and Platfrom than create something new and update and support this solution after. By the way, what are your restrictions to use xargs instead of parallel ?
â Fedor Dikarev
Nov 19 '17 at 12:21
Based on my experience: there is no easy way to emulate "parallel" with "xargs". It is allways easier to find package of GNU Parallel on your OS and Platfrom than create something new and update and support this solution after. By the way, what are your restrictions to use xargs instead of parallel ?
â Fedor Dikarev
Nov 19 '17 at 12:21
I think what you're really asking is how to run parallel to execute all work on one machine/container. To do this, you simply drop the reference to your remote servers.
â David Favor
Nov 19 '17 at 13:05
I think what you're really asking is how to run parallel to execute all work on one machine/container. To do this, you simply drop the reference to your remote servers.
â David Favor
Nov 19 '17 at 13:05
@ole are you debugging gnu parallell? ;-), or just asking whether xargs actually can do the same job?
â Hannu
Nov 19 '17 at 16:14
@ole are you debugging gnu parallell? ;-), or just asking whether xargs actually can do the same job?
â Hannu
Nov 19 '17 at 16:14
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f405552%2fusing-xargs-instead-of-gnu-parallel%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
you mean to just produce the same output with
xargs -P<N>
OR it should also fulfill all conditions like distributingprocess_output
calls on 3 remote servers?â RomanPerekhrest
Nov 19 '17 at 8:08
Based on my experience: there is no easy way to emulate "parallel" with "xargs". It is allways easier to find package of GNU Parallel on your OS and Platfrom than create something new and update and support this solution after. By the way, what are your restrictions to use xargs instead of parallel ?
â Fedor Dikarev
Nov 19 '17 at 12:21
I think what you're really asking is how to run parallel to execute all work on one machine/container. To do this, you simply drop the reference to your remote servers.
â David Favor
Nov 19 '17 at 13:05
@ole are you debugging gnu parallell? ;-), or just asking whether xargs actually can do the same job?
â Hannu
Nov 19 '17 at 16:14