parallel: --xapply now recycles arguments if an input source has more arguments than others.

This commit is contained in:
Ole Tange 2013-06-06 00:37:38 +02:00
parent f30a852c47
commit 301709bde9
2 changed files with 9 additions and 13 deletions

View file

@ -193,17 +193,8 @@ release should be considered beta quality.
New in this release: New in this release:
* --ctrlc is now default if --pipe is not used; thus making it * Developer job asking for GNU Parallel expertise:
possible to kill remotely started jobs simply by pressing Ctrl-C. http://careers.stackoverflow.com/jobs/35562/developer-big-data-geo-and-web-climate-central
* --timeout 200% now means kill jobs that take more than twice the
time of the median run time of a job.
* Jobs are now distributed round robin when having mulitiple
--sshlogin instead of filling up one --sshlogin at a time.
* niceload: darwin version of --io --mem --swap. Thanks to Anders F
Björklund.
* Bug fixes and man page updates. * Bug fixes and man page updates.

View file

@ -641,7 +641,7 @@ sub get_options_from_array {
sub parse_options { sub parse_options {
# Returns: N/A # Returns: N/A
# Defaults: # Defaults:
$Global::version = 20130522; $Global::version = 20130606;
$Global::progname = 'parallel'; $Global::progname = 'parallel';
$Global::infinity = 2**31; $Global::infinity = 2**31;
$Global::debug = 0; $Global::debug = 0;
@ -5311,11 +5311,16 @@ sub xapply_get {
my $empty = 1; my $empty = 1;
for my $fh (@{$self->{'fhs'}}) { for my $fh (@{$self->{'fhs'}}) {
my $arg = read_arg_from_fh($fh); my $arg = read_arg_from_fh($fh);
# Record $arg for recycling at end of file
push @{$self->{'arg_matrix'}{$fh}}, $arg;
if(defined $arg) { if(defined $arg) {
push @record, $arg; push @record, $arg;
$empty = 0; $empty = 0;
} else { } else {
push @record, Arg->new(""); # End of file: Recycle arguments
push @{$self->{'arg_matrix'}{$fh}}, shift @{$self->{'arg_matrix'}{$fh}};
# return last @{$args->{'args'}{$fh}};
push @record, @{$self->{'arg_matrix'}{$fh}}[-1];
} }
} }
if($empty) { if($empty) {