Implemented --cat and --fifo.

This commit is contained in:
Ole Tange 2014-03-23 01:07:18 +01:00
parent a74c5c316f
commit 1be2d7568c
10 changed files with 100 additions and 42 deletions

12
README
View file

@ -40,9 +40,9 @@ document.
Full installation of GNU Parallel is as simple as:
wget http://ftpmirror.gnu.org/parallel/parallel-20140322.tar.bz2
bzip2 -dc parallel-20140322.tar.bz2 | tar xvf -
cd parallel-20140322
wget http://ftpmirror.gnu.org/parallel/parallel-20140323.tar.bz2
bzip2 -dc parallel-20140323.tar.bz2 | tar xvf -
cd parallel-20140323
./configure && make && make install
@ -51,9 +51,9 @@ Full installation of GNU Parallel is as simple as:
If you are not root you can add ~/bin to your path and install in
~/bin and ~/share:
wget http://ftpmirror.gnu.org/parallel/parallel-20140322.tar.bz2
bzip2 -dc parallel-20140322.tar.bz2 | tar xvf -
cd parallel-20140322
wget http://ftpmirror.gnu.org/parallel/parallel-20140323.tar.bz2
bzip2 -dc parallel-20140323.tar.bz2 | tar xvf -
cd parallel-20140323
./configure --prefix=$HOME && make && make install
Or if your system lacks 'make' you can simply copy src/parallel

20
configure vendored
View file

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for parallel 20140322.
# Generated by GNU Autoconf 2.69 for parallel 20140323.
#
# Report bugs to <bug-parallel@gnu.org>.
#
@ -579,8 +579,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='parallel'
PACKAGE_TARNAME='parallel'
PACKAGE_VERSION='20140322'
PACKAGE_STRING='parallel 20140322'
PACKAGE_VERSION='20140323'
PACKAGE_STRING='parallel 20140323'
PACKAGE_BUGREPORT='bug-parallel@gnu.org'
PACKAGE_URL=''
@ -1194,7 +1194,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures parallel 20140322 to adapt to many kinds of systems.
\`configure' configures parallel 20140323 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1260,7 +1260,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of parallel 20140322:";;
short | recursive ) echo "Configuration of parallel 20140323:";;
esac
cat <<\_ACEOF
@ -1327,7 +1327,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
parallel configure 20140322
parallel configure 20140323
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -1344,7 +1344,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by parallel $as_me 20140322, which was
It was created by parallel $as_me 20140323, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -2159,7 +2159,7 @@ fi
# Define the identity of the package.
PACKAGE='parallel'
VERSION='20140322'
VERSION='20140323'
cat >>confdefs.h <<_ACEOF
@ -2710,7 +2710,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by parallel $as_me 20140322, which was
This file was extended by parallel $as_me 20140323, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -2772,7 +2772,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
parallel config.status 20140322
parallel config.status 20140323
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View file

@ -1,4 +1,4 @@
AC_INIT([parallel], [20140322], [bug-parallel@gnu.org])
AC_INIT([parallel], [20140323], [bug-parallel@gnu.org])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([

View file

@ -156,6 +156,9 @@ git diff
git commit -a
Released as 20140X22 ('').
== Update Savannah ==
Content from release mail:
@ -191,8 +194,7 @@ file:///home/tange/privat/parallel/doc/release_new_version
from:tange@gnu.org
to:parallel@gnu.org, bug-parallel@gnu.org
cc:Sandro Cazzaniga <kharec@mandriva.org>,
Tim Cuthbertson <tim3d.junk@gmail.com>,
cc:Tim Cuthbertson <tim3d.junk@gmail.com>,
Ludovic Courtès <ludo@gnu.org>, Markus Ammer <mkmm@gmx-topmail.de>,
Pavel Nuzhdin <pnzhdin@gmail.com>, Phil Sung <psung@alum.mit.edu>,
Michael Shigorin <mike@altlinux.org>,
@ -215,25 +217,9 @@ No new functionality was introduced so this is a good candidate for a stable rel
New in this release:
* Offical package for Alpine Linux now exists: http://alpinelinux.org/apk/main/x86/parallel
* How to run tbss_2_reg in parallel http://tadpolebrainimaging.blogspot.dk/2014/03/how-to-run-tbss2reg-in-parallel.html
* GNU Parallel was cited in: Estimating uncertainties in statistics computed from direct numerical simulation http://dx.doi.org/10.1063/1.4866813
* GNU Parallel was cited in: Vehicle routing problems with time windows and multiple service workers: a systematic comparison between ACO and GRASP http://link.springer.com/article/10.1007/s10100-014-0341-z
* GNU Parallel, quick and easy http://www.reganmian.net/blog/2014/03/09/gnu-parallel-quick-and-easy/
* Using Multiple CPU Cores With Command Line Tools http://prateekvjoshi.com/2014/03/07/using-multiple-cpu-cores-with-command-line-tools/
* Batch convert mp3 CBR to VBR http://blogs.zercle.com/bouroo/2013/03/batch-convert-mp3-cbr-to-vbr/
* Running Behat in parallel with Selenium grid http://zalas.eu/running-behat-in-parallel-with-selenium-grid/
* Git-Mirror per cronjob aktuell halten https://www.schtobia.de/2013/git-mirror-per-cronjob-aktuell-halten/
* Пишем многопоточный скрипт на bash http://dafter.ru/duf/howto/130.html
* 如何利用多核CPU来加速你的Linux命令 http://www.chinadmd.com/file/xpcr6wpctzwtuu3ivwiaatcs_1.html
* Iterative DNS Brute Forcing http://www.room362.com/blog/2014/02/19/iterative-dns-brute-forcing/
* Bug fixes and man page updates.

View file

@ -24,7 +24,7 @@
use strict;
use Getopt::Long;
$Global::progname="niceload";
$Global::version = 20140322;
$Global::version = 20140323;
Getopt::Long::Configure("bundling","require_order");
get_options_from_array(\@ARGV) || die_usage();
if($opt::version) {

View file

@ -588,6 +588,8 @@ sub options_hash {
"Y" => \$opt::retired,
"skip-first-line" => \$opt::skip_first_line,
"header=s" => \$opt::header,
"cat" => \$opt::cat,
"fifo" => \$opt::fifo,
);
}
@ -628,7 +630,7 @@ sub get_options_from_array {
sub parse_options {
# Returns: N/A
# Defaults:
$Global::version = 20140322;
$Global::version = 20140323;
$Global::progname = 'parallel';
$Global::infinity = 2**31;
$Global::debug = 0;
@ -5252,6 +5254,16 @@ sub populate {
my $self = shift;
my $next_arg;
my $max_len = $Global::minimal_command_line_length || Limits::Command::max_length();
if($opt::cat or $opt::fifo) {
# Get a tempfile name
my($outfh,$name) = ::tempfile(SUFFIX => ".pip");
close $outfh;
# Unlink is needed if: ssh otheruser@localhost
unlink $name;
$Global::JobQueue->{'commandlinequeue'}->{'arg_queue'}->unget([Arg->new($name)]);
}
while (not $self->{'arg_queue'}->empty()) {
$next_arg = $self->{'arg_queue'}->get();
if(not defined $next_arg) {
@ -5577,7 +5589,25 @@ sub number_of_replacements {
sub replaced {
my $self = shift;
if(not defined $self->{'replaced'}) {
$self->{'replaced'} = $self->replace_placeholders($self->{'command'},$Global::JobQueue->quote_args());
if($opt::cat) {
# Prepend 'cat > {};'
# Append '_EXIT=$?;(rm {};exit $_EXIT)'
$self->{'replaced'} =
$self->replace_placeholders("cat > $Global::replace{'{}'}; ". $self->{'command'}.
"; _EXIT=\$?; rm $Global::replace{'{}'}; exit \$_EXIT",
$Global::JobQueue->quote_args());
} elsif($opt::fifo) {
# Prepend 'mkfifo {}; ('
# Append ') & _PID=$!; cat > {}; wait $_PID; _EXIT=$?;(rm {};exit $_EXIT)'
$self->{'replaced'} =
$self->replace_placeholders("mkfifo $Global::replace{'{}'}; (".
$self->{'command'}.
") & _PID=\$!; cat > $Global::replace{'{}'}; ".
"wait \$_PID; _EXIT=\$?; rm $Global::replace{'{}'}; exit \$_EXIT",
$Global::JobQueue->quote_args());
} else {
$self->{'replaced'} = $self->replace_placeholders($self->{'command'},$Global::JobQueue->quote_args());
}
if($self->{'replaced'} =~ /^\s*(-\S+)/) {
# Is this really a command in $PATH starting with '-'?
my $cmd = $1;

View file

@ -378,6 +378,16 @@ I<size> defaults to 1M.
See B<--pipe> for use of this.
=item B<--cat> (alpha testing)
Create a temporary file with content. Normally B<--pipe> will give
data to the program on stdin (standard input). With B<--cat> GNU
B<parallel> will create a temporary file with the name in {}, so you
can do: B<parallel --pipe --cat wc {}>.
See also B<--fifo>.
=item B<--cleanup>
Remove transferred files. B<--cleanup> will remove the transferred files
@ -526,6 +536,18 @@ See also B<--bg>, B<man sem>.
Implies B<--semaphore>.
=item B<--fifo> (alpha testing)
Create a temporary fifo with content. Normally B<--pipe> will give
data to the program on stdin (standard input). With B<--fifo> GNU
B<parallel> will create a temporary fifo with the name in {}, so you
can do: B<parallel --pipe --fifo wc {}>.
Beware: If data is not read from the fifo, the job will block forever.
See also B<--cat>.
=item B<--filter-hosts>
Remove down hosts. For each remote host: check that login through ssh

View file

@ -397,6 +397,16 @@ than a single record.
See @strong{--pipe} for use of this.
@item @strong{--cat} (alpha testing)
@anchor{@strong{--cat} (alpha testing)}
Create a temporary file with content. Normally @strong{--pipe} will give
data to the program on stdin (standard input). With @strong{--cat} GNU
@strong{parallel} will create a temporary file with the name in @{@}, so you
can do: @strong{parallel --pipe --cat wc @{@}}.
See also @strong{--fifo}.
@item @strong{--cleanup}
@anchor{@strong{--cleanup}}
@ -553,6 +563,16 @@ See also @strong{--bg}, @strong{man sem}.
Implies @strong{--semaphore}.
@item @strong{--fifo} (alpha testing)
@anchor{@strong{--fifo} (alpha testing)}
Create a temporary fifo with content. Normally @strong{--pipe} will give
data to the program on stdin (standard input). With @strong{--fifo} GNU
@strong{parallel} will create a temporary fifo with the name in @{@}, so you
can do: @strong{parallel --pipe --fifo wc @{@}}.
See also @strong{--cat}.
@item @strong{--filter-hosts}
@anchor{@strong{--filter-hosts}}

View file

@ -124,7 +124,7 @@
.\" ========================================================================
.\"
.IX Title "PARALLEL_TUTORIAL 1"
.TH PARALLEL_TUTORIAL 1 "2014-01-25" "20140322" "parallel"
.TH PARALLEL_TUTORIAL 1 "2014-01-25" "20140323" "parallel"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l

View file

@ -556,7 +556,7 @@ $Global::Initfile && unlink $Global::Initfile;
exit ($err);
sub parse_options {
$Global::version = 20140322;
$Global::version = 20140323;
$Global::progname = 'sql';
# This must be done first as this may exec myself