mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-26 16:07:54 +00:00
parallel: Fixed bug #41565: Print happens in block - not after each job complete. Passes test suite.
This commit is contained in:
parent
032ba0935c
commit
3447f2da85
22
src/parallel
22
src/parallel
|
@ -2226,15 +2226,16 @@ sub reaper {
|
||||||
$Private::job_end_sequence ||= 1;
|
$Private::job_end_sequence ||= 1;
|
||||||
debug("Looking for: $Private::job_end_sequence ".
|
debug("Looking for: $Private::job_end_sequence ".
|
||||||
"Current: ".$job->seq()."\n");
|
"Current: ".$job->seq()."\n");
|
||||||
while($Private::print_later{$Private::job_end_sequence}
|
for(my $j = $Private::print_later{$Private::job_end_sequence};
|
||||||
or
|
$j or vec($Global::job_already_run,$Private::job_end_sequence,1);
|
||||||
vec($Global::job_already_run,$Private::job_end_sequence,1)) {
|
$Private::job_end_sequence++,
|
||||||
|
$j = $Private::print_later{$Private::job_end_sequence}) {
|
||||||
debug("Found job end $Private::job_end_sequence");
|
debug("Found job end $Private::job_end_sequence");
|
||||||
defined $Private::print_later{$Private::job_end_sequence} and
|
if($j) {
|
||||||
$Private::print_later{$Private::job_end_sequence}->print();
|
$j->print();
|
||||||
delete $Private::print_later{$Private::job_end_sequence};
|
delete $Private::print_later{$Private::job_end_sequence};
|
||||||
$Private::job_end_sequence++;
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$job->print();
|
$job->print();
|
||||||
}
|
}
|
||||||
|
@ -2266,6 +2267,7 @@ sub reaper {
|
||||||
$sshlogin->inc_jobs_completed();
|
$sshlogin->inc_jobs_completed();
|
||||||
$Global::total_running--;
|
$Global::total_running--;
|
||||||
delete $Global::running{$stiff};
|
delete $Global::running{$stiff};
|
||||||
|
start_more_jobs();
|
||||||
}
|
}
|
||||||
debug("done ");
|
debug("done ");
|
||||||
return $children_reaped;
|
return $children_reaped;
|
||||||
|
@ -4864,12 +4866,12 @@ sub print {
|
||||||
unlink $self->fd_file_name(1);
|
unlink $self->fd_file_name(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check for disk full
|
|
||||||
exit_if_disk_full();
|
|
||||||
if($Global::joblog) { $self->print_joblog() }
|
if($Global::joblog) { $self->print_joblog() }
|
||||||
|
|
||||||
# Printing is only relevant for grouped output.
|
# Printing is only relevant for grouped output.
|
||||||
$Global::grouped or return;
|
$Global::grouped or return;
|
||||||
|
# Check for disk full
|
||||||
|
exit_if_disk_full();
|
||||||
my $command = $self->sshlogin_wrap();
|
my $command = $self->sshlogin_wrap();
|
||||||
|
|
||||||
if(($opt::dryrun or $Global::verbose) and $Global::grouped
|
if(($opt::dryrun or $Global::verbose) and $Global::grouped
|
||||||
|
|
|
@ -7,7 +7,9 @@ cd tmp
|
||||||
cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | parallel -j0 -k -L1
|
cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | parallel -j0 -k -L1
|
||||||
echo '### bug #41565: Print happens in blocks - not after each job complete'
|
echo '### bug #41565: Print happens in blocks - not after each job complete'
|
||||||
echo 'The timing here is important: 2 3 4 5 6'
|
echo 'The timing here is important: 2 3 4 5 6'
|
||||||
ping -c 7 lo | parallel -j3 --delay 0.1 'echo {#}' | timestamp | head -n5 | cut -f 1 -d .
|
ping -c 7 lo | parallel -j3 'echo {#}' | timestamp -dd | perl -pe '$_=int($_+0.2)."\n"'
|
||||||
|
echo '300 ms jobs:'
|
||||||
|
ping -i .3 -c 10 lo | parallel -j3 --delay 0.3 echo | timestamp -d -d | perl -pe 's/(...).*/$1/' | tail -n +2
|
||||||
|
|
||||||
echo '### Test --tagstring'
|
echo '### Test --tagstring'
|
||||||
nice parallel -j1 -X -v --tagstring a{}b echo ::: 3 4
|
nice parallel -j1 -X -v --tagstring a{}b echo ::: 3 4
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo '### Test --joblog with exitval and Test --joblog with signal -- timing dependent'
|
echo '### Test --joblog with exitval and Test --joblog with signal -- timing dependent'
|
||||||
rm /tmp/parallel_sleep
|
rm -f /tmp/parallel_sleep
|
||||||
#parallel --joblog /tmp/parallel_joblog_signal 'echo foo >/tmp/parallel_sleep; sleep {}' ::: 30 2>/dev/null &
|
|
||||||
parallel --joblog /tmp/parallel_joblog_signal 'sleep {}' ::: 30 2>/dev/null &
|
parallel --joblog /tmp/parallel_joblog_signal 'sleep {}' ::: 30 2>/dev/null &
|
||||||
parallel --joblog /tmp/parallel_joblog_exitval 'echo foo >/tmp/parallel_sleep; sleep {} && echo sleep was not killed=BAD' ::: 30 2>/dev/null &
|
parallel --joblog /tmp/parallel_joblog_exitval 'echo foo >/tmp/parallel_sleep; sleep {} && echo sleep was not killed=BAD' ::: 30 2>/dev/null &
|
||||||
while [ ! -e /tmp/parallel_sleep ] ; do
|
while [ ! -e /tmp/parallel_sleep ] ; do
|
||||||
|
@ -14,5 +13,5 @@ wait
|
||||||
grep -q 134 /tmp/parallel_joblog_exitval && echo exitval=128+6 OK
|
grep -q 134 /tmp/parallel_joblog_exitval && echo exitval=128+6 OK
|
||||||
grep -q '[^0-9]6[^0-9]' /tmp/parallel_joblog_signal && echo signal OK
|
grep -q '[^0-9]6[^0-9]' /tmp/parallel_joblog_signal && echo signal OK
|
||||||
|
|
||||||
#rm /tmp/parallel_joblog_exitval /tmp/parallel_joblog_signal
|
rm -f /tmp/parallel_joblog_exitval /tmp/parallel_joblog_signal
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,32 @@
|
||||||
|
### bug #41565: Print happens in blocks - not after each job complete
|
||||||
|
The timing here is important: 2 3 4 5 6
|
||||||
|
2
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
300 ms jobs:
|
||||||
|
0.3
|
||||||
|
0.3
|
||||||
|
0.3
|
||||||
|
0.3
|
||||||
|
0.3
|
||||||
|
0.3
|
||||||
|
0.3
|
||||||
|
0.3
|
||||||
|
0.3
|
||||||
|
0.3
|
||||||
|
0.3
|
||||||
|
0.3
|
||||||
|
0.3
|
||||||
|
0.3
|
||||||
### Test --tagstring
|
### Test --tagstring
|
||||||
echo 3 4
|
echo 3 4
|
||||||
a3b a4b 3 4
|
a3b a4b 3 4
|
||||||
|
|
|
@ -19,6 +19,7 @@ Computers / CPU cores / Max jobs to run
|
||||||
|
|
||||||
Computer:jobs running/jobs completed/%of started jobs/Average seconds to complete
|
Computer:jobs running/jobs completed/%of started jobs/Average seconds to complete
|
||||||
local:1/0/100%/0.0s 1 2
|
local:1/0/100%/0.0s 1 2
|
||||||
|
ETA: 0s Left: 0 AVG: 0.00s local:0/1/100%/1.0s
|
||||||
### --timeout --onall on remote machines: 2*slept 1, 2 jobs failed
|
### --timeout --onall on remote machines: 2*slept 1, 2 jobs failed
|
||||||
slept 1
|
slept 1
|
||||||
slept 1
|
slept 1
|
||||||
|
|
Loading…
Reference in a new issue