parallel: Fixed {= {= =} =}, {= =}=}, {={= =}

This commit is contained in:
Ole Tange 2014-12-09 06:23:37 +01:00
parent 166bbc5b56
commit dbbd5829fe
7 changed files with 91 additions and 32 deletions

View file

@ -226,34 +226,21 @@ 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 20141122 ('Rosetta') released Subject: GNU Parallel 20141222 ('Manila') released
GNU Parallel 20141122 ('Rosetta') has been released. It is available for download at: http://ftp.gnu.org/gnu/parallel/ GNU Parallel 20141222 ('Manila') has been released. It is available for download at: http://ftp.gnu.org/gnu/parallel/
Haiku of the month: Haiku of the month:
Hadoop bit too much? <<>>
Want a simpler syntax now?
Use GNU Parallel.
-- Ole Tange
A central piece of command generation was rewritten making this release beta quality. As always it passes the testsuite, so most functionality clearly works.
New in this release: New in this release:
* Remote systems can be divided into hostgroups (e.g. web and db) by prepending '@groupname/' to the sshlogin. Multiple groups can be given by separating groups with '+'. E.g. @web/www1 @web+db/www2 @db/mariadb * GNU Parallel was cited in: Parallel post-processing with MPI-Bash http://dl.acm.org/citation.cfm?id=2691137
* Remote execution can be restricted to servers that are part of one or more groups by '@groupname' as an sshlogin. Multiple groups can be given by separating groups with '+'. E.g. -S @web or -S @db+web * GNU Parallel: Open Source For You (OSFY) magazine, October 2013 edition http://www.shakthimaan.com/posts/2014/11/27/gnu-parallel/news.html
* With --hostgroup you can restrict arguments to certain hostgroups by appending '@groupname' to the argument. Multiple groups can be given by separating groups with '+'. E.g. my_web_arg@web db-or-web-arg@db+web db-only-arg@db Thanks to Michel Courtine for developing a prototype for this. * コマンドを並列に実行するGNU parallelがとても便利 http://bicycle1885.hatenablog.com/entry/2014/08/10/143612
* GNU Parallel was cited in: HTSeq-Hadoop: Extending HTSeq for Massively Parallel Sequencing Data Analysis using Hadoop http://essenceofescience.se/wp-content/uploads/2014/11/Siretskiy.pdf
* GNU Parallel was cited in: SlideToolkit: An Assistive Toolset for the Histological Quantification of Whole Slide Images http://www.plosone.org/article/info%3Adoi%2F10.1371%2Fjournal.pone.0110289#close
* GNU Parallel was cited in: Exploring a multiprocessor design space to analyze the impact of using STT-RAM in the memory hierarchy http://conservancy.umn.edu/bitstream/handle/11299/167286/Borse_umn_0130M_15431.pdf
* Command-Line OCR with Tesseract on Mac OS X https://ryanfb.github.io/etc/2014/11/13/command_line_ocr_on_mac_os_x.html
* Bug fixes and man page updates. * Bug fixes and man page updates.

View file

@ -78,7 +78,7 @@ NORMAL_UNINSTALL = :
PRE_UNINSTALL = : PRE_UNINSTALL = :
POST_UNINSTALL = : POST_UNINSTALL = :
subdir = src subdir = src
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am README DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \

View file

@ -781,7 +781,7 @@ sub get_options_from_array {
sub parse_options { sub parse_options {
# Returns: N/A # Returns: N/A
# Defaults: # Defaults:
$Global::version = 20141123; $Global::version = 20141209;
$Global::progname = 'parallel'; $Global::progname = 'parallel';
$Global::infinity = 2**31; $Global::infinity = 2**31;
$Global::debug = 0; $Global::debug = 0;
@ -6865,6 +6865,7 @@ sub new {
} }
} }
# Replace replacement strings with {= perl expr =} # Replace replacement strings with {= perl expr =}
@command = merge_rpl_parts(@command);
# Protect matching inside {= perl expr =} # Protect matching inside {= perl expr =}
# by replacing {= and =} with \257< and \257> # by replacing {= and =} with \257< and \257>
for(@command) { for(@command) {
@ -6872,7 +6873,10 @@ sub new {
::error("Command cannot contain the character \257. Use a function for that.\n"); ::error("Command cannot contain the character \257. Use a function for that.\n");
::wait_and_exit(255); ::wait_and_exit(255);
} }
s/\Q$Global::parensleft\E(.*?)\Q$Global::parensright\E/\257<$1\257>/gx; # Needs to match rightmost left parens (Perl defaults to leftmost)
# to deal with: {={==}
# Disallow \257 to avoid nested {= {= =} =}
while(s/([^\257]*) \Q$Global::parensleft\E ([^\257]*?) \Q$Global::parensright\E /$1\257<$2\257>/gx) {}
} }
for my $rpl (keys %Global::rpl) { for my $rpl (keys %Global::rpl) {
# Replace the short hand string with the {= perl expr =} in $command and $opt::tagstring # Replace the short hand string with the {= perl expr =} in $command and $opt::tagstring
@ -6979,6 +6983,41 @@ sub new {
}, ref($class) || $class; }, ref($class) || $class;
} }
sub merge_rpl_parts {
# '{=' 'perlexpr' '=}' => '{= perlexpr =}'
# Input:
# @in = the @command as given by the user
# Uses:
# $Global::parensleft
# $Global::parensright
# Returns:
# @command with parts merged to keep {= and =} as one
my @in = @_;
my @out;
my $l = quotemeta($Global::parensleft);
my $r = quotemeta($Global::parensright);
while(@in) {
my $s = shift @in;
$_ = $s;
# Remove matching (right most) parens
while(s/(.*)$l.*?$r/$1/o) {}
if(/$l/o) {
# Missing right parens
while(@in) {
$s .= " ".shift @in;
$_ = $s;
while(s/(.*)$l.*?$r/$1/o) {}
if(not /$l/o) {
last;
}
}
}
push @out, $s;
}
return @out;
}
sub get { sub get {
my $self = shift; my $self = shift;
if(@{$self->{'unget'}}) { if(@{$self->{'unget'}}) {

View file

@ -3058,7 +3058,7 @@ To submit your jobs to the queue:
You can of course use B<-S> to distribute the jobs to remote You can of course use B<-S> to distribute the jobs to remote
computers: computers:
true >jobqueue; tail -f jobqueue | parallel -S .. true >jobqueue; tail -n+0 -f jobqueue | parallel -S ..
There is a a small issue when using GNU B<parallel> as queue There is a a small issue when using GNU B<parallel> as queue
system/batch manager: You have to submit JobSlot number of jobs before system/batch manager: You have to submit JobSlot number of jobs before

View file

@ -133,7 +133,7 @@
.\" ======================================================================== .\" ========================================================================
.\" .\"
.IX Title "PARALLEL_TUTORIAL 1" .IX Title "PARALLEL_TUTORIAL 1"
.TH PARALLEL_TUTORIAL 1 "2014-11-10" "20141022" "parallel" .TH PARALLEL_TUTORIAL 1 "2014-11-26" "20141122" "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

View file

@ -23,11 +23,22 @@ echo '### Test bug #43284: {%} and {#} with --xapply';
echo '**' echo '**'
echo '### Test bug #43376: {%} and {#} with --pipe' echo '### Test bug #43376: {%} and {#} with --pipe'
echo foo | parallel -q --pipe -k echo {#} echo foo | parallel -q --pipe -k echo {#}
echo foo | parallel --pipe -k echo {%} echo foo | parallel --pipe -k echo {%}
echo foo | parallel -q --pipe -k echo {%} echo foo | parallel -q --pipe -k echo {%}
echo foo | parallel --pipe -k echo {#} echo foo | parallel --pipe -k echo {#}
echo '**' echo '**'
echo '### {= and =} in different groups'
parallel echo {= s/a/b/ =} ::: a
parallel echo {= s/a/b/=} ::: a
parallel echo {= s/a/b/=}{= s/a/b/=} ::: a
parallel echo {= s/a/b/=}{=s/a/b/=} ::: a
parallel echo {= s/a/b/=}{= {= s/a/b/=} ::: a
parallel echo {= s/a/b/=}{={=s/a/b/=} ::: a
parallel echo {= s/a/b/ =} {={==} ::: a
parallel echo {={= =} ::: a
parallel echo {= {= =} ::: a
parallel echo {= {= =} =} ::: a
EOF EOF

View file

@ -16,13 +16,35 @@ echo '**'
** **
echo '### Test bug #43376: {%} and {#} with --pipe' echo '### Test bug #43376: {%} and {#} with --pipe'
### Test bug #43376: {%} and {#} with --pipe ### Test bug #43376: {%} and {#} with --pipe
echo foo | parallel -q --pipe -k echo {#} echo foo | parallel -q --pipe -k echo {#}
1 1
echo foo | parallel --pipe -k echo {%} echo foo | parallel --pipe -k echo {%}
1 1
echo foo | parallel -q --pipe -k echo {%} echo foo | parallel -q --pipe -k echo {%}
1 1
echo foo | parallel --pipe -k echo {#} echo foo | parallel --pipe -k echo {#}
1 1
echo '**' echo '**'
** **
echo '### {= and =} in different groups'
### {= and =} in different groups
parallel echo {= s/a/b/ =} ::: a
b
parallel echo {= s/a/b/=} ::: a
b
parallel echo {= s/a/b/=}{= s/a/b/=} ::: a
bb
parallel echo {= s/a/b/=}{=s/a/b/=} ::: a
bb
parallel echo {= s/a/b/=}{= {= s/a/b/=} ::: a
b{= b
parallel echo {= s/a/b/=}{={=s/a/b/=} ::: a
b{=b
parallel echo {= s/a/b/ =} {={==} ::: a
b {=a
parallel echo {={= =} ::: a
{=a
parallel echo {= {= =} ::: a
{= a
parallel echo {= {= =} =} ::: a
{= a =}