mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-26 16:07:54 +00:00
Merge branch 'master' of git://git.savannah.gnu.org/parallel
This commit is contained in:
commit
14b1e98351
26
src/parallel
26
src/parallel
|
@ -2388,7 +2388,8 @@ sub set_time_to_login {
|
||||||
sub max_jobs_running {
|
sub max_jobs_running {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
if(not defined $self->{'max_jobs_running'}) {
|
if(not defined $self->{'max_jobs_running'}) {
|
||||||
$self->set_max_jobs_running($self->compute_number_of_processes($::opt_P));
|
my $nproc = $self->compute_number_of_processes($::opt_P);
|
||||||
|
$self->set_max_jobs_running($nproc);
|
||||||
}
|
}
|
||||||
return $self->{'max_jobs_running'};
|
return $self->{'max_jobs_running'};
|
||||||
}
|
}
|
||||||
|
@ -2406,7 +2407,11 @@ sub compute_number_of_processes {
|
||||||
::debug("Wanted procs: $wanted_processes\n");
|
::debug("Wanted procs: $wanted_processes\n");
|
||||||
my $system_limit =
|
my $system_limit =
|
||||||
$self->processes_available_by_system_limit($wanted_processes);
|
$self->processes_available_by_system_limit($wanted_processes);
|
||||||
$system_limit < 1 and ::die_bug('$system_limit < 1');
|
if($system_limit < 1) {
|
||||||
|
print STDERR "$Global::progname: Cannot spawn more jobs. ",
|
||||||
|
"Raising ulimit -u may help.\n";
|
||||||
|
exit(255);
|
||||||
|
}
|
||||||
::debug("Limited to procs: $system_limit\n");
|
::debug("Limited to procs: $system_limit\n");
|
||||||
return $system_limit;
|
return $system_limit;
|
||||||
}
|
}
|
||||||
|
@ -2439,6 +2444,23 @@ sub processes_available_by_system_limit {
|
||||||
for my $i (1..8) {
|
for my $i (1..8) {
|
||||||
open($fh{"init-$i"},"</dev/null");
|
open($fh{"init-$i"},"</dev/null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(1..2) {
|
||||||
|
# System process limit
|
||||||
|
my $child;
|
||||||
|
if($child = fork()) {
|
||||||
|
push (@children,$child);
|
||||||
|
$Global::unkilled_children{$child} = 1;
|
||||||
|
} elsif(defined $child) {
|
||||||
|
# The child takes one process slot
|
||||||
|
# It will be killed later
|
||||||
|
$SIG{TERM} = $Global::original_sig{TERM};
|
||||||
|
sleep 10000000;
|
||||||
|
exit(0);
|
||||||
|
} else {
|
||||||
|
$max_system_proc_reached = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
my $count_jobs_already_read = $Global::JobQueue->next_seq();
|
my $count_jobs_already_read = $Global::JobQueue->next_seq();
|
||||||
my $wait_time_for_getting_args = 0;
|
my $wait_time_for_getting_args = 0;
|
||||||
my $start_time = time;
|
my $start_time = time;
|
||||||
|
|
Loading…
Reference in a new issue