| 1 | package Parallel::Mpich::MPD::Common; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 12 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 12 | ▶ | use File::Temp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 12 | ▶ | use IO::All; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 12 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 12 | ▶ | use Sys::Hostname; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | Parallel::Mpich::MPD::Common - Mpich Common datas and fonctions | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | Olivier Evalet, Alexandre Masselot, C<< <alexandre.masselot at genebio.com> >> | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | =head1 EXPORT | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | =head3 $MPICH_HOME | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | mpich prefix (where it was installed). [default is empty, so mpich command shall be in the path] | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | =head1 FUNCTIONS | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | =head2 Environment | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | =head2 env_MpichHome([$val]) | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | Get or set (if $val is defined) the Mpich home | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | =head2 env_Check | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | Check if mpd environment is correct | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | =head2 env_Print | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | print current environment | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | =head2 nbHostInMachinefile(machinesfile => $file) | ||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | return the nb hosts available on machinesfiles | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | =head2 commandPath($cmd) | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | prepend $MPICH_HOME/bin if $MPICH_HOME is defined and return the global command dstring | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | =head2 checkHosts(machinesfile => $machinesfile , hostsdown => \%hostsdown , hostsup =>\%hostsup) | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | check hosts from machinesfile. | ||||||||||||||||||||||||||||||||||||||||||
| 55 | - check hosts with a ping | ||||||||||||||||||||||||||||||||||||||||||
| 56 | - check that ssh publickey is well configured | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | =head2 cleanTemp | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | remove tmp files | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | =head2 __exec(cmd => $cmd, params => $params, [stdout=>\$stdout], [stderr=>\$stderr], [pid=>\$pid], [spawn=>$spawn=1]) | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | extended exec that return the exit value and catch stds and pid. | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | Please report any bugs or feature requests to | ||||||||||||||||||||||||||||||||||||||||||
| 70 | C<bug-parallel-mpich-mpd at rt.cpan.org>, or through the web interface at | ||||||||||||||||||||||||||||||||||||||||||
| 71 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Parallel-Mpich-MPD>. | ||||||||||||||||||||||||||||||||||||||||||
| 72 | I will be notified, and then you'll automatically be notified of progress on | ||||||||||||||||||||||||||||||||||||||||||
| 73 | your bug as I make changes. | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | perldoc Parallel::Mpich::MPD | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | You can also look for information at: | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | L<http://annocpan.org/dist/Parallel-Mpich-MPD> | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | =item * CPAN Ratings | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | L<http://cpanratings.perl.org/d/Parallel-Mpich-MPD> | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | =item * RT: CPAN's request tracker | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Parallel-Mpich-MPD> | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | =item * Search CPAN | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | L<http://search.cpan.org/dist/Parallel-Mpich-MPD> | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | Copyright 2006 Olivier Evalet, Alexandre Masselot, all rights reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||||||||||||||||
| 110 | under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 12 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||
| 115 | 12 | our %env; | |||||||||||||||||||||||||||||||||||||||||
| 116 | 12 | ▶ | our $MPICH_HOME=(defined $ENV{MPICH_HOME})?$ENV{MPICH_HOME}:""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 12 | our $TMP_MPD_PREFIX="mpd-$ENV{USER}"; | |||||||||||||||||||||||||||||||||||||||||
| 118 | 12 | our $DEBUG=0; | |||||||||||||||||||||||||||||||||||||||||
| 119 | 12 | our $WARN=0; | |||||||||||||||||||||||||||||||||||||||||
| 120 | 12 | our $TEST=0; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 12 | our $ERROR_MSG; | |||||||||||||||||||||||||||||||||||||||||
| 122 | 12 | our (@ISA, @EXPORT, @EXPORT_OK); | |||||||||||||||||||||||||||||||||||||||||
| 123 | 12 | our @MPDBINS= qw(mpdlistjobs mpdcheck mpdboot mpdcleanup mpdtrace mpdringtest mpdallexit mpiexec); | |||||||||||||||||||||||||||||||||||||||||
| 124 | 12 | @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||
| 125 | 12 | @EXPORT = qw(%env env_MpichHome env_Init env_Check env_RPC env_User commandPath checkHosts stripMachinefile $ERROR_MSG $TMP_MPD_PREFIX); | |||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 12 | @EXPORT_OK = (); | |||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | # | ||||||||||||||||||||||||||||||||||||||||||
| 132 | # environment functions | ||||||||||||||||||||||||||||||||||||||||||
| 133 | # | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | sub env_MpichHome{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
env_MpichHome: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | my $val=shift; | |||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | if(defined $val){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $MPICH_HOME=$val; | |||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | return $MPICH_HOME; | |||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 9 | ▶ | sub commandPath{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
commandPath: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | 9 | ▶ | my $cmd=shift or die "must provide a command to commanPath"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 9 | ▶ | return $MPICH_HOME?$MPICH_HOME."/bin/$cmd":$cmd; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 12 | our $_isEnvInited; | |||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 2 | ▶ | sub env_Init{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
env_Init: called CC=12 SCAR=28.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 2 | my %prms=@_; | |||||||||||||||||||||||||||||||||||||||||
| 152 | 2 | ▶ | if($prms{reset}){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | undef %env; | |||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | undef $_isEnvInited; | |||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 2 | ▶ | unless (defined $prms{root}){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 2 | my $id=`id -u`; | |||||||||||||||||||||||||||||||||||||||||
| 158 | 2 | chop $id; | |||||||||||||||||||||||||||||||||||||||||
| 159 | 2 | ▶ | die "ERROR: You must NOT run MPD as super user (root:$id)." if (!$TEST && $id==0 && defined $id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not $Parallel::Mpich::MPD::Common::TEST and $id == 0 and defined $id
not $Parallel::Mpich::MPD::Common::TEST and $id == 0
MC/DC0%0/3
not $Parallel::Mpich::MPD::Common::TEST and $id == 0 and defined $id
not $Parallel::Mpich::MPD::Common::TEST
$id == 0
defined $id
Truth table25%1/4
not(A) and B and C
A= not $Parallel::Mpich::MPD::Common::TESTB= $id == 0C= defined $id
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||
| 161 | 2 | ▶ | return if $_isEnvInited; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | 1 | ▶ | $env{path}=$MPICH_HOME?"$MPICH_HOME/bin":""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 1 | ▶ | env_Hostsfile("$ENV{HOME}/mpd.hosts") unless $env{conf}{mpd}{hostsfile}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | #os info | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 1 | $env{info}{user}="$ENV{USER}"; | |||||||||||||||||||||||||||||||||||||||||
| 169 | 1 | $env{info}{host}=hostname(); | |||||||||||||||||||||||||||||||||||||||||
| 170 | #mpd informations | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 1 | ▶ | $env{info}{ncpus}="0" unless $env{info}{ncpus}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 1 | ▶ | $env{info}{listport}="0" unless $env{info}{listport}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 1 | ▶ | $env{info}{ifhn}="" unless $env{info}{ifhn}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 1 | $_isEnvInited=1; | |||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | ▶ | sub env_Check{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
env_Check: called CC=6 SCAR=24.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 1 | my $stderr=""; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 1 | my $cpu=""; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 1 | env_Init(); | |||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | foreach (@MPDBINS){ | |||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | my $cmd=commandPath($_); | |||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | ▶ | unless(`$cmd -h`){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | $ERROR_MSG="ERROR:env_Check() cannot execute $cmd -h"; | |||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | goto err; | |||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | unless($env{conf}{mpiexec}{ncpu}){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $ERROR_MSG="ERROR:env_Check() empty number of cpu defined"; | |||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | goto err; | |||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | unless ( -e "$ENV{HOME}/.mpd.conf"){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | $ERROR_MSG="ERROR:env_Check() could not find \$HOME/.mpd.conf at : $ENV{HOME}/.mpd.conf"; | |||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | goto err; | |||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 199 | 1 | ▶ | err: | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | Carp::cluck $ERROR_MSG if defined($ERROR_MSG); | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | #env_User([$user]) | ||||||||||||||||||||||||||||||||||||||||||
| 206 | # $user specify the default user | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | sub env_User{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
env_User: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | my $user=shift; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $env{info}{user}=$user; | |||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | return $user; | |||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | sub env_Ncpu{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
env_Ncpu: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | my $ncpu=shift; | |||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | $env{conf}{mpiexec}{ncpu}=$ncpu; | |||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | return $ncpu; | |||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | #env_Hostsfile([$hostfile]) | ||||||||||||||||||||||||||||||||||||||||||
| 220 | # $hostfile specify the default hostsfile for mpd | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 2 | ▶ | sub env_Hostsfile{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
env_Hostsfile: called CC=4 SCAR=15.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | 2 | my ($hostsfile)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 223 | # Carp::cluck "HOST FILE=[$hostsfile]\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 224 | 2 | ▶ | return $env{conf}{mpd}{hostsfile} unless $hostsfile; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | 2 | ▶ | print STDERR "ERROR: no $hostsfile" && return 0 unless -f $hostsfile; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
"ERROR: no $hostsfile" && (return 0)
MC/DC0%0/1
"ERROR: no $hostsfile" && (return 0)
"ERROR: no $hostsfile"
Truth table0%0/2
A
A= "ERROR: no $hostsfile"
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | 2 | $env{conf}{mpd}{hostsfile}=$hostsfile; | |||||||||||||||||||||||||||||||||||||||||
| 229 | # the localhost should be added (could be a FIXME) | ||||||||||||||||||||||||||||||||||||||||||
| 230 | 2 | $env{conf}{mpiexec}{ncpu}=nbHostInMachinefile($env{conf}{mpd}{hostsfile}); | |||||||||||||||||||||||||||||||||||||||||
| 231 | 2 | return $env{conf}{mpd}{hostsfile}; | |||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | 2 | ▶ | sub nbHostInMachinefile{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nbHostInMachinefile: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 2 | ▶ | my $file=shift or die "must provide a file to ".__PACKAGE__.":nbHostInMachinefile()"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | 2 | my $hosts = io($file)->slurp; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 2 | $hosts=~s/#.*$//gm; | |||||||||||||||||||||||||||||||||||||||||
| 238 | 2 | my @tmp=split(/\s*\n\s*/, $hosts); | |||||||||||||||||||||||||||||||||||||||||
| 239 | 2 | my $count=@tmp; | |||||||||||||||||||||||||||||||||||||||||
| 240 | 2 | ▶ | print "DEBUG:nbHostInMachinefile(1) input=$file return=$count\n" if $DEBUG==1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | 2 | return $count; | |||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 6 | ▶ | sub stripMachinefile{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stripMachinefile: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 6 | ▶ | my $file=shift or die "must provide a file to ".__PACKAGE__.":stripMachinefile()"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | 6 | my $hosts = io($file)->slurp; | |||||||||||||||||||||||||||||||||||||||||
| 247 | 6 | $hosts=~s/#.*$//gm; | |||||||||||||||||||||||||||||||||||||||||
| 248 | 6 | my @tmp=split(/\s*\n\s*/, $hosts); | |||||||||||||||||||||||||||||||||||||||||
| 249 | 6 | my %host; | |||||||||||||||||||||||||||||||||||||||||
| 250 | 6 | foreach my $h (@tmp){ | |||||||||||||||||||||||||||||||||||||||||
| 251 | 24 | $host{$h}=1; | |||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | 6 | @tmp= keys %host; | |||||||||||||||||||||||||||||||||||||||||
| 254 | 6 | my $count=@tmp; | |||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | 6 | my $fh = new File::Temp(UNLINK=>0, TEMPLATE => File::Spec->tmpdir."/$TMP_MPD_PREFIX-hosts-XXXX"); | |||||||||||||||||||||||||||||||||||||||||
| 257 | 6 | foreach (@tmp){ | |||||||||||||||||||||||||||||||||||||||||
| 258 | 12 | print $fh $_."\n"; | |||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | 6 | ▶ | print "DEBUG:stripMachinefile(1) input=$file return=$count, output=".$fh->filename."\n" if $DEBUG==1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 6 | return ($count,$fh->filename); | |||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | 1 | ▶ | sub env_Print{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
env_Print: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | 1 | env_Init(); | |||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | printf "%-20s : %s\n", "user", "$env{info}{user}"; | |||||||||||||||||||||||||||||||||||||||||
| 268 | 1 | printf "%-20s : %s\n", "machinesfile", $env{conf}{mpd}{hostsfile}; | |||||||||||||||||||||||||||||||||||||||||
| 269 | 1 | printf "%-20s : %s\n", "mpiexec.cpu", $env{conf}{mpiexec}{ncpu}; | |||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | 1 | printf "%-20s : %s\n", "mpd.cpu", $env{info}{ncpus}; | |||||||||||||||||||||||||||||||||||||||||
| 272 | 1 | printf "%-20s : %s\n", "mpd.port", $env{info}{listport}; | |||||||||||||||||||||||||||||||||||||||||
| 273 | 1 | printf "%-20s : %s\n", "mpd.master", $env{info}{host}; | |||||||||||||||||||||||||||||||||||||||||
| 274 | 1 | printf "%-20s : %s\n", "mpd.ifhn", $env{info}{ifhn}; | |||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 1 | printf "%-20s : %s\n", "mpd.home", $MPICH_HOME; | |||||||||||||||||||||||||||||||||||||||||
| 277 | 1 | foreach (@MPDBINS){ | |||||||||||||||||||||||||||||||||||||||||
| 278 | 8 | printf "%-20s : %s\n", "mpd.command", $MPICH_HOME.commandPath($_); | |||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||
| 280 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | sub __param_buildHost{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__param_buildHost: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | #FIXME: ca veut dire quoi, cette ligne? | ||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | my @hosts=shift; | |||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | if(@hosts){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my $fh = new File::Temp(UNLINK=>!$ENV{DO_NOT_REMOVE_TEMPFILE}, TEMPLATE => File::Spec->tmpdir."/$TMP_MPD_PREFIX-hosts-XXXX"); | |||||||||||||||||||||||||||||||||||||||||
| 290 | # $hosts=~s/\s+/\n/g; | ||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | foreach (@hosts){ | |||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | print $fh $_."\n"; | |||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | return $fh->filename; | |||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | # Check hosts will : | ||||||||||||||||||||||||||||||||||||||||||
| 299 | # - check up or down | ||||||||||||||||||||||||||||||||||||||||||
| 300 | # - ssh publickey auth | ||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | # machinesfile => $machinesfile , hostsdown => \%hostsdown , hostsup =>\%hostsup | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | sub checkHosts{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkHosts: not called CC=19 SCAR=59.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | my %params=@_; | |||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | env_Init(); | |||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | my $hosts; | |||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | ▶ | my $hostsfile=(defined $params{machinesfile})? $params{machinesfile}:$env{conf}{mpd}{hostsfile}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | my $cmdssh; | |||||||||||||||||||||||||||||||||||||||||
| 309 | my %hostsdown; | ||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | my %hostsup; | |||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | if (defined $hostsfile && -e $hostsfile ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $hostsfile and -e $hostsfile
MC/DC0%0/2
defined $hostsfile and -e $hostsfile
defined $hostsfile
-e $hostsfile
Truth table0%0/3
A and B
A= defined $hostsfileB= -e $hostsfile
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | print "DEBUG: checkHosts -> $hostsfile\n" if ($Parallel::Mpich::MPD::Common::DEBUG == 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | $hosts=io($hostsfile)->slurp; | |||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | my $res; | |||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | foreach (split/\n/, $hosts){ | |||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | next unless /\S/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | next if /#.*$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | $cmdssh="LANG=POSIX ping -fq -c 1 -i200ms $_ &>/dev/null && ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no $_ exit 33 &>/dev/null"; | |||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | $res=int( system("$cmdssh") / 256); | |||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | print "INFO: sheck host on $_ \treturn :$res (33 for ok)\n" if $DEBUG==1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | print $cmdssh."\n\treturn:$res\n" if ($Parallel::Mpich::MPD::Common::DEBUG == 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | ▶ | if ("$res" eq "1" ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | print "WARNING: Connection refused on host: $_\n" if ($Parallel::Mpich::MPD::Common::WARN == 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | $hostsdown{$_}=1; | |||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | #ssh errors == 255 | ||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | if ("$res" eq "255" ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | print "WARNING: authentication method publickey is not working on host: $_\n" if ($Parallel::Mpich::MPD::Common::WARN == 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | $hostsdown{$_}=1; | |||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||
| 336 | #ssh publickey connexion ok == 33 | ||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | $hostsup{$_}=1 if ("$res" eq "33" ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | %{$params{hostsup}} = %hostsup if (defined $params{hostsup} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | if (defined( keys %hostsdown)){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | %{$params{hostsdown}}=%hostsdown if defined $params{hostsdown}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | return %hostsup=(); | |||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | print "INFO: authentication method publickey is working on all hosts." if ($Parallel::Mpich::MPD::Common::WARN == 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | return %hostsup; | |||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | print STDERR "ERROR: mpd hostsfile is not configured \n"; | |||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | return %hostsup=(); | |||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | 1 | ▶ | sub cleanTemp{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cleanTemp: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 355 | 1 | my $tmp=File::Spec->tmpdir; | |||||||||||||||||||||||||||||||||||||||||
| 356 | 1 | ▶ | die "ERROR:cleanTemp: tmp directory is not defined!" unless defined ($tmp); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 357 | 1 | my $cmd="rm -rf $tmp/$TMP_MPD_PREFIX-*"; | |||||||||||||||||||||||||||||||||||||||||
| 358 | 1 | return system($cmd)==0; | |||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | # | ||||||||||||||||||||||||||||||||||||||||||
| 362 | #{ | ||||||||||||||||||||||||||||||||||||||||||
| 363 | # cmd => $cmd, spawn => undef? , stdout => \$stdout, stderr => <$stderr, pid => \$pid | ||||||||||||||||||||||||||||||||||||||||||
| 364 | #} | ||||||||||||||||||||||||||||||||||||||||||
| 365 | 20 | ▶ | sub __exec{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__exec: called CC=15 SCAR=27.3
| |||||||||||||||||||||||||||||||||||||||||||
| 366 | 20 | my %params=@_; | |||||||||||||||||||||||||||||||||||||||||
| 367 | 20 | my $fout = new File::Temp(UNLINK=>1, TEMPLATE => File::Spec->tmpdir."/$TMP_MPD_PREFIX-sout-XXXX"); | |||||||||||||||||||||||||||||||||||||||||
| 368 | 20 | my $ferr = new File::Temp(UNLINK=>1, TEMPLATE => File::Spec->tmpdir."/$TMP_MPD_PREFIX-serr-XXXX"); | |||||||||||||||||||||||||||||||||||||||||
| 369 | 20 | my $ret=""; | |||||||||||||||||||||||||||||||||||||||||
| 370 | 20 | ▶ | my $end= ($params{spawn})? " </dev/null & ":""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 371 | 20 | ▶ | my $_out=(! $params{spawn} && defined($params{stdout}) )? " 1>".$fout->filename:""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $params{"spawn"} and defined $params{"stdout"}
MC/DC100%2/2
not $params{"spawn"} and defined $params{"stdout"}
not $params{"spawn"}
defined $params{"stdout"}
Truth table100%3/3
not(A) and B
A= not $params{"spawn"}B= defined $params{"stdout"}
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | 20 | ▶ | my $_err=(! $params{spawn} && defined($params{stderr}) )? " 2>".$ferr->filename:""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $params{"spawn"} and defined $params{"stderr"}
MC/DC100%2/2
not $params{"spawn"} and defined $params{"stderr"}
not $params{"spawn"}
defined $params{"stderr"}
Truth table100%3/3
not(A) and B
A= not $params{"spawn"}B= defined $params{"stderr"}
| |||||||||||||||||||||||||||||||||||||||||||
| 373 | 20 | my $p = fork(); | |||||||||||||||||||||||||||||||||||||||||
| 374 | 20 | ▶ | if ($p == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 5 | ▶ | print STDERR "DEBUG: ".__PACKAGE__."::__exec($params{cmd} ".$_out . $_err .$end.")\n" if ($DEBUG==1) or $params{verbose}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$Parallel::Mpich::MPD::Common::DEBUG == 1 or $params{"verbose"}
MC/DC0%0/2
$Parallel::Mpich::MPD::Common::DEBUG == 1 or $params{"verbose"}
$Parallel::Mpich::MPD::Common::DEBUG == 1
$params{"verbose"}
Truth table33%1/3
A or B
A= $Parallel::Mpich::MPD::Common::DEBUG == 1B= $params{"verbose"}
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | 5 | ▶ | exec($params{cmd} .$_out . $_err .$end) || return 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 378 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 379 | 15 | ▶ | ${$params{pid}}=$p if (defined($params{pid})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 380 | 15 | ▶ | if ($params{spawn}){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 381 | 2 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | 13 | waitpid($p, 0); | |||||||||||||||||||||||||||||||||||||||||
| 384 | 13 | my $exitval=$?/256; | |||||||||||||||||||||||||||||||||||||||||
| 385 | 13 | ▶ | print STDERR __PACKAGE__."(".__LINE__.")exitval=[$exitval][$?]\n" if ($DEBUG==1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 386 | 13 | ▶ | if (defined($params{stdout})){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | 1 | ${$params{stdout}}=io($fout->filename)->slurp; | |||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||
| 389 | 13 | ▶ | if (defined($params{stderr})){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | 4 | ${$params{stderr}}=io($ferr->filename)->slurp ; | |||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||
| 392 | 13 | $ret=$exitval; | |||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||
| 394 | 13 | return $ret; | |||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | # __exec($cmd,$stdout,$stderr) return exit code | ||||||||||||||||||||||||||||||||||||||||||
| 399 | # sub __exec_old{ | ||||||||||||||||||||||||||||||||||||||||||
| 400 | # my ($cmd,$stdout,$stderr, $pid)=@_; | ||||||||||||||||||||||||||||||||||||||||||
| 401 | # my $fout = new File::Temp(UNLINK=>1); | ||||||||||||||||||||||||||||||||||||||||||
| 402 | # my $ferr = new File::Temp(UNLINK=>1); | ||||||||||||||||||||||||||||||||||||||||||
| 403 | # my $ret=system("$cmd 1>".$fout->filename." 2>".$ferr->filename) >> 8; | ||||||||||||||||||||||||||||||||||||||||||
| 404 | # io($fout->filename) > $$stdout; | ||||||||||||||||||||||||||||||||||||||||||
| 405 | # io($ferr->filename) > $$stderr; | ||||||||||||||||||||||||||||||||||||||||||
| 406 | # return $ret; | ||||||||||||||||||||||||||||||||||||||||||
| 407 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | 7 | ▶ | END { } # module clean-up code here (global destructor) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
END: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | 12 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | __END__ | ||||||||||||||||||||||||||||||||||||||||||