diff --git a/src/parallel b/src/parallel index 0072df97..b3779df2 100755 --- a/src/parallel +++ b/src/parallel @@ -915,7 +915,9 @@ sub drain_job_queue { start_more_jobs(); # These jobs may not be started because of loadavg sleep 1; } - } while (not $Global::start_no_new_jobs and not $Global::JobQueue->empty()); + } while ($Global::total_running > 0 + or + not $Global::start_no_new_jobs and not $Global::JobQueue->empty()); if($::opt_progress) { print $Global::original_stderr "\n"; @@ -1719,12 +1721,12 @@ sub loadavg { $update_loadavg_file = 1; } } else { - ::debug("NXfile: ".$self->{'loadavg_file'}); + ::debug("No loadavg file: ".$self->{'loadavg_file'}); $self->{'loadavg'} = undef; $update_loadavg_file = 1; } if($update_loadavg_file) { - ::debug("Updating".$self->{'loadavg_file'}); + ::debug("Updating loadavg file".$self->{'loadavg_file'}); $self->{'last_loadavg_update'} = time; -e $ENV{'HOME'}."/.parallel" or mkdir $ENV{'HOME'}."/.parallel"; -e $ENV{'HOME'}."/.parallel/tmp" or mkdir $ENV{'HOME'}."/.parallel/tmp"; diff --git a/testsuite/tests-to-run/test45.sh b/testsuite/tests-to-run/test45.sh index 2a9cf18c..036f8ac4 100644 --- a/testsuite/tests-to-run/test45.sh +++ b/testsuite/tests-to-run/test45.sh @@ -3,6 +3,9 @@ SERVER1=parallel-server3 SERVER2=parallel-server2 +echo '### Bug in --load' +parallel -k --load 30 sleep 0.1\;echo ::: 1 2 3 + echo '### Test --load locally' seq 1 300 | nice timeout -k 1 14 parallel -j0 burnP6 stdout /usr/bin/time -f %e parallel --load 10 sleep ::: 1 | perl -ne '$_ > 10 and print "OK\n"' diff --git a/testsuite/wanted-results/test45 b/testsuite/wanted-results/test45 index cf9a01e5..b9c1bbab 100644 --- a/testsuite/wanted-results/test45 +++ b/testsuite/wanted-results/test45 @@ -1,3 +1,7 @@ +### Bug in --load +1 +2 +3 ### Test --load locally OK ### Test --load remote