parallel: Fixed bug if --wd does not exists. Incl test.

This commit is contained in:
Ole Tange 2013-12-04 17:12:09 +01:00
parent 6b4bf8a764
commit 6a71285bb6
8 changed files with 36 additions and 10 deletions

View file

@ -201,13 +201,15 @@ cc:Sandro Cazzaniga <kharec@mandriva.org>,
Ryoichiro Suzuki <ryoichiro.suzuki@gmail.com>, Ryoichiro Suzuki <ryoichiro.suzuki@gmail.com>,
Jesse Alama <jesse.alama@gmail.com> Jesse Alama <jesse.alama@gmail.com>
Subject: GNU Parallel 20131222 ('Yutu') released Subject: GNU Parallel 20131222 ('Yutu' 玉兔) released
GNU Parallel 20131222 ('Yutu') has been released. It is GNU Parallel 20131222 ('Yutu' 玉兔) has been released. It is
available for download at: http://ftp.gnu.org/gnu/parallel/ available for download at: http://ftp.gnu.org/gnu/parallel/
New in this release: New in this release:
* Using GNU Parallel to create a SVM classifier
http://ivanyu.me/blog/2013/12/01/parallel/
* Mon make à moi (French) * Mon make à moi (French)
http://www.slideshare.net/lindenb/mon-make-moi-tout-sauf-galaxy http://www.slideshare.net/lindenb/mon-make-moi-tout-sauf-galaxy

View file

@ -4427,7 +4427,9 @@ sub sshlogin_wrap {
if($opt::workdir) { if($opt::workdir) {
my $wd = ::shell_quote_file($self->workdir()); my $wd = ::shell_quote_file($self->workdir());
$remote_pre .= ::shell_quote_scalar("mkdir -p ") . $wd . $remote_pre .= ::shell_quote_scalar("mkdir -p ") . $wd .
::shell_quote_scalar("; cd ") . $wd . ::shell_quote_scalar(" && "); ::shell_quote_scalar("; cd ") . $wd .
::shell_quote_scalar(qq{ || sh -c 'echo "$Global::progname: Error: cannot cd to $wd" 1>&2' }.
"&& exit 255; ");
} }
$self->{'sshlogin_wrap'} = $self->{'sshlogin_wrap'} =
($pre ($pre

View file

@ -124,7 +124,7 @@
.\" ======================================================================== .\" ========================================================================
.\" .\"
.IX Title "PARALLEL_TUTORIAL 1" .IX Title "PARALLEL_TUTORIAL 1"
.TH PARALLEL_TUTORIAL 1 "2013-09-28" "20131122" "parallel" .TH PARALLEL_TUTORIAL 1 "2013-12-03" "20131122" "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
@ -1877,7 +1877,7 @@ Output:
.Ve .Ve
.PP .PP
\&\s-1GNU\s0 Parallel can copy all defined variables and functions to the \&\s-1GNU\s0 Parallel can copy all defined variables and functions to the
remote system. It just need to record which ones to ignore in remote system. It just needs to record which ones to ignore in
~/.parallel/ignored_vars. Do that by running this once: ~/.parallel/ignored_vars. Do that by running this once:
.PP .PP
.Vb 2 .Vb 2
@ -2049,7 +2049,8 @@ Output (the order may be different):
\& 20000 20000 140001 \& 20000 20000 140001
.Ve .Ve
.PP .PP
Notice that the last jobs could not get the full 140000 lines. Notice that the last job could not get the full 140000 lines, but only
20000 lines.
.PP .PP
If a record is 75 lines \-L can be used: If a record is 75 lines \-L can be used:
.PP .PP

View file

@ -1287,7 +1287,7 @@ remote system.</p>
<pre> <pre>
in my_func baz</pre> in my_func baz</pre>
<p>GNU Parallel can copy all defined variables and functions to the <p>GNU Parallel can copy all defined variables and functions to the
remote system. It just need to record which ones to ignore in remote system. It just needs to record which ones to ignore in
~/.parallel/ignored_vars. Do that by running this once:</p> ~/.parallel/ignored_vars. Do that by running this once:</p>
<pre> <pre>
parallel --record-env parallel --record-env
@ -1413,7 +1413,8 @@ line.</p>
140000 140000 980000 140000 140000 980000
140000 140000 980000 140000 140000 980000
20000 20000 140001</pre> 20000 20000 140001</pre>
<p>Notice that the last jobs could not get the full 140000 lines.</p> <p>Notice that the last job could not get the full 140000 lines, but only
20000 lines.</p>
<p>If a record is 75 lines -L can be used:</p> <p>If a record is 75 lines -L can be used:</p>
<pre> <pre>
cat num1000000 | parallel --pipe -L75 wc</pre> cat num1000000 | parallel --pipe -L75 wc</pre>

Binary file not shown.

View file

@ -1373,7 +1373,7 @@ Output:
in my_func baz in my_func baz
GNU Parallel can copy all defined variables and functions to the GNU Parallel can copy all defined variables and functions to the
remote system. It just need to record which ones to ignore in remote system. It just needs to record which ones to ignore in
~/.parallel/ignored_vars. Do that by running this once: ~/.parallel/ignored_vars. Do that by running this once:
parallel --record-env parallel --record-env
@ -1515,7 +1515,8 @@ Output (the order may be different):
140000 140000 980000 140000 140000 980000
20000 20000 140001 20000 20000 140001
Notice that the last jobs could not get the full 140000 lines. Notice that the last job could not get the full 140000 lines, but only
20000 lines.
If a record is 75 lines -L can be used: If a record is 75 lines -L can be used:

View file

@ -4,4 +4,10 @@ cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | stdout paral
echo '### --filter-hosts --slf <()' echo '### --filter-hosts --slf <()'
parallel --nonall --filter-hosts --slf <(echo localhost) echo OK parallel --nonall --filter-hosts --slf <(echo localhost) echo OK
echo '### --wd no-such-dir'
stdout parallel --wd /no-such-dir -S csh@localhost echo ::: 1; echo Exit code $?
stdout parallel --wd /no-such-dir -S tcsh@localhost echo ::: 1; echo Exit code $?
stdout parallel --wd /no-such-dir -S parallel@localhost echo ::: 1; echo Exit code $?
EOF EOF

View file

@ -1,2 +1,15 @@
### --filter-hosts --slf <() ### --filter-hosts --slf <()
OK OK
### --wd no-such-dir
mkdir: cannot create directory /no-such-dir: Permission denied
bash: line 0: cd: /no-such-dir: No such file or directory
parallel: Error: cannot cd to /no-such-dir
Exit code 1
mkdir: cannot create directory /no-such-dir: Permission denied
bash: line 0: cd: /no-such-dir: No such file or directory
parallel: Error: cannot cd to /no-such-dir
Exit code 1
mkdir: cannot create directory /no-such-dir: Permission denied
bash: line 0: cd: /no-such-dir: No such file or directory
parallel: Error: cannot cd to /no-such-dir
Exit code 1