mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-12-22 12:47:54 +00:00
parallel: eta time smoothing depending on pct complete
This commit is contained in:
parent
7b4f747877
commit
1478df33f7
|
@ -1,5 +1,3 @@
|
|||
Bug: parallel --colsep ')' echo {1}
|
||||
|
||||
job->start():
|
||||
$jobslot = Global::jobslot->$sshlogin
|
||||
|
||||
|
|
28
src/parallel
28
src/parallel
|
@ -49,6 +49,10 @@ if(@ARGV) {
|
|||
|
||||
$Global::JobQueue = JobQueue->new(
|
||||
$command,\@fhlist,$Global::Xargs,$number_of_args,\@Global::ret_files);
|
||||
if($::opt_eta) {
|
||||
# Count the number of jobs before starting any
|
||||
$Global::JobQueue->total_jobs();
|
||||
}
|
||||
for my $sshlogin (values %Global::host) {
|
||||
$sshlogin->max_jobs_running();
|
||||
}
|
||||
|
@ -1000,17 +1004,17 @@ sub progress {
|
|||
my $completed = 0;
|
||||
for(@workers) { $completed += $Global::host{$_}->jobs_completed() }
|
||||
if($completed) {
|
||||
my $jobs_left = ($Global::JobQueue->total_jobs() - $completed);
|
||||
my $avgtime = (time-$Private::first_completed)/$completed;
|
||||
my $total = $Global::JobQueue->total_jobs();
|
||||
my $left = $total - $completed;
|
||||
my $pctcomplete = $completed / $total;
|
||||
my $timepassed = (time - $Private::first_completed);
|
||||
my $avgtime = $timepassed / $completed;
|
||||
$Private::smoothed_avg_time ||= $avgtime;
|
||||
$Private::smoothed_avg_time = 0.90 * $Private::smoothed_avg_time + 0.10 * $avgtime;
|
||||
my $this_eta = $jobs_left * $Private::smoothed_avg_time;
|
||||
#my $this_eta = ($Global::JobQueue->total_jobs() - $completed) * $avgtime;
|
||||
#$Private::eta ||= $this_eta;
|
||||
# Smooth the eta so it does not jump wildly
|
||||
#$Private::eta = 0.95 * $Private::eta + 0.05 * $this_eta;
|
||||
#$eta = sprintf("ETA: %ds $avgtime", $Private::eta);
|
||||
$eta = sprintf("ETA: %ds %dleft %.2favg ", $this_eta, $jobs_left, $avgtime);
|
||||
$Private::smoothed_avg_time = (1 - $pctcomplete) *
|
||||
$Private::smoothed_avg_time + $pctcomplete * $avgtime;
|
||||
my $this_eta = $left * $Private::smoothed_avg_time;
|
||||
$eta = sprintf("ETA: %ds %dleft %.2favg ", $this_eta, $left, $avgtime);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1282,7 +1286,10 @@ sub read_sshloginfile {
|
|||
if($file eq "..") {
|
||||
$file = $ENV{'HOME'}."/.parallel/sshloginfile";
|
||||
}
|
||||
open(IN, $file) || ::die_bug("Cannot open $file");
|
||||
if(not open(IN, $file)) {
|
||||
print $Global::original_stderr "Cannot open $file\n";
|
||||
exit(255);
|
||||
}
|
||||
while(<IN>) {
|
||||
chomp;
|
||||
/^\s*#/ and next;
|
||||
|
@ -2380,7 +2387,6 @@ sub new {
|
|||
'unget' => \@unget,
|
||||
'commandlinequeue' => $commandlinequeue,
|
||||
'total_jobs' => undef,
|
||||
# 'next_seq' => 1,
|
||||
}, ref($class) || $class;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ PARALLEL='-k --jobs 1 -S '$SERVER1' perl -pe "\\$a=1; print\\$a"' parallel -v ::
|
|||
|
||||
echo '### Test ugly quoting from profile file'
|
||||
cat <<EOF >~/.parallel/test_profile
|
||||
# testprofile
|
||||
-k --jobs 1 perl -pe '\$a=1; print \$a'
|
||||
EOF
|
||||
parallel -v -J test_profile ::: <(echo a) <(echo b)
|
||||
|
@ -58,6 +59,7 @@ PARALLEL='-k --jobs 1 -S ssh\ '$SERVER1'\ ssh\ parallel@'$SERVER2' perl -pe "\\$
|
|||
|
||||
echo '### Test quoting of space in long arguments (--sshlogin) from profile file'
|
||||
cat <<EOF >~/.parallel/test_profile
|
||||
# testprofile
|
||||
-k --jobs 1 --sshlogin ssh\ $SERVER1\ ssh\ parallel@$SERVER2 perl -pe '\$a=1; print \$a'
|
||||
EOF
|
||||
parallel -v -J test_profile ::: /bin/gunzip
|
||||
|
|
Loading…
Reference in a new issue