mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 14:07:55 +00:00
niceload --sensor ... -l with negative number means: Run if values less than number.
This commit is contained in:
parent
bc0f7701ec
commit
111c7384f7
21
src/niceload
21
src/niceload
|
@ -455,10 +455,16 @@ sub over_run_limit {
|
|||
$status += (::max(1,$self->{'runmem'}/$mem)-1);
|
||||
}
|
||||
if($self->{'runload'}) {
|
||||
# load should be between 0-10ish
|
||||
# 0 load => 0
|
||||
# If used with other limits load should be between 0-10ish
|
||||
no warnings 'numeric';
|
||||
my $load = $self->load_status();
|
||||
$status += ::max(0,$load - $self->{'runload'});
|
||||
if($self->{'runload'} > 0) {
|
||||
# Stop if the load is above the limit
|
||||
$status += ::max(0,$load - $self->{'runload'});
|
||||
} else {
|
||||
# Stop if the load is below the limit (for sensor)
|
||||
$status += ::max(0,-$load - $self->{'runload'});
|
||||
}
|
||||
}
|
||||
if($self->{'runnoswap'}) {
|
||||
# swap should be between 0-10ish
|
||||
|
@ -494,8 +500,15 @@ sub over_start_limit {
|
|||
if($self->{'startload'}) {
|
||||
# load should be between 0-10ish
|
||||
# 0 load => 0
|
||||
no warnings 'numeric';
|
||||
my $load = $self->load_status();
|
||||
$status += ::max(0,$load - $self->{'startload'});
|
||||
if($self->{'startload'} > 0) {
|
||||
# Stop if the load is above the limit
|
||||
$status += ::max(0,$load - $self->{'startload'});
|
||||
} else {
|
||||
# Stop if the load is below the limit (for sensor)
|
||||
$status += ::max(0,-$load - $self->{'startload'});
|
||||
}
|
||||
}
|
||||
if($self->{'startnoswap'}) {
|
||||
# swap should be between 0-10ish
|
||||
|
|
|
@ -452,6 +452,13 @@ Set the end of file string to eof-str. If the end of file string
|
|||
occurs as a line of input, the rest of the input is ignored. If
|
||||
neither @strong{-E} nor @strong{-e} is used, no end of file string is used.
|
||||
|
||||
@item @strong{--delay} @emph{secs} (alpha testing)
|
||||
@anchor{@strong{--delay} @emph{secs} (alpha testing)}
|
||||
|
||||
Delay starting next job @emph{secs} seconds. GNU @strong{parallel} will pause
|
||||
@emph{secs} seconds after starting each job. @emph{secs} can be less than 1
|
||||
seconds.
|
||||
|
||||
@item @strong{--dry-run}
|
||||
@anchor{@strong{--dry-run}}
|
||||
|
||||
|
|
|
@ -6,6 +6,9 @@ testdb: ../src/parallel tests-to-run/*sql* wanted-results/*sql* prereqdb
|
|||
time sh Start.sh sql
|
||||
date
|
||||
|
||||
local: testlocal
|
||||
true
|
||||
|
||||
testlocal: ../src/parallel tests-to-run/*local* wanted-results/*local* prereqlocal
|
||||
time sh Start.sh local
|
||||
date
|
||||
|
|
|
@ -4,7 +4,10 @@ echo '### Test niceload exit code'
|
|||
niceload "perl -e 'exit(3)'" ; echo $? eq 3
|
||||
niceload "perl -e 'exit(0)'" ; echo $? eq 0
|
||||
|
||||
# force load > 10
|
||||
while uptime | grep -v age:.[1-9][0-9].[0-9][0-9] >/dev/null ; do (timeout 5 nice burnP6 2>/dev/null &) done
|
||||
|
||||
echo '### Test -p'
|
||||
perl -e '$|=1;while($t++<3){sleep(1);print "."}' &
|
||||
# The above should be suspended for at least 4 seconds
|
||||
stdout /usr/bin/time -f %e niceload -D -l -2 -p $! | perl -ne '$_ > 6 and print "OK\n"'
|
||||
stdout /usr/bin/time -f %e niceload -D -l 9 -p $! | perl -ne '$_ > 6 and print "OK\n"'
|
||||
|
|
|
@ -6,7 +6,8 @@ SERVER2=parallel-server2
|
|||
# -L1 will join lines ending in ' '
|
||||
cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | parallel -j10 -k -L1
|
||||
echo "### Test --delay"
|
||||
seq 9 | /usr/bin/time -f %e parallel -j3 --delay 0.3 true {} 2>&1 | perl -pe 's/.[0-9]+$//'
|
||||
seq 9 | /usr/bin/time -f %e parallel -j3 --delay 0.53 true {} 2>&1 |
|
||||
perl -ne '$_ > 5 and print "More than 5 secs: OK\n"'
|
||||
|
||||
echo '### Test -k 5';
|
||||
sleep 5
|
||||
|
|
|
@ -23,7 +23,7 @@ rm /tmp/basic--shebang-wrap
|
|||
|
||||
echo "### Test --shebang-wrap with parser options"
|
||||
cat <<EOF > /tmp/with-parser--shebang-wrap
|
||||
#!/usr/local/bin/parallel --shebang-wrap /usr/bin/perl -p
|
||||
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/perl -p
|
||||
|
||||
print "Shebang from perl with args @ARGV\n";
|
||||
EOF
|
||||
|
@ -31,11 +31,11 @@ EOF
|
|||
chmod 755 /tmp/with-parser--shebang-wrap
|
||||
/tmp/with-parser--shebang-wrap /tmp/in12 /tmp/in45
|
||||
echo "### Same as"
|
||||
parallel /usr/bin/perl -p /tmp/with-parser--shebang-wrap ::: /tmp/in12 /tmp/in45
|
||||
parallel -k /usr/bin/perl -p /tmp/with-parser--shebang-wrap ::: /tmp/in12 /tmp/in45
|
||||
echo "### stdin"
|
||||
(echo /tmp/in12; echo /tmp/in45) | /tmp/with-parser--shebang-wrap
|
||||
echo "### Same as"
|
||||
(echo /tmp/in12; echo /tmp/in45) | parallel /usr/bin/perl /tmp/with-parser--shebang-wrap
|
||||
(echo /tmp/in12; echo /tmp/in45) | parallel -k /usr/bin/perl /tmp/with-parser--shebang-wrap
|
||||
rm /tmp/with-parser--shebang-wrap
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
### Test --delay
|
||||
3
|
||||
More than 5 secs: OK
|
||||
### Test -k 5
|
||||
### Test -k 3
|
||||
### Test -k 4
|
||||
|
|
Loading…
Reference in a new issue