mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 14:07:55 +00:00
parallel: Implemented --termseq.
This commit is contained in:
parent
2029853dd9
commit
210e9db387
19
src/parallel
19
src/parallel
|
@ -795,6 +795,7 @@ sub options_hash {
|
|||
"memfree=s" => \$opt::memfree,
|
||||
"retries=i" => \$opt::retries,
|
||||
"timeout=s" => \$opt::timeout,
|
||||
"termseq|term-seq=s" => \$opt::termseq,
|
||||
# xargs-compatibility - implemented, man, testsuite
|
||||
"max-procs|P=s" => \$opt::jobs,
|
||||
"delimiter|d=s" => \$opt::d,
|
||||
|
@ -1649,7 +1650,7 @@ sub shell_quote {
|
|||
: (join" ",map { shell_quote_scalar($_) } @_);
|
||||
}
|
||||
|
||||
sub shell_quote_scalar_rc {
|
||||
sub shell_quote_scalar_rc {
|
||||
# Quote for the rc-shell
|
||||
my $a = $_[0];
|
||||
if(defined $a) {
|
||||
|
@ -1665,9 +1666,9 @@ sub shell_quote {
|
|||
}
|
||||
}
|
||||
return $a;
|
||||
}
|
||||
}
|
||||
|
||||
sub shell_quote_scalar_csh {
|
||||
sub shell_quote_scalar_csh {
|
||||
# Quote for (t)csh
|
||||
my $a = $_[0];
|
||||
if(defined $a) {
|
||||
|
@ -1686,9 +1687,9 @@ sub shell_quote {
|
|||
}
|
||||
}
|
||||
return $a;
|
||||
}
|
||||
}
|
||||
|
||||
sub shell_quote_scalar_default {
|
||||
sub shell_quote_scalar_default {
|
||||
# Quote for other shells
|
||||
my $a = $_[0];
|
||||
if(defined $a) {
|
||||
|
@ -1709,7 +1710,7 @@ sub shell_quote {
|
|||
}
|
||||
}
|
||||
return $a;
|
||||
}
|
||||
}
|
||||
|
||||
sub shell_quote_scalar {
|
||||
# Quote the string so the shell will not expand any special chars
|
||||
|
@ -3217,13 +3218,15 @@ sub kill_sleep_seq {
|
|||
# @pids = list of pids that are also processgroups
|
||||
# Convert pids to process groups ($processgroup = -$pid)
|
||||
my @pgrps = map { -$_ } @_;
|
||||
my @term_seq = ("TERM",200,"TERM",100,"TERM",50,"KILL",25);
|
||||
my @term_seq = split/,/,$opt::termseq;
|
||||
if(not @term_seq) {
|
||||
@term_seq = ("TERM",200,"TERM",100,"TERM",50,"KILL",25);
|
||||
}
|
||||
while(@term_seq) {
|
||||
@pgrps = kill_sleep(shift @term_seq, shift @term_seq, @pgrps);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub kill_sleep {
|
||||
my ($signal, $sleep_max, @pids) = @_;
|
||||
::debug("kill","kill_sleep $signal ",(join " ",sort @pids),"\n");
|
||||
|
|
|
@ -1916,6 +1916,20 @@ I<str> and TAB (\t). I<str> can contain replacement strings such as
|
|||
B<--tagstring> is ignored when using B<-u>, B<--onall>, and B<--nonall>.
|
||||
|
||||
|
||||
=item B<--termseq> I<sequence> (alpha testing)
|
||||
|
||||
Termination sequence. When a job is killed due to B<--timeout>,
|
||||
B<--memfree>, or abnormal termination of GNU B<parallel>, I<sequence>
|
||||
determines how the job is killed. The default is:
|
||||
|
||||
TERM,200,TERM,100,TERM,50,KILL,25
|
||||
|
||||
which sends a TERM signal, waits 200 ms, sends another TERM signal,
|
||||
waits 100 ms, sends another TERM signal, waits 50 ms, sends a KILL
|
||||
signal, waits 25 ms, and exits. GNU B<parallel> discovers if a process
|
||||
dies before the waiting time is up.
|
||||
|
||||
|
||||
=item B<--tmpdir> I<dirname>
|
||||
|
||||
Directory for temporary files. GNU B<parallel> normally buffers output
|
||||
|
|
Loading…
Reference in a new issue