[padb-devel] [padb] r171 committed - Use single rather than double quotes where possible.
codesite-noreply at google.com
codesite-noreply at google.com
Thu Sep 3 21:57:12 BST 2009
Revision: 171
Author: apittman
Date: Thu Sep 3 13:56:37 2009
Log: Use single rather than double quotes where possible.
http://code.google.com/p/padb/source/detail?r=171
Modified:
/branches/cleanup/src/padb
=======================================
--- /branches/cleanup/src/padb Thu Sep 3 12:34:57 2009
+++ /branches/cleanup/src/padb Thu Sep 3 13:56:37 2009
@@ -250,7 +250,7 @@
# Main.
my $prog = basename $0;
-my $version = "3.0-rc1";
+my $version = '3.0-rc1';
my %conf;
@@ -313,11 +313,11 @@
'find_pids' => \&open_find_pids,
};
-$rmgr{"lsf-rms"} = {
+$rmgr{'lsf-rms'} = {
'is_installed' => \&lsf_is_installed,
'get_active_jobs' => \&lsf_get_jobs,
'setup_pcmd' => \&lsf_setup_pcmd,
- 'inner_rmgr' => "rms",
+ 'inner_rmgr' => 'rms',
};
$rmgr{slurm} = {
@@ -337,20 +337,20 @@
'require_inner_callback' => 1,
};
-$rmgr{"local-qsnet"} = {
+$rmgr{'local-qsnet'} = {
'is_installed' => \&local_q_is_installed,
'get_active_jobs' => \&local_q_get_jobs,
'job_is_running' => \&local_job_is_running,
'setup_pcmd' => \&local_setup_pcmd,
- 'inner_rmgr' => "local",
+ 'inner_rmgr' => 'local',
'require_inner_callback' => 1,
};
-$rmgr{"local-fd"} = {
+$rmgr{'local-fd'} = {
'get_active_jobs' => \&local_fd_get_jobs,
'job_is_running' => \&local_job_is_running,
'setup_pcmd' => \&local_setup_pcmd,
- 'inner_rmgr' => "local",
+ 'inner_rmgr' => 'local',
'require_inner_callback' => 1,
};
@@ -378,14 +378,14 @@
# Valid values are "none" "missing" or "all". Anything not recognised
# is treated as "all".
-$conf{check_signon} = "all";
+$conf{check_signon} = 'all';
# Output options.
$conf{interval} = 10;
$conf{watch_clears_screen} = 1;
-$conf{scripts} = "bash,sh,dash,ash,perl,xterm";
+$conf{scripts} = 'bash,sh,dash,ash,perl,xterm';
$conf{lsf_job_offset} = 1;
-$conf{local_fd_name} = "/dev/null";
+$conf{local_fd_name} = '/dev/null';
$conf{inner_callback} = 0;
# These two are used by deadlock and QsNet group
@@ -413,15 +413,15 @@
$conf{tree_width} = 4;
my $norc = 0;
-my $configfile = "/etc/padb.conf";
+my $configfile = '/etc/padb.conf';
# Look for edb in the default install location only.
sub find_edb {
- return "/usr/lib/qsnet/elan4/bin/"
- if ( -d "/usr/lib/qsnet/elan4/bin/" );
- return "/usr/lib64/qsnet/elan4/bin/"
- if ( -d "/usr/lib64/qsnet/elan4/bin/" );
- return "edb";
+ return '/usr/lib/qsnet/elan4/bin/'
+ if ( -d '/usr/lib/qsnet/elan4/bin/' );
+ return '/usr/lib64/qsnet/elan4/bin/'
+ if ( -d '/usr/lib64/qsnet/elan4/bin/' );
+ return 'edb';
}
# Look for minfo.x in the same directory as padb.
@@ -603,7 +603,7 @@
return unless $debugModes{$type};
my $time = time() - $start_time;
printf( "DEBUG ($type): %3d: $str\n", $time, @params );
- return if $debugModes{$type} eq "basic";
+ return if $debugModes{$type} eq 'basic';
return unless defined $handle;
print Dumper($handle);
return;
@@ -623,36 +623,36 @@
sub parse_args_outer {
- Getopt::Long::Configure("bundling");
+ Getopt::Long::Configure('bundling');
my $debugflag;
my @ranks;
my %optionhash = (
- "verbose|v+" => \$conf{verbose},
- "user|u=s" => \$user,
- "rank|r=s" => \@ranks,
- "group-id=s" => \@target_groups,
- "help|h" => \&usage,
- "all|a" => \$all,
- "any|A" => \$any,
- "version|V" => \&show_version,
- "compress|c" => \$compress,
- "compress-long|C" => \$compress_C,
- "tree|t" => \$tree,
- "input-file|file|i=s" => \$input_file,
- "config-option|O=s" => \@config_options,
- "full-report=s" => \$full_report,
- "core-stack" => \$core_stack,
- "core=s" => \$core_name,
- "exe=s" => \$exe_name,
- "list-rmgrs" => \$list_rmgrs,
- "watch" => \$watch,
- "local-stats" => \$local_stats,
- "show-jobs" => \$show_jobs,
- "norc" => \$norc,
- "config-file=s" => \$configfile,
- "debug=s" => \$debugflag,
+ 'verbose|v+' => \$conf{verbose},
+ 'user|u=s' => \$user,
+ 'rank|r=s' => \@ranks,
+ 'group-id=s' => \@target_groups,
+ 'help|h' => \&usage,
+ 'all|a' => \$all,
+ 'any|A' => \$any,
+ 'version|V' => \&show_version,
+ 'compress|c' => \$compress,
+ 'compress-long|C' => \$compress_C,
+ 'tree|t' => \$tree,
+ 'input-file|file|i=s' => \$input_file,
+ 'config-option|O=s' => \@config_options,
+ 'full-report=s' => \$full_report,
+ 'core-stack' => \$core_stack,
+ 'core=s' => \$core_name,
+ 'exe=s' => \$exe_name,
+ 'list-rmgrs' => \$list_rmgrs,
+ 'watch' => \$watch,
+ 'local-stats' => \$local_stats,
+ 'show-jobs' => \$show_jobs,
+ 'norc' => \$norc,
+ 'config-file=s' => \$configfile,
+ 'debug=s' => \$debugflag,
);
my %config_hash;
@@ -678,7 +678,7 @@
foreach my $f ( split( ",", $debugflag ) ) {
my ( $name, $v ) = split( "=", $f );
if ( exists $debugModes{$name} ) {
- $debugModes{$name} = defined($v) ? $v : "basic";
+ $debugModes{$name} = defined($v) ? $v : 'basic';
} else {
printf("Attempt to set unknown debug flag \"$name\".\n");
}
@@ -733,7 +733,7 @@
my $str = shift;
if ( not defined $str ) {
return 0;
- } elsif ( $str eq "0xffffffffffffffff" ) {
+ } elsif ( $str eq '0xffffffffffffffff' ) {
return -1;
} else {
@@ -810,19 +810,19 @@
}
my @scales = (
- "Bytes", "Kilobytes", "Megabytes", "Gigabytes",
- "Terabytes", "Petabytes", "Exabytes"
+ 'Bytes', 'Kilobytes', 'Megabytes', 'Gigabytes',
+ 'Terabytes', 'Petabytes', 'Exabytes'
);
my @bin_names = (
- "0 bytes", "1 byte", "2 bytes", "4 bytes",
- "8 bytes", "16 bytes", "32 bytes", "64 bytes",
- "128 bytes", "256 bytes", "512 bytes", "1kb",
- "2kb", "4kb", "8kb", "16kb",
- "32kb", "64kb", "128kb", "256kb",
- "512kb", "1mb", "2mb", "4mb",
- "8mb", "16mb", "32mb", "64mb",
- "128mb", "256mb", "512mb", "overflow"
+ '0 bytes', '1 byte', '2 bytes', '4 bytes',
+ '8 bytes', '16 bytes', '32 bytes', '64 bytes',
+ '128 bytes', '256 bytes', '512 bytes', '1kb',
+ '2kb', '4kb', '8kb', '16kb',
+ '32kb', '64kb', '128kb', '256kb',
+ '512kb', '1mb', '2mb', '4mb',
+ '8mb', '16mb', '32mb', '64mb',
+ '128mb', '256mb', '512mb', 'overflow'
);
sub show_counter {
@@ -918,7 +918,7 @@
if ( $d->{$bin}{raw}[$j] or $conf{show_all_stats} > 1 ) {
push(
@vals,
- sprintf( "%9s: %10d",
+ sprintf( '%9s: %10d',
$bin_names[$j], $d->{$bin}{raw}[$j] )
);
@@ -939,16 +939,16 @@
# These must stay in the correct order, that is the order
# they appear in shared memory.
-my @stat_types = ( "Counter", "Tally", "Bin", "Attribute" );
+my @stat_types = qw(Counter Tally Bin Attribute);
my @display_order = qw(Attribute Counter Tally Bin);
my %stat_types2 = (
Counter =>
- { size => "1", displayfn => \&show_counter, sumfn => \&sum_counter },
- Tally => { size => "3", displayfn => \&show_tally, sumfn =>
\&sum_tally },
- Bin => { size => "35", displayfn => \&show_bin, sumfn => \&sum_bin
},
- Attribute => { size => "1", displayfn => \&show_attr, sumfn =>
\&sum_attr },
+ { size => '1', displayfn => \&show_counter, sumfn => \&sum_counter },
+ Tally => { size => '3', displayfn => \&show_tally, sumfn =>
\&sum_tally },
+ Bin => { size => '35', displayfn => \&show_bin, sumfn => \&sum_bin
},
+ Attribute => { size => '1', displayfn => \&show_attr, sumfn =>
\&sum_attr },
);
sub parse_header {
@@ -957,7 +957,7 @@
my @header;
- if ( $a[0] ne "ELAN STATS" or $a[1] ne "falcon" ) {
+ if ( $a[0] ne 'ELAN STATS' or $a[1] ne 'falcon' ) {
return;
}
@@ -1056,7 +1056,7 @@
my $rail = _hex $r;
if ( $rail == -1 ) {
- return "ELAN_RAIL_ALL";
+ return 'ELAN_RAIL_ALL';
} else {
return $rail;
}
@@ -1347,9 +1347,9 @@
.
local $~;
if ( defined $hash->{vp} ) {
- $~ = "WITH_VP";
+ $~ = 'WITH_VP';
} else {
- $~ = "WITHOUT_VP";
+ $~ = 'WITHOUT_VP';
}
write STDOUT;
return;
@@ -1361,7 +1361,7 @@
my $rev = $reverse;
- $rev = not $rev if ( $sort eq "vp" );
+ $rev = not $rev if ( $sort eq 'vp' );
if ($rev) {
foreach my $e ( sort { $a->{$sort} <=> $b->{$sort} } ( @{$hashes}
) ) {
@@ -1561,14 +1561,14 @@
my $ret;
my $sstr = defined $size ? " (size $size)" : "";
- my $members = "members";
- my $are = "are";
- my $have = "have";
+ my $members = 'members';
+ my $are = 'are';
+ my $have = 'have';
if ( $#identical == 0 ) {
- $members = "member";
- $are = "is";
- $have = "has";
+ $members = 'member';
+ $are = 'is';
+ $have = 'has';
}
if ($possessive) {
@@ -1680,7 +1680,7 @@
if ( $#invalid != -1 ) {
if ( $conf{show_all_groups} ) {
$ret .= $gstr
- . group_status_helper( "showing the group as
removed",
+ . group_status_helper( 'showing the group as
removed',
0, $ad{$gid}{size}, @invalid );
$gstr = "";
}
@@ -1704,12 +1704,12 @@
if ( $conf{show_all_groups} ) {
$ret .= $gstr
. group_status_helper(
- "no statistics for this group *(1)",
+ 'no statistics for this group *(1)',
1, $ad{$gid}{size}, @identical );
$gstr = "";
} else {
$gstr .=
- group_status_helper( "no statistics for this group
*(1)",
+ group_status_helper( 'no statistics for this group
*(1)',
1, $ad{$gid}{size}, @identical );
}
}
@@ -1762,7 +1762,7 @@
}
if ( $#inactive != -1 ) {
$ret .= $gstr
- . group_status_helper( "not in a call to the
collectives",
+ . group_status_helper( 'not in a call to the
collectives',
0, $ad{$gid}{size}, @inactive );
$gstr = "";
}
@@ -1772,11 +1772,11 @@
my $count = keys(%ad);
if ( $count == 1 ) {
- my $use_str = ( $i_count == 1 ) ? "" : " not";
+ my $use_str = ( $i_count == 1 ) ? "" : ' not';
$ret .= "Total: $count group which is$use_str in use.\n";
} else {
- my $d_str = ( $d_count == 1 ) ? "is" : "are";
- my $i_str = ( $i_count == 1 ) ? "is" : "are";
+ my $d_str = ( $d_count == 1 ) ? 'is' : 'are';
+ my $i_str = ( $i_count == 1 ) ? 'is' : 'are';
$ret .=
"Total: $count groups of which $d_count $d_str destroyed and $i_count
$i_str in use.\n";
}
@@ -1827,13 +1827,13 @@
# Show stats for all jobs on this node.
sub local_stats {
- opendir( DH, "/proc/rms/programs" );
+ opendir( DH, '/proc/rms/programs' );
my @files = readdir(DH);
closedir(DH);
foreach my $job (@files) {
- next if ( $job eq ".." );
- next if ( $job eq "." );
+ next if ( $job eq '..' );
+ next if ( $job eq '.' );
local_stats_from_job($job);
@@ -1879,7 +1879,7 @@
my $prev;
my $tag = $tags[0];
- debug_log( "tree", \@tags, "called tag:%s, level:%d", $tag, $level );
+ debug_log( 'tree', \@tags, 'called tag:%s, level:%d', $tag, $level );
return if ( !defined($tag) );
return if ( !defined( $lines->{$tag} ) );
@@ -1939,7 +1939,7 @@
}
debug_log(
- "tree", undef,
+ 'tree', undef,
"level $level, endlevel $endlevel, identical:@identical
different:@different"
);
@@ -1971,7 +1971,7 @@
}
debug_log(
- "tree", undef,
+ 'tree', undef,
"returning level:$level endlevel:$endlevel identical:@identical
different:@different"
);
@@ -2016,7 +2016,7 @@
sub show_tree {
my $ref = shift;
- debug_log( "tree", $ref, "Complete tree" );
+ debug_log( 'tree', $ref, 'Complete tree' );
return _show_tree( $ref, undef, "" );
}
@@ -2098,7 +2098,7 @@
}
sub rms_is_installed {
- return ( find_exe("prun") and find_exe("rmsquery") );
+ return ( find_exe('prun') and find_exe('rmsquery') );
}
sub rms_get_jobs {
@@ -2113,7 +2113,7 @@
my $job = shift;
my $status = `rmsquery "select status from jobs where name=\'$job\'"`;
chomp $status;
- return ( $status eq "running" );
+ return ( $status eq 'running' );
}
sub rms_job_to_key {
@@ -2256,7 +2256,7 @@
###############################################################################
sub slurm_is_installed {
- return ( find_exe("srun") and find_exe("squeue") and
find_exe("scontrol") );
+ return ( find_exe('srun') and find_exe('squeue') and
find_exe('scontrol') );
}
sub slurm_get_jobs {
@@ -2283,7 +2283,7 @@
foreach my $step (@steps) {
my ( $step, $cpus ) = split( " ", $step );
$tasks = $cpus if ( $step eq $s );
- $have_tasks = 1 if ( $cpus eq "TASKS" );
+ $have_tasks = 1 if ( $cpus eq 'TASKS' );
}
return $tasks if $have_tasks;
return;
@@ -2324,7 +2324,7 @@
my $job = shift;
my $status = lc `squeue -h -j $job -o "%T"`;
chomp $status;
- return ( $status eq "running" );
+ return ( $status eq 'running' );
}
sub slurm_setup_pcmd {
@@ -2342,7 +2342,7 @@
sub local_get_jobs {
my $user = shift;
- opendir( DIR, "/proc/" );
+ opendir( DIR, '/proc/' );
my @pids = readdir(DIR);
closedir(DIR);
my @jobs;
@@ -2368,7 +2368,7 @@
sub local_fd_get_jobs_real {
my $user = shift;
my $file = shift;
- opendir( DIR, "/proc/" );
+ opendir( DIR, '/proc/' );
my @pids = readdir(DIR);
closedir(DIR);
my @jobs;
@@ -2407,12 +2407,12 @@
}
sub local_q_is_installed {
- return ( -d "/proc/qsnet" );
+ return ( -d '/proc/qsnet' );
}
sub local_q_get_jobs {
my $user = shift;
- return local_fd_get_jobs_real( $user, "/proc/qsnet/elan/user" );
+ return local_fd_get_jobs_real( $user, '/proc/qsnet/elan/user' );
}
sub local_job_is_running {
@@ -2431,7 +2431,7 @@
###############################################################################
sub mpd_is_installed {
- return ( find_exe("mpdlistjobs") and find_exe("mpdrun") );
+ return ( find_exe('mpdlistjobs') and find_exe('mpdrun') );
}
sub mpd_get_data {
@@ -2447,22 +2447,22 @@
next unless $value;
$key =~ s/ //g;
chomp $value;
- if ( $key eq "jobid" ) {
+ if ( $key eq 'jobid' ) {
my ( $j, $host ) = split( "@", $value );
$job = $j;
}
- if ( $key eq "username" ) {
+ if ( $key eq 'username' ) {
$jobs{$job}{user} = $value;
}
- if ( $key eq "host" ) {
+ if ( $key eq 'host' ) {
$host = $value;
$jobs{$job}{host}{$value}++;
}
- if ( $key eq "pid" ) {
+ if ( $key eq 'pid' ) {
$pid = $value;
$jobs{$job}{pids}{$host}{$value}++;
}
- if ( $key eq "rank" ) {
+ if ( $key eq 'rank' ) {
$jobs{$job}{pids}{$host}{$pid} = $value;
if ( ( not defined $jobs{$job}{lastproc} )
or ( $value > $jobs{$job}{lastproc} ) )
@@ -2494,7 +2494,7 @@
my @hosts = keys %{ $d->{$job}{host} };
my $i = @hosts;
- my ( $fh, $fn ) = tempfile("/tmp/padb.XXXXXXXX");
+ my ( $fh, $fn ) = tempfile('/tmp/padb.XXXXXXXX');
foreach my $host (@hosts) {
print $fh "$host:1\n";
}
@@ -2533,7 +2533,7 @@
}
sub open_is_installed {
- return ( find_exe("ompi-ps") and find_exe("orterun") );
+ return ( find_exe('ompi-ps') and find_exe('orterun') );
}
my %open_jobs;
@@ -2576,7 +2576,7 @@
my $host = $elems[4];
$host =~ s/ //g;
$host =~ s/\t//g;
- next if $host eq "Node";
+ next if $host eq 'Node';
$open_jobs{$job}{hosts}{$host}++;
my $name = $elems[1];
@@ -2611,7 +2611,7 @@
my @hosts = keys %{ $open_jobs{$job}{hosts} };
my $i = @hosts;
- my ( $fh, $fn ) = tempfile("/tmp/padb.XXXXXXXX");
+ my ( $fh, $fn ) = tempfile('/tmp/padb.XXXXXXXX');
foreach my $host (@hosts) {
print $fh "$host\n";
@@ -2642,7 +2642,7 @@
# Check for both LSF and RMS, I know LSF works in other ways but I
don't
# know how to launch jobs then...
- return ( find_exe("bjobs") and rms_is_installed() );
+ return ( find_exe('bjobs') and rms_is_installed() );
}
sub lsf_get_jobs {
@@ -2656,7 +2656,7 @@
foreach my $l (@out) {
my ( $job, $user, $stat, $queue, $from, $exec, $name, $time ) =
split( " ", $l );
- next if ( $job eq "JOBID" );
+ next if ( $job eq 'JOBID' );
next unless ( defined $time );
push @jobs, $job;
}
@@ -2751,8 +2751,8 @@
printf(
"Error, multiple resource managers detected, use -Ormgr=<resource
manager>\n"
);
- push @ok, "local-fd";
- push @ok, "local";
+ push @ok, 'local-fd';
+ push @ok, 'local';
printf("@ok\n");
exit(1);
}
@@ -2808,8 +2808,8 @@
printf(
"Error, multiple resource managers detected, use -Ormgr=<resource
manager>\n"
);
- push @installed, "local-fd";
- push @installed, "local";
+ push @installed, 'local-fd';
+ push @installed, 'local';
printf("@installed\n");
exit(1);
}
@@ -2833,15 +2833,15 @@
printf(
"Error, multiple active resource managers detected, use -Ormgr=<resource
manager>\n"
);
- push @installed, "local-fd";
- push @installed, "local";
+ push @installed, 'local-fd';
+ push @installed, 'local';
printf("@installed\n");
exit(1);
}
sub get_all_jobids {
my $user = shift;
- debug_log( "rmgr", undef, "Loading active jobs list" );
+ debug_log( 'rmgr', undef, 'Loading active jobs list' );
return $rmgr{ $conf{rmgr} }{get_active_jobs}($user);
}
@@ -2927,7 +2927,7 @@
my $start =
( $cargs->{strip_below_main} and $main_idx ) ? $main_idx : 0;
- printf( "Stripping 0.."
+ printf( 'Stripping 0..'
. $#{ $lines->{$tag} }
. " to $start..$end for $tag\n" )
if $conf{verbose} > 1;
@@ -2962,14 +2962,14 @@
.: consuming CPU cycles ,: using CPU but no queue data -: sleeping *: error
EOF
print($header);
- my $l = "0";
+ my $l = '0';
for ( my $i = 1 ; $i < $nprocs ; $i++ ) {
if ( $i % 10 == 0 ) {
$l .= substr( $i, 0, 1 );
} elsif ( $i % 5 == 0 ) {
- $l .= "5";
+ $l .= '5';
} else {
- $l .= ".";
+ $l .= '.';
}
}
printf("$l\n");
@@ -3042,7 +3042,7 @@
my @columns = split( ",", $carg->{proc_format} );
foreach my $column (@columns) {
- $show_fields = 1 if ( $column eq "fields" );
+ $show_fields = 1 if ( $column eq 'fields' );
my ( $name, $desc ) = split( "=", $column );
if ( defined $desc ) {
@@ -3217,21 +3217,21 @@
my $lines = $d->{target_output};
my $mode = $req->{mode};
- my $output = "raw";
+ my $output = 'raw';
$output = $req->{out_format} if defined $req->{out_format};
- if ( $mode eq "stack" or $input_file ) {
+ if ( $mode eq 'stack' or $input_file ) {
if ( $cargs->{strip_below_main} or $cargs->{strip_above_wait} ) {
strip_stack_traces( $cargs, $lines );
}
}
- if ( $output eq "tree" ) {
+ if ( $output eq 'tree' ) {
print show_tree go_p( 0, $lines,
( sort { $a <=> $b } ( keys %$lines ) ) );
- } elsif ( $output eq "compress" ) {
+ } elsif ( $output eq 'compress' ) {
foreach my $tag ( sort { $a <=> $b } ( keys %$lines ) ) {
next if ( !defined( $lines->{$tag} ) );
@@ -3250,7 +3250,7 @@
print("$data\n");
}
}
- } elsif ( $output eq "compress_c" ) {
+ } elsif ( $output eq 'compress_c' ) {
foreach my $tag ( sort { $a <=> $b } ( keys %$lines ) ) {
print("----------------\n");
print("$tag\n");
@@ -3379,7 +3379,7 @@
sub generate_comm_tree_ladder {
my ($a) = @_;
my @b = @{$a};
- my $last = "root";
+ my $last = 'root';
my %comm_tree;
foreach my $c (@b) {
$comm_tree{$c}{parent} = $last;
@@ -3397,7 +3397,7 @@
sub generate_binary_tree {
my ( $a, $width ) = @_;
my @b = @{$a};
- my $last = "root";
+ my $last = 'root';
my %comm_tree;
my @leaves;
@@ -3438,7 +3438,7 @@
sub connect_to_children {
my $comm_data = shift;
- debug_log( "signon", undef, "Received last signon, connecting to
inner" );
+ debug_log( 'signon', undef, 'Received last signon, connecting to
inner' );
@{ $comm_data->{host_ids} } = sortn( keys( %{ $comm_data->{remote} } )
);
$comm_data->{connection_tree} =
@@ -3446,7 +3446,7 @@
my $td = $comm_data->{connection_tree}->{root}{children}[0];
- debug_log( "ctree", $comm_data->{connection_tree}, "connection tree" );
+ debug_log( 'ctree', $comm_data->{connection_tree}, 'connection tree' );
my $cdata;
$cdata->{socket} = connect_to_child(
@@ -3456,7 +3456,7 @@
);
$cdata->{active} = 1;
$cdata->{str} = "";
- $cdata->{fd_desc} = "child socket";
+ $cdata->{fd_desc} = 'child socket';
$cdata->{line_cb} = \&command_from_inner;
$cdata->{eof_cb} = \&eof_from_fd;
$cdata->{event_cb} = \&handle_event_from_socket;
@@ -3469,7 +3469,7 @@
sub issue_command_to_inner {
my ( $cdata, $cmd ) = @_;
my $str = my_encode($cmd);
- debug_log( "full_duplex", $cmd, "Sending command to inner, %d bytes",
+ debug_log( 'full_duplex', $cmd, 'Sending command to inner, %d bytes',
length($str) );
$cdata->{socket}->print("$str\n");
return;
@@ -3479,7 +3479,7 @@
my $comm_data = shift;
my $req;
- $req->{mode} = "signon";
+ $req->{mode} = 'signon';
$req->{connection_tree} = $comm_data->{connection_tree};
$req->{remote} = $comm_data->{remote};
@@ -3487,7 +3487,7 @@
# configuration options.
# XXX: Need to send over scripts and other stuff here as well.
- if ( $conf{rmgr} eq "orte" ) {
+ if ( $conf{rmgr} eq 'orte' ) {
$req->{orte_data} = $open_jobs{ $comm_data->{jobid} }{ranks};
}
@@ -3516,7 +3516,7 @@
if ( $#commands == -1 ) {
my $req;
- $req->{mode} = "exit";
+ $req->{mode} = 'exit';
return $req;
}
@@ -3583,7 +3583,7 @@
sub check_signon {
my ( $comm_data, $data ) = @_;
- return if ( $conf{check_signon} eq "none" );
+ return if ( $conf{check_signon} eq 'none' );
my %here;
while (
defined( my $proc = rng_shift( $data->{target_data}{found}{yes} )
) )
@@ -3603,16 +3603,16 @@
rng_convert_to_user($rng) );
}
- return if ( $conf{check_signon} eq "missing" );
+ return if ( $conf{check_signon} eq 'missing' );
if ( keys( %{ $data->{target_data}{name} } ) != 1 ) {
printf("Warning, remote process name differs across ranks\n");
- report_failed_signon( "name", \%{ $data->{target_data}{name} } );
+ report_failed_signon( 'name', \%{ $data->{target_data}{name} } );
}
if ( keys( %{ $data->{target_data}{state} } ) != 1 ) {
printf("Warning, remote process state differs across ranks\n");
- report_failed_signon( "state", \%{ $data->{target_data}{state} } );
+ report_failed_signon( 'state', \%{ $data->{target_data}{state} } );
}
return;
}
@@ -3649,7 +3649,7 @@
my ( $comm_data, $cdata, $line ) = @_;
# Initial signon from child.
- if ( $line eq "Welcome" ) {
+ if ( $line eq 'Welcome' ) {
my $req = first_command($comm_data);
$comm_data->{current_req} = $req;
issue_command_to_inner( $cdata, $req );
@@ -3659,20 +3659,20 @@
# A reply from inner.
my $d = my_decode($line);
- debug_log( "full_duplex", $d, "Reply from inner, %d bytes",
length($line) );
+ debug_log( 'full_duplex', $d, 'Reply from inner, %d bytes',
length($line) );
# The inner process has signed on.
- if ( $comm_data->{current_req}->{mode} eq "signon" ) {
+ if ( $comm_data->{current_req}->{mode} eq 'signon' ) {
$comm_data->{current_req} = next_command($comm_data);
issue_command_to_inner( $cdata, $comm_data->{current_req} );
- $comm_data->{state} = "live";
+ $comm_data->{state} = 'live';
check_signon( $comm_data, $d );
return;
}
# The inner process is about to exit.
- if ( $comm_data->{current_req}->{mode} eq "exit" ) {
- $comm_data->{state} = "shutdown";
+ if ( $comm_data->{current_req}->{mode} eq 'exit' ) {
+ $comm_data->{state} = 'shutdown';
return;
}
@@ -3687,8 +3687,8 @@
if ( defined $d->{target_data} ) {
debug_log(
- "tdata", $d->{target_data},
- "Target data %s",
+ 'tdata', $d->{target_data},
+ 'Target data %s',
format_target_data( $d->{target_data} )
);
}
@@ -3744,7 +3744,7 @@
# Children connect back with "Hello $outerkey $hostname $port
$innernkey";
my @words = split( " ", $line );
- if ( $#words != 4 or $words[0] ne "Hello" or $words[1] ne $secret ) {
+ if ( $#words != 4 or $words[0] ne 'Hello' or $words[1] ne $secret ) {
printf("Bad signon $line\n");
return 0;
}
@@ -3764,11 +3764,11 @@
sub inner_stdout_cb {
my ( $comm_data, $cdata, $line ) = @_;
my @words = split( " ", $line );
- if ( $#words == 3 and $words[0] eq "connect" ) {
+ if ( $#words == 3 and $words[0] eq 'connect' ) {
handle_signon( $comm_data, $words[1], $words[2], $words[3] );
return;
- } elsif ( $words[0] eq "debug" ) {
+ } elsif ( $words[0] eq 'debug' ) {
my $count = $comm_data->{sel}->count();
print("There are $count sockets\n");
return;
@@ -3786,7 +3786,7 @@
sub eof_from_fd {
my ( $comm_data, $cdata ) = @_;
- if ( $comm_data->{state} ne "shutdown" ) {
+ if ( $comm_data->{state} ne 'shutdown' ) {
printf("Unexpected EOF from $cdata->{fd_desc}
($comm_data->{state})\n");
}
@@ -3981,12 +3981,12 @@
}
return;
} elsif ( $value >= $part->{l} and $value <= $part->{u} ) {
- carp("Failed to add value to range (Value already in range)");
+ carp('Failed to add value to range (Value already in range)');
return;
}
$idx++;
}
- confess("Failed to add value to range");
+ confess('Failed to add value to range');
}
sub rng_merge {
@@ -4067,7 +4067,7 @@
$comm_data->{listen} = $sl;
my $port = $sl->sockport();
my $hostname = hostname();
- config_set_internal( "outer", "$hostname:$port" );
+ config_set_internal( 'outer', "$hostname:$port" );
$sel->add($sl);
my %cdata;
@@ -4077,7 +4077,7 @@
map { $cmd .= " --$_=\"$cinner_cmd{$_}\"" } keys(%cinner_cmd);
- debug_log( "show_cmd", undef, $cmd );
+ debug_log( 'show_cmd', undef, $cmd );
my $pcmd = {
pid => -1,
@@ -4098,7 +4098,7 @@
$comm_data->{signons} = 0;
# State, one of "connecting" "live" and "shutdown";
- $comm_data->{state} = "connecting";
+ $comm_data->{state} = 'connecting';
$sel->add( $pcmd->{out} );
$sel->add( $pcmd->{err} );
@@ -4110,7 +4110,7 @@
$op{str} = "";
$op{line_cb} = \&inner_stdout_cb;
$op{eof_cb} = \&eof_from_fd;
- $op{fd_desc} = "Inner stdout";
+ $op{fd_desc} = 'Inner stdout';
$op{event_cb} = \&handle_event_from_socket;
$comm_data->{sockets}{ $pcmd->{out} } = \%op;
@@ -4118,7 +4118,7 @@
$ep{str} = "";
$ep{line_cb} = \&inner_stderr_cb;
$ep{eof_cb} = \&eof_from_fd;
- $ep{fd_desc} = "Inner stderr";
+ $ep{fd_desc} = 'Inner stderr';
$ep{event_cb} = \&handle_event_from_socket;
$comm_data->{sockets}{ $pcmd->{err} } = \%ep;
@@ -4149,7 +4149,7 @@
waitpid( $pcmd->{pid}, 0 );
my $res = $?;
- if ( $comm_data->{state} ne "shutdown" ) {
+ if ( $comm_data->{state} ne 'shutdown' ) {
printf(
"Unexpected exit from parallel command (state=$comm_data->{state})\n"
);
@@ -4233,7 +4233,7 @@
$conf{verbose} && defined $ncpus && print "Job has $ncpus
process(es)\n";
$conf{verbose} && defined $hosts && print "Job spans $hosts host(s)\n";
- debug_log( "verbose", undef, "There are %d processes over %d hosts",
+ debug_log( 'verbose', undef, 'There are %d processes over %d hosts',
$ncpus, $hosts );
$cmd .= " $0 --inner";
@@ -4245,7 +4245,7 @@
}
my $errors = go_parallel( $jobid, $cmd, $ncpus, $hosts );
- debug_log( "verbose", undef, "Completed command" );
+ debug_log( 'verbose', undef, 'Completed command' );
cleanup_pcmd();
return $errors;
@@ -4326,7 +4326,7 @@
foreach my $key ( keys(%conf) ) {
$key =~ s/\-/\_/g;
- my $name = "PADB_" . uc($key);
+ my $name = 'PADB_' . uc($key);
if ( defined $ENV{$name} ) {
config_set( $key, $ENV{$name} );
}
@@ -4334,7 +4334,7 @@
foreach my $key ( keys( %{ $conf{mode_options_reverse} } ) ) {
$key =~ s/\-/\_/g;
- my $name = "PADB_" . uc($key);
+ my $name = 'PADB_' . uc($key);
if ( defined $ENV{$name} ) {
config_set( $key, $ENV{$name} );
}
@@ -4348,14 +4348,14 @@
my $max_len = 0;
foreach my $key ( keys(%conf) ) {
- next if ( ref( $conf{$key} ) eq "HASH" );
+ next if ( ref( $conf{$key} ) eq 'HASH' );
if ( length $key > $max_len ) {
$max_len = length $key;
}
}
foreach my $key ( sort( keys(%conf) ) ) {
- next if ( ref( $conf{$key} ) eq "HASH" );
+ next if ( ref( $conf{$key} ) eq 'HASH' );
my $name = $key;
$name =~ s/\_/\-/g;
if ( defined $conf{$key} ) {
@@ -4420,7 +4420,7 @@
$key =~ s/\-/\_/g;
- if ( $key eq "scriptDir" ) {
+ if ( $key eq 'scriptDir' ) {
printf(
"$prog: -OscriptDir deprecated, use -Oedb=/path/to/edb instead\n"
);
***The diff for this file has been truncated for email.***
More information about the padb-devel
mailing list