parallel: bug #42041: Implement $PARALLEL_JOBSLOT

This commit is contained in:
Ole Tange 2014-06-04 02:22:39 +02:00
parent 47919ddb97
commit 5f30c90c35
8 changed files with 26 additions and 18 deletions

Binary file not shown.

View file

@ -168,7 +168,7 @@ The replacement string B<{#}> can be changed with B<--seqreplace>.
To understand replacement strings see B<{}>. To understand replacement strings see B<{}>.
=item B<{%}> (alpha) =item B<{%}> (alpha testing)
Job slot number. This replacement string will be replaced by the job's Job slot number. This replacement string will be replaced by the job's
slot number between 1 and number of jobs to run in parallel. There slot number between 1 and number of jobs to run in parallel. There
@ -1500,7 +1500,7 @@ The sshloginfile '-' is special, too, it read sshlogins from stdin
(standard input). (standard input).
=item B<--slotreplace> I<replace-str> =item B<--slotreplace> I<replace-str> (alpha testing)
Use the replacement string I<replace-str> instead of B<{%}> for Use the replacement string I<replace-str> instead of B<{%}> for
job slot number. job slot number.

View file

@ -244,8 +244,8 @@ The replacement string @strong{@{#@}} can be changed with @strong{--seqreplace}.
To understand replacement strings see @strong{@{@}}. To understand replacement strings see @strong{@{@}}.
@item @strong{@{%@}} (alpha) @item @strong{@{%@}} (alpha testing)
@anchor{@strong{@{%@}} (alpha)} @anchor{@strong{@{%@}} (alpha testing)}
Job slot number. This replacement string will be replaced by the job's Job slot number. This replacement string will be replaced by the job's
slot number between 1 and number of jobs to run in parallel. There slot number between 1 and number of jobs to run in parallel. There
@ -1671,8 +1671,8 @@ The sshloginfile '.' is special, it read sshlogins from
The sshloginfile '-' is special, too, it read sshlogins from stdin The sshloginfile '-' is special, too, it read sshlogins from stdin
(standard input). (standard input).
@item @strong{--slotreplace} @emph{replace-str} @item @strong{--slotreplace} @emph{replace-str} (alpha testing)
@anchor{@strong{--slotreplace} @emph{replace-str}} @anchor{@strong{--slotreplace} @emph{replace-str} (alpha testing)}
Use the replacement string @emph{replace-str} instead of @strong{@{%@}} for Use the replacement string @emph{replace-str} instead of @strong{@{%@}} for
job slot number. job slot number.

View file

@ -124,7 +124,7 @@
.\" ======================================================================== .\" ========================================================================
.\" .\"
.IX Title "PARALLEL_TUTORIAL 1" .IX Title "PARALLEL_TUTORIAL 1"
.TH PARALLEL_TUTORIAL 1 "2014-05-31" "20140522" "parallel" .TH PARALLEL_TUTORIAL 1 "2014-06-04" "20140522" "parallel"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents. .\" way too many mistakes in technical documents.
.if n .ad l .if n .ad l
@ -140,8 +140,8 @@ love you for it.
.SH "Prerequisites" .SH "Prerequisites"
.IX Header "Prerequisites" .IX Header "Prerequisites"
To run this tutorial you must have the following: To run this tutorial you must have the following:
.IP "parallel >= version 20130814" 9 .IP "parallel >= version 20140622" 9
.IX Item "parallel >= version 20130814" .IX Item "parallel >= version 20140622"
Install the newest version with: Install the newest version with:
.Sp .Sp
.Vb 1 .Vb 1
@ -483,8 +483,8 @@ Output (the order may be different):
.Ve .Ve
.SS "Replacement strings" .SS "Replacement strings"
.IX Subsection "Replacement strings" .IX Subsection "Replacement strings"
\fIThe 6 replacement strings\fR \fIThe 7 replacement strings\fR
.IX Subsection "The 6 replacement strings" .IX Subsection "The 7 replacement strings"
.PP .PP
\&\s-1GNU\s0 Parallel has several replacement strings. If no replacement \&\s-1GNU\s0 Parallel has several replacement strings. If no replacement
strings are used the default is to append {}: strings are used the default is to append {}:
@ -1137,7 +1137,7 @@ Output:
with half a line of another job. That has happend in the second line, with half a line of another job. That has happend in the second line,
where the line '4\-middle' is mixed with '2\-start'. where the line '4\-middle' is mixed with '2\-start'.
.PP .PP
To avoid this use \-\-linebuffer (which, however, is much slower): To avoid this use \-\-linebuffer:
.PP .PP
.Vb 1 .Vb 1
\& parallel \-j2 \-\-linebuffer \*(Aqprintf "%s\-start\en%s" {} {};sleep {};printf "%s\en" \-middle;echo {}\-end\*(Aq ::: 4 2 1 \& parallel \-j2 \-\-linebuffer \*(Aqprintf "%s\-start\en%s" {} {};sleep {};printf "%s\en" \-middle;echo {}\-end\*(Aq ::: 4 2 1
@ -2675,4 +2675,4 @@ If \s-1GNU\s0 Parallel saves you money:
.IP "\(bu" 2 .IP "\(bu" 2
(Have your company) donate to \s-1FSF\s0 https://my.fsf.org/donate/ (Have your company) donate to \s-1FSF\s0 https://my.fsf.org/donate/
.PP .PP
(C) 20130822 Ole Tange GPLv3 (C) 20140622 Ole Tange GPLv3

View file

@ -41,7 +41,7 @@
<li><a href="#replacement_strings">Replacement strings</a></li> <li><a href="#replacement_strings">Replacement strings</a></li>
<ul> <ul>
<li><a href="#the_6_replacement_strings">The 6 replacement strings</a></li> <li><a href="#the_7_replacement_strings">The 7 replacement strings</a></li>
</ul> </ul>
<li><a href="#changing_the_replacement_strings">Changing the replacement strings</a></li> <li><a href="#changing_the_replacement_strings">Changing the replacement strings</a></li>
@ -128,7 +128,7 @@ love you for it.</p>
<h1><a name="prerequisites">Prerequisites</a></h1> <h1><a name="prerequisites">Prerequisites</a></h1>
<p>To run this tutorial you must have the following:</p> <p>To run this tutorial you must have the following:</p>
<dl> <dl>
<dt><strong><a name="parallel_version_20130814" class="item">parallel &gt;= version 20130814</a></strong></dt> <dt><strong><a name="parallel_version_20140622" class="item">parallel &gt;= version 20140622</a></strong></dt>
<dd> <dd>
<p>Install the newest version with:</p> <p>Install the newest version with:</p>
@ -390,7 +390,7 @@ exported using 'export -f':</p>
<h2><a name="replacement_strings">Replacement strings</a></h2> <h2><a name="replacement_strings">Replacement strings</a></h2>
<p> <p>
</p> </p>
<h3><a name="the_6_replacement_strings">The 6 replacement strings</a></h3> <h3><a name="the_7_replacement_strings">The 7 replacement strings</a></h3>
<p>GNU Parallel has several replacement strings. If no replacement <p>GNU Parallel has several replacement strings. If no replacement
strings are used the default is to append {}:</p> strings are used the default is to append {}:</p>
<pre> <pre>
@ -785,7 +785,7 @@ total of 5 jobs:</p>
<p>--ungroup is fast, but can cause half a line from one job to be mixed <p>--ungroup is fast, but can cause half a line from one job to be mixed
with half a line of another job. That has happend in the second line, with half a line of another job. That has happend in the second line,
where the line '4-middle' is mixed with '2-start'.</p> where the line '4-middle' is mixed with '2-start'.</p>
<p>To avoid this use --linebuffer (which, however, is much slower):</p> <p>To avoid this use --linebuffer:</p>
<pre> <pre>
parallel -j2 --linebuffer 'printf &quot;%s-start\n%s&quot; {} {};sleep {};printf &quot;%s\n&quot; -middle;echo {}-end' ::: 4 2 1</pre> parallel -j2 --linebuffer 'printf &quot;%s-start\n%s&quot; {} {};sleep {};printf &quot;%s\n&quot; -middle;echo {}-end' ::: 4 2 1</pre>
<p>Output:</p> <p>Output:</p>
@ -1903,7 +1903,7 @@ mailing lists</p>
<p>(Have your company) donate to FSF <a href="https://my.fsf.org/donate/">https://my.fsf.org/donate/</a></p> <p>(Have your company) donate to FSF <a href="https://my.fsf.org/donate/">https://my.fsf.org/donate/</a></p>
</li> </li>
</ul> </ul>
<p>(C) 20130822 Ole Tange GPLv3</p> <p>(C) 20140622 Ole Tange GPLv3</p>
</body> </body>

Binary file not shown.

View file

@ -43,4 +43,7 @@ echo '### Bug before 2009-08-26 causing regexp compile error or infinite loop (I
echo '### nice and tcsh and Bug #33995: Jobs executed with sh instead of $SHELL'; echo '### nice and tcsh and Bug #33995: Jobs executed with sh instead of $SHELL';
seq 1 2 | SHELL=tcsh MANPATH=. stdout parallel -k --nice 8 setenv a b\;echo \$SHELL seq 1 2 | SHELL=tcsh MANPATH=. stdout parallel -k --nice 8 setenv a b\;echo \$SHELL
echo '### bug #42041: Implement $PARALLEL_JOBSLOT'
parallel -k --slotreplace ,, -j2 echo ,, ::: {1..4}
EOF EOF

View file

@ -23,3 +23,8 @@ d7fb96d6a56d4347bc24930a395c431a -
### nice and tcsh and Bug #33995: Jobs executed with sh instead of $SHELL ### nice and tcsh and Bug #33995: Jobs executed with sh instead of $SHELL
tcsh 1 tcsh 1
tcsh 2 tcsh 2
### bug #42041: Implement $PARALLEL_JOBSLOT
1
2
1
2