parallel: Time in --bar is printed as 1d02h03m04s.

This commit is contained in:
Ole Tange 2018-03-25 00:19:08 +01:00
parent 733d882260
commit b60a203bd8
7 changed files with 63 additions and 34 deletions

View file

@ -4,6 +4,7 @@
Check that documentation is updated (compare to web): Check that documentation is updated (compare to web):
git grep -E '(alpha|beta) testing' | cat
git diff last-release-commit git diff last-release-commit
Unmodified beta since last version => production Unmodified beta since last version => production
Unmodified alpha since last version => beta Unmodified alpha since last version => beta
@ -198,37 +199,19 @@ to:parallel@gnu.org, bug-parallel@gnu.org
stable-bcc: Jesse Alama <jessealama@fastmail.fm> stable-bcc: Jesse Alama <jessealama@fastmail.fm>
Subject: GNU Parallel 20180322 ('Hawking') released <<[stable]>> Subject: GNU Parallel 20180422 ('Trèbes') released <<[stable]>>
GNU Parallel 20180322 ('Hawking') <<[stable]>> has been released. It is available for download at: http://ftpmirror.gnu.org/parallel/ GNU Parallel 20180422 ('Trèbes') <<[stable]>> has been released. It is available for download at: http://ftpmirror.gnu.org/parallel/
<<No new functionality was introduced so this is a good candidate for a stable release.>> <<No new functionality was introduced so this is a good candidate for a stable release.>>
Quote of the month: Quote of the month:
If you arent nesting <<>>
gnu parallel calls in gnu parallel calls --
I dont know how you have fun.
-- Ernest W. Durbin III EWDurbin@twitter
New in this release: New in this release:
* niceload -p can now take multiple pids separated by comma
* --timeout gives a warning when killing processes
* --embed now uses the same code for all supported shells
* --delay can now take arguments like 1h12m07s
* Parallel. Straight from your command line https://medium.com/@alonisser/parallel-straight-from-your-command-line-feb6db8b6cee
* GNU Parallel was used in POAP-Parallelized Open Babel & Autodock suite Pipeline https://github.com/inpacdb/POAP
* Pi Cluster Parallel Script First Fire https://chiefio.wordpress.com/2018/02/23/pi-cluster-parallel-script-first-fire/
* How to Restore MySQL Logical Backup at Maximum Speed https://www.percona.com/blog/2018/02/22/restore-mysql-logical-backup-maximum-speed/
<<Citation not OK: BAMClipper: removing primers from alignments to minimize false-negative mutations in amplicon next-generation sequencing https://www.nature.com/articles/s41598-017-01703-6>> <<Citation not OK: BAMClipper: removing primers from alignments to minimize false-negative mutations in amplicon next-generation sequencing https://www.nature.com/articles/s41598-017-01703-6>>
@ -301,13 +284,13 @@ Walk through the tutorial (man parallel_tutorial). Your commandline will love yo
When using programs that use GNU Parallel to process data for publication please cite: When using programs that use GNU Parallel to process data for publication please cite:
O. Tange (2011): GNU Parallel - The Command-Line Power Tool, ;login: The USENIX Magazine, February 2011:42-47. O. Tange (2018): GNU Parallel 2018, April 2018, https://doi.org/10.5281/zenodo.1146014.
If you like GNU Parallel: If you like GNU Parallel:
* Give a demo at your local user group/team/colleagues * Give a demo at your local user group/team/colleagues
* Post the intro videos on Reddit/Diaspora*/forums/blogs/ Identi.ca/Google+/Twitter/Facebook/Linkedin/mailing lists * Post the intro videos on Reddit/Diaspora*/forums/blogs/ Identi.ca/Google+/Twitter/Facebook/Linkedin/mailing lists
* Get the merchandise https://www.gnu.org/s/parallel/merchandise.html * Get the merchandise https://gnuparallel.threadless.com/designs/gnu-parallel
* Request or write a review for your favourite blog or magazine * Request or write a review for your favourite blog or magazine
* Request or build a package for your favourite distribution (if it is not already there) * Request or build a package for your favourite distribution (if it is not already there)
* Invite me for your next conference * Invite me for your next conference

View file

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

View file

@ -132,9 +132,9 @@ useful to keep the connection alive.
Sets niceness. See B<nice>(1). Sets niceness. See B<nice>(1).
=item B<-p> I<PID>[,I<PID>] (alpha testing) =item B<-p> I<PID>[,I<PID>] (beta testing)
=item B<--pid> I<PID>[,I<PID>] (alpha testing) =item B<--pid> I<PID>[,I<PID>] (beta testing)
Process IDs of processes to suspend. You can specify multiple process Process IDs of processes to suspend. You can specify multiple process
IDs with multiple B<-p> I<PID> or by separating the PIDs with comma. IDs with multiple B<-p> I<PID> or by separating the PIDs with comma.

View file

@ -1417,7 +1417,7 @@ sub check_invalid_option_combinations {
sub init_globals { sub init_globals {
# Defaults: # Defaults:
$Global::version = 20180322; $Global::version = 20180323;
$Global::progname = 'parallel'; $Global::progname = 'parallel';
$Global::infinity = 2**31; $Global::infinity = 2**31;
$Global::debug = 0; $Global::debug = 0;
@ -3025,9 +3025,10 @@ sub progress {
replace_placeholders(["\257<\257>"],0,0) : ""; replace_placeholders(["\257<\257>"],0,0) : "";
# These chars mess up display in the terminal # These chars mess up display in the terminal
$arg =~ tr/[\011-\016\033\302-\365]//d; $arg =~ tr/[\011-\016\033\302-\365]//d;
my $eta_dhms = ::seconds_to_time_units($eta);
my $bar_text = my $bar_text =
sprintf("%d%% %d:%d=%ds %s", sprintf("%d%% %d:%d=%s %s",
$pctcomplete*100, $completed, $left, $eta, $arg); $pctcomplete*100, $completed, $left, $eta_dhms, $arg);
my $terminal_width = terminal_columns(); my $terminal_width = terminal_columns();
my $s = sprintf("%-${terminal_width}s", my $s = sprintf("%-${terminal_width}s",
substr($bar_text." "x$terminal_width, substr($bar_text." "x$terminal_width,
@ -4594,6 +4595,33 @@ sub multiply_time_units {
return wantarray ? @v : $v[0]; return wantarray ? @v : $v[0];
} }
sub seconds_to_time_units {
# Convert seconds into ??d??h??m??s
# s=1, m=60, h=3600, d=86400
# Input:
# $s = int in seconds
# Returns:
# $str = string time units
my $s = shift;
my $str;
my $d = int($s/86400);
$s -= $d * 86400;
my $h = int($s/3600);
$s -= $h * 3600;
my $m = int($s/60);
$s -= $m * 60;
if($d) {
$str = sprintf("%dd%02dh%02dm%02ds",$d,$h,$m,$s);
} elsif($h) {
$str = sprintf("%dh%02dm%02ds",$h,$m,$s);
} elsif($m) {
$str = sprintf("%dm%02ds",$m,$s);
} else {
$str = sprintf("%ds",$s);
}
return $str;
}
{ {
my ($disk_full_fh, $b8193, $error_printed); my ($disk_full_fh, $b8193, $error_printed);
sub exit_if_disk_full { sub exit_if_disk_full {

View file

@ -648,7 +648,7 @@ If I<eof-str> is omitted, there is no end of file string. If neither
B<-E> nor B<-e> is used, no end of file string is used. B<-E> nor B<-e> is used, no end of file string is used.
=item B<--embed> (alpha testing) =item B<--embed> (beta testing)
Embed GNU B<parallel> in a shell script. If you need to distribute your Embed GNU B<parallel> in a shell script. If you need to distribute your
script to someone who does not want to install GNU B<parallel> you can script to someone who does not want to install GNU B<parallel> you can
@ -2899,6 +2899,24 @@ B<$(date -d "today -$1 days" +%Y%m%d)> will give the dates in
YYYYMMDD with B<$1> days subtracted. YYYYMMDD with B<$1> days subtracted.
=head1 EXAMPLE: Download world map from NASA
NASA provides tiles to download on earthdata.nasa.gov. Download tiles
for Blue Marble world map and create a 10240x20480 map.
base=https://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi
service="SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0"
layer="LAYER=BlueMarble_ShadedRelief_Bathymetry"
set="STYLE=&TILEMATRIXSET=EPSG4326_500m&TILEMATRIX=5"
tile="TILEROW={1}&TILECOL={2}"
format="FORMAT=image%2Fjpeg"
url="$base?$service&$layer&$set&$tile&$format"
parallel -j0 -q wget "$url" -O {1}_{2}.jpg ::: {0..19} ::: {0..39}
parallel eval convert +append {}_{0..39}.jpg line{}.jpg ::: {0..19}
convert -append line{0..19}.jpg world.jpg
=head1 EXAMPLE: Copy files as last modified date (ISO8601) with added random digits =head1 EXAMPLE: Copy files as last modified date (ISO8601) with added random digits
find . | parallel cp {} '../destdir/{= $a=int(10000*rand); $_=pQ($_); find . | parallel cp {} '../destdir/{= $a=int(10000*rand); $_=pQ($_);
@ -3995,7 +4013,7 @@ the file at the same time.
Name the semaphore to have multiple different semaphores active at the Name the semaphore to have multiple different semaphores active at the
same time: same time:
seq 3 | parallel sem --id mymutex sed -i -e 'i{}' myfile seq 3 | parallel sem --id mymutex sed -i -e '1i{}' myfile
=head1 EXAMPLE: Mutex for a script =head1 EXAMPLE: Mutex for a script

View file

@ -11,7 +11,7 @@ parset - set shell variables in parallel
B<parset> I<variablename> [options for GNU Parallel] B<parset> I<variablename> [options for GNU Parallel]
B<env_parset> I<variablename> [options for GNU Parallel] (beta testing) B<env_parset> I<variablename> [options for GNU Parallel]
=head1 DESCRIPTION =head1 DESCRIPTION

View file

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