parallel: {{perl exp}} implemented (poorly).

This commit is contained in:
Ole Tange 2014-06-26 01:16:54 +02:00
parent b9b3d9d5f2
commit 9fed0bfa17
5 changed files with 53 additions and 44 deletions

View file

@ -157,7 +157,7 @@ git diff
git commit -a git commit -a
Released as 20140X22 (''). Released as 20140x22 ('').
TAG=MyTag TAG=MyTag
YYYYMMDD=`yyyymmdd` YYYYMMDD=`yyyymmdd`
@ -176,6 +176,7 @@ https://savannah.gnu.org/news/approve.php?group=parallel
== Update Freshmeat == == Update Freshmeat ==
// FreeCode is dying
http://freshmeat.net/projects/parallel/releases/new http://freshmeat.net/projects/parallel/releases/new
== Update Diaspora Twitter == == Update Diaspora Twitter ==
@ -215,44 +216,20 @@ cc:Tim Cuthbertson <tim3d.junk@gmail.com>,
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 20140622 ('Brazil') released Subject: GNU Parallel 20140722 ('') released
GNU Parallel 20140622 ('Brazil') has been released. It is available for download at: http://ftp.gnu.org/gnu/parallel/ GNU Parallel 20140722 ('') has been released. It is available for download at: http://ftp.gnu.org/gnu/parallel/
Haiku of the month: Haiku of the month:
goodbye to xargs Programs very slow.
quoting is still a black art Multiple can run at once.
welcome parallel Use GNU Parallel.
-- Malcolm Cook -- Ole Tange
New in this release: New in this release:
* --shebang and --shebang-wrap now works on FreeBSD. * GNU Parallel was cited in: Web-scale Content Reuse Detection www.isi.edu/~johnh/PAPERS/Ardi14a.pdf
* --pipepart works with --header, --regexp, --cat and --fifo.
* ./configure --disable-documentation will not build documentation.
* {%} works as job slot.
* GNU Parallel was cited in: Energy Efficient, High-speed Communication in WSNs https://gupea.ub.gu.se/bitstream/2077/35801/1/gupea_2077_35801_1.pdf
* GNU Parallel was cited in: Ferroelectric contributions to anomalous hysteresis in hybrid perovskite solar cells http://arxiv.org/pdf/1405.5810.pdf
* Processes Paralleling to Speed up Computing and Tasks Execution in Linux http://kukuruku.co/hub/nix/processes-paralleling-to-speed-up-computing-and-tasks-execution-in-linux
* Moving / Copying lots of s3 files quickly using gnu parallel http://blog.aclarke.eu/moving-copying-lots-of-s3-files-quickly-using-gnu-parallel/
* Speeding up grep log queries with GNU Parallel http://www.tripwire.com/state-of-security/incident-detection/speeding-grep-queries-gnu-parallel/
* Ubuntu - Gnu parallel - It's awesome http://kasunweranga.blogspot.dk/2014/06/ubuntu-gnu-parallel-its-awesome.html
* Export quicklooks with vector overlay using TuiView http://spectraldifferences.wordpress.com/2014/03/08/export-quicklooks-with-vector-overlay-using-tuiview/
* GNU Parallel指南 http://my.oschina.net/enyo/blog/271612
* GNU parallelで違和感 http://jarp.does.notwork.org/diary/201405c.html#201405301
* Bug fixes and man page updates. * Bug fixes and man page updates.

View file

@ -600,6 +600,7 @@ sub options_hash {
"linebuffer|linebuffered|line-buffer|line-buffered" => \$opt::linebuffer, "linebuffer|linebuffered|line-buffer|line-buffered" => \$opt::linebuffer,
"null|0" => \$opt::0, "null|0" => \$opt::0,
"quote|q" => \$opt::q, "quote|q" => \$opt::q,
# Replacement strings
"I=s" => \$opt::I, "I=s" => \$opt::I,
"extensionreplace|er=s" => \$opt::U, "extensionreplace|er=s" => \$opt::U,
"U=s" => \$opt::retired, "U=s" => \$opt::retired,
@ -748,7 +749,7 @@ sub get_options_from_array {
sub parse_options { sub parse_options {
# Returns: N/A # Returns: N/A
# Defaults: # Defaults:
$Global::version = 20140622; $Global::version = 20140623;
$Global::progname = 'parallel'; $Global::progname = 'parallel';
$Global::infinity = 2**31; $Global::infinity = 2**31;
$Global::debug = 0; $Global::debug = 0;
@ -4471,7 +4472,7 @@ sub openoutputfiles {
if($opt::compress) { if($opt::compress) {
# Send stdout to stdin for $opt::compress_program(1) # Send stdout to stdin for $opt::compress_program(1)
# Send stderr to stdin for $opt::compress_program(2) # Send stderr to stdin for $opt::compress_program(2)
# cattail get pid i $pid = $self->fh($fdno,'rpid'); # cattail get pid: $pid = $self->fh($fdno,'rpid');
my $cattail = cattail(); my $cattail = cattail();
for my $fdno (1,2) { for my $fdno (1,2) {
my $wpid = open(my $fdw,"|-","$opt::compress_program >>". my $wpid = open(my $fdw,"|-","$opt::compress_program >>".
@ -4483,10 +4484,6 @@ sub openoutputfiles {
$self->fh($fdno,'name'),$self->fh($fdno,'unlink')) || die $?; $self->fh($fdno,'name'),$self->fh($fdno,'unlink')) || die $?;
$self->set_fh($fdno,'r',$fdr); $self->set_fh($fdno,'r',$fdr);
$self->set_fh($fdno,'rpid',$rpid); $self->set_fh($fdno,'rpid',$rpid);
# Unlink if required but only when cattail and compress_program has started.
# How do we know when cattail and compress have opened the files?
# Disabled for now.
# unlink $self->fh($fdno,"unlink");
} }
} elsif($Global::grouped) { } elsif($Global::grouped) {
# Set reading FD if using --group (--ungroup does not need) # Set reading FD if using --group (--ungroup does not need)
@ -5576,8 +5573,10 @@ sub new {
} elsif($opt::pipepart and not $opt::fifo and not $opt::cat) { } elsif($opt::pipepart and not $opt::fifo and not $opt::cat) {
# With --pipe-part you can have nothing # With --pipe-part you can have nothing
} else { } else {
# Add {} to the command if there are no {...}'s # Add {} to the command if there are no {...}'s and no {{...}}
$command .=" ".$Global::replace{'{}'}; if($command !~ /\{\{.*?\}\}/) {
$command .=" ".$Global::replace{'{}'};
}
} }
($sum,$len->{'no_args'},$len->{'context'},$len->{'contextgroups'}, ($sum,$len->{'no_args'},$len->{'context'},$len->{'contextgroups'},
%replacecount) = number_of_replacements($command,$context_replace); %replacecount) = number_of_replacements($command,$context_replace);
@ -6184,6 +6183,15 @@ sub simple_replace_placeholders {
CORE::push @args, @$record; CORE::push @args, @$record;
} }
my $n = $#args+1; my $n = $#args+1;
if($target =~ /\{\{.*?\}\}/) {
# Replace {{perlexp}} with value
for my $a (@args) {
$_ = $a->replace('{}',$quote);
$target =~ s/(\{\{(.*?)\}\})/eval("$2")." ".$1/eg;
}
$target =~ s/(\{\{(.*?)\}\})//g;
}
# Which replace strings are used? # Which replace strings are used?
# {#} {%} {} {/} {//} {.} {/.} {n} {n/} {n//} {n.} {n/.} # {#} {%} {} {/} {//} {.} {/.} {n} {n/} {n//} {n.} {n/.}
for my $used (keys %{$self->{'replacecount'}}) { for my $used (keys %{$self->{'replacecount'}}) {

View file

@ -3708,16 +3708,16 @@ echo 1,2,3 | parallel -vkd, "echo 'a'"{}"'b'"
=head3 Startup =head3 Startup
GNU B<parallel> is slow at starting up - around 250 ms. Half of the GNU B<parallel> is slow at starting up - around 250 ms the first time
startup time is spent finding the maximal length of a command and 150 ms after that.
line. Setting B<-s> will remove this part of the startup time.
=head3 Job startup =head3 Job startup
Starting a job on the local machine takes around 3 ms. This can be a Starting a job on the local machine takes around 3 ms. This can be a
big overhead if the job takes very few ms to run. Often you can group big overhead if the job takes very few ms to run. Often you can group
small jobs together using B<-X> which will make the overhead less small jobs together using B<-X> which will make the overhead less
significant. significant. Or you can run multiple GNU B<parallel>s as described in
B<EXAMPLE: Speeding up fast jobs>.
Using B<--ungroup> the 3 ms can be lowered to around 2 ms. Using B<--ungroup> the 3 ms can be lowered to around 2 ms.

View file

@ -47,4 +47,9 @@ echo '### bug #42041: Implement $PARALLEL_JOBSLOT'
parallel -k --slotreplace ,, -j2 echo ,, ::: {1..4} parallel -k --slotreplace ,, -j2 echo ,, ::: {1..4}
parallel -k -j2 echo {%} ::: {1..4} parallel -k -j2 echo {%} ::: {1..4}
echo '### bug #42363: --pipepart and --fifo/--cat does not work'
seq 100 > /tmp/bug42363;
parallel --pipepart --block 31 -a /tmp/bug42363 -k --fifo wc | perl -pe s:/tmp/...........pip:/tmp/XXXX: ;
parallel --pipepart --block 31 -a /tmp/bug42363 -k --cat wc | perl -pe s:/tmp/...........pip:/tmp/XXXX: ;
EOF EOF

View file

@ -32,3 +32,22 @@ tcsh 2
2 2
1 1
2 2
### bug #42363: --pipepart and --fifo/--cat does not work
13 14 32 /tmp/XXXX
11 11 33 /tmp/XXXX
11 11 33 /tmp/XXXX
11 11 33 /tmp/XXXX
11 11 33 /tmp/XXXX
11 11 33 /tmp/XXXX
11 11 33 /tmp/XXXX
11 11 33 /tmp/XXXX
10 9 29 /tmp/XXXX
13 14 32 /tmp/XXXX
11 11 33 /tmp/XXXX
11 11 33 /tmp/XXXX
11 11 33 /tmp/XXXX
11 11 33 /tmp/XXXX
11 11 33 /tmp/XXXX
11 11 33 /tmp/XXXX
11 11 33 /tmp/XXXX
10 9 29 /tmp/XXXX