De-camelcased sub names

This commit is contained in:
Ole Tange 2010-06-27 03:09:28 +02:00
parent c8c60db5bf
commit 39d1c6bfa6
2 changed files with 28 additions and 30 deletions

View file

@ -1,5 +1,3 @@
TODO CaMelCase removal
# Hvordan udregnes system limits på remote systems hvis jeg ikke ved, hvormange # Hvordan udregnes system limits på remote systems hvis jeg ikke ved, hvormange
# argumenter, der er? Lav system limits lokalt og lad det være max # argumenter, der er? Lav system limits lokalt og lad det være max

View file

@ -1603,11 +1603,11 @@ use File::Temp qw/ tempfile tempdir /;
use Getopt::Long; use Getopt::Long;
use strict; use strict;
DoNotReap(); do_not_reap();
parse_options(); parse_options();
init_run_jobs(); init_run_jobs();
start_more_jobs(); start_more_jobs();
ReapIfNeeded(); reap_if_needed();
drain_job_queue(); drain_job_queue();
cleanup(); cleanup();
if($::opt_halt_on_error) { if($::opt_halt_on_error) {
@ -2120,7 +2120,7 @@ sub processes_available_by_system_limit {
my $time = time; my $time = time;
my %fh; my %fh;
my @children; my @children;
DoNotReap(); do_not_reap();
# Reserve filehandles # Reserve filehandles
# perl uses 7 filehandles for something? # perl uses 7 filehandles for something?
@ -2520,10 +2520,10 @@ sub init_run_jobs {
$Global::total_running = 0; $Global::total_running = 0;
$Global::total_started = 0; $Global::total_started = 0;
$Global::total_completed = 0; $Global::total_completed = 0;
$SIG{USR1} = \&ListRunningJobs; $SIG{USR1} = \&list_running_jobs;
$SIG{USR2} = \&toggle_progress; $SIG{USR2} = \&toggle_progress;
$Global::original_sigterm = $SIG{TERM}; $Global::original_sigterm = $SIG{TERM};
$SIG{TERM} = \&StartNoNewJobs; $SIG{TERM} = \&start_no_new_jobs;
if(@::opt_basefile) { if(@::opt_basefile) {
setup_basefile(); setup_basefile();
} }
@ -2637,24 +2637,24 @@ sub unget_arg {
sub drain_job_queue { sub drain_job_queue {
# Returns: N/A # Returns: N/A
if($::opt_progress) { if($::opt_progress) {
DoNotReap(); do_not_reap();
print init_progress(); print init_progress();
ReapIfNeeded(); reap_if_needed();
} }
my $last_header=""; my $last_header="";
while($Global::total_running > 0) { while($Global::total_running > 0) {
debug("jobs running: $Global::total_running Memory usage:".my_memory_usage()."\n"); debug("jobs running: $Global::total_running Memory usage:".my_memory_usage()."\n");
sleep 1; sleep 1;
Reaper(); # Some systems fail to catch the SIGCHLD reaper(); # Some systems fail to catch the SIGCHLD
if($::opt_progress) { if($::opt_progress) {
my %progress = progress(); my %progress = progress();
DoNotReap(); do_not_reap();
if($last_header ne $progress{'header'}) { if($last_header ne $progress{'header'}) {
print "\n",$progress{'header'},"\n"; print "\n",$progress{'header'},"\n";
$last_header = $progress{'header'}; $last_header = $progress{'header'};
} }
print "\r",$progress{'status'}; print "\r",$progress{'status'};
ReapIfNeeded(); reap_if_needed();
} }
} }
if($::opt_progress) { if($::opt_progress) {
@ -2839,7 +2839,7 @@ sub start_more_jobs {
# Returns: # Returns:
# number of jobs started # number of jobs started
my $jobs_started = 0; my $jobs_started = 0;
if(not $Global::StartNoNewJobs) { if(not $Global::start_no_new_jobs) {
for my $sshlogin (keys %Global::host) { for my $sshlogin (keys %Global::host) {
debug("Running jobs on $sshlogin: $Global::host{$sshlogin}{'no_of_running'}\n"); debug("Running jobs on $sshlogin: $Global::host{$sshlogin}{'no_of_running'}\n");
while ($Global::host{$sshlogin}{'no_of_running'} < while ($Global::host{$sshlogin}{'no_of_running'} <
@ -3229,53 +3229,53 @@ sub cleanup_basefile {
# Signal handling # Signal handling
# #
sub ListRunningJobs { sub list_running_jobs {
# Returns: N/A # Returns: N/A
for my $v (values %Global::running) { for my $v (values %Global::running) {
print STDERR "$Global::progname: ",$v->{'command'},"\n"; print STDERR "$Global::progname: ",$v->{'command'},"\n";
} }
} }
sub StartNoNewJobs { sub start_no_new_jobs {
# Returns: N/A # Returns: N/A
print STDERR print STDERR
("$Global::progname: SIGTERM received. No new jobs will be started.\n", ("$Global::progname: SIGTERM received. No new jobs will be started.\n",
"$Global::progname: Waiting for these ", scalar(keys %Global::running), "$Global::progname: Waiting for these ", scalar(keys %Global::running),
" jobs to finish. Send SIGTERM again to stop now.\n"); " jobs to finish. Send SIGTERM again to stop now.\n");
ListRunningJobs(); list_running_jobs();
$Global::StartNoNewJobs++; $Global::start_no_new_jobs++;
$SIG{TERM} = $Global::original_sigterm; $SIG{TERM} = $Global::original_sigterm;
} }
sub CountSigChild { sub count_sig_child {
# Returns: N/A # Returns: N/A
$Global::SigChildCaught++; $Global::sig_child_caught++;
} }
sub DoNotReap { sub do_not_reap {
# This will postpone SIGCHILD for sections that cannot be distracted by a dying child # This will postpone SIGCHILD for sections that cannot be distracted by a dying child
# (Racecondition) # (Racecondition)
# Returns: N/A # Returns: N/A
$SIG{CHLD} = \&CountSigChild; $SIG{CHLD} = \&count_sig_child;
} }
sub ReapIfNeeded { sub reap_if_needed {
# Do the postponed SIGCHILDs if any and re-install normal reaper for SIGCHILD # Do the postponed SIGCHILDs if any and re-install normal reaper for SIGCHILD
# (Racecondition) # (Racecondition)
# Returns: N/A # Returns: N/A
if($Global::SigChildCaught) { if($Global::sig_child_caught) {
$Global::SigChildCaught = 0; $Global::sig_child_caught = 0;
Reaper(); reaper();
} }
$SIG{CHLD} = \&Reaper; $SIG{CHLD} = \&reaper;
} }
sub Reaper { sub reaper {
# A job finished. # A job finished.
# Print the output. # Print the output.
# Start another job # Start another job
# Returns: N/A # Returns: N/A
DoNotReap(); do_not_reap();
$Global::reaperlevel++; $Global::reaperlevel++;
my $stiff; my $stiff;
debug("Reaper called $Global::reaperlevel\n"); debug("Reaper called $Global::reaperlevel\n");
@ -3313,7 +3313,7 @@ sub Reaper {
"Waiting for ", scalar(keys %Global::running), "Waiting for ", scalar(keys %Global::running),
" jobs to finish. This job failed:\n", " jobs to finish. This job failed:\n",
$Global::running{$stiff}{"command"},"\n"); $Global::running{$stiff}{"command"},"\n");
$Global::StartNoNewJobs++; $Global::start_no_new_jobs++;
$Global::halt_on_error_exitstatus = $Global::running{$stiff}{'exitstatus'}; $Global::halt_on_error_exitstatus = $Global::running{$stiff}{'exitstatus'};
} elsif($::opt_halt_on_error == 2) { } elsif($::opt_halt_on_error == 2) {
# If halt on error == 2 we should exit immediately # If halt on error == 2 we should exit immediately
@ -3331,7 +3331,7 @@ sub Reaper {
delete $Global::running{$stiff}; delete $Global::running{$stiff};
start_more_jobs(); start_more_jobs();
} }
ReapIfNeeded(); reap_if_needed();
debug("Reaper exit $Global::reaperlevel\n"); debug("Reaper exit $Global::reaperlevel\n");
$Global::reaperlevel--; $Global::reaperlevel--;
} }